Datasets:
Update long-summarization-persian.py
Browse files
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 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
}
|