Datasets:
abhik1505040
commited on
Commit
•
4ba594d
1
Parent(s):
a064f3d
Update CrossSum.py
Browse files- CrossSum.py +10 -0
CrossSum.py
CHANGED
@@ -143,6 +143,7 @@ class Crosssum(datasets.GeneratorBasedBuilder):
|
|
143 |
def _generate_examples(self, filepath):
|
144 |
"""Yields examples as (key, example) tuples."""
|
145 |
with open(filepath, encoding="utf-8") as f:
|
|
|
146 |
for idx_, row in enumerate(f):
|
147 |
data = json.loads(row)
|
148 |
yield idx_, {
|
@@ -151,3 +152,12 @@ class Crosssum(datasets.GeneratorBasedBuilder):
|
|
151 |
"summary": data["summary"],
|
152 |
"text": data["text"],
|
153 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
def _generate_examples(self, filepath):
|
144 |
"""Yields examples as (key, example) tuples."""
|
145 |
with open(filepath, encoding="utf-8") as f:
|
146 |
+
idx_ = -1
|
147 |
for idx_, row in enumerate(f):
|
148 |
data = json.loads(row)
|
149 |
yield idx_, {
|
|
|
152 |
"summary": data["summary"],
|
153 |
"text": data["text"],
|
154 |
}
|
155 |
+
|
156 |
+
# empty splits for extremely low-resource pairs
|
157 |
+
if idx_ == -1:
|
158 |
+
yield 0, {
|
159 |
+
"source_url": "",
|
160 |
+
"target_url": "",
|
161 |
+
"summary": "",
|
162 |
+
"text": "",
|
163 |
+
}
|