hofarah commited on
Commit
6c4d8d8
1 Parent(s): a07a6c8

Update long-summarization-persian.py

Browse files
Files changed (1) hide show
  1. long-summarization-persian.py +15 -4
long-summarization-persian.py CHANGED
@@ -77,7 +77,18 @@ class long_summarization_persian(datasets.GeneratorBasedBuilder):
77
  gen_kwargs={"filepath": downloaded_files["validation"]},
78
  ),
79
  ]
80
- def _generate_examples(self, filepath, split):
81
- df = pd.read_csv(filepath)
82
- for idx, example in enumerate(df.itertuples(index=False)):
83
- yield idx, {"id":example.id,"article": example.article, "summary": example.summary}
 
 
 
 
 
 
 
 
 
 
 
 
77
  gen_kwargs={"filepath": downloaded_files["validation"]},
78
  ),
79
  ]
80
+
81
+
82
+
83
+ def _generate_examples(self, filepath):
84
+ """This function returns the examples in the raw (text) form."""
85
+ logger.info("generating examples from = %s", filepath)
86
+ with open(filepath, encoding="utf-8") as f:
87
+ data = json.load(f)
88
+ for id_, article in enumerate(data):
89
+ article = article["article"]
90
+ summary = article["summary"]
91
+ yield id_, {
92
+ "article": article,
93
+ "summary": summary,
94
+ }