Datasets:
Fix tags
Browse files- iwslt2017_context.py +7 -10
iwslt2017_context.py
CHANGED
@@ -215,15 +215,13 @@ class IWSLT217(datasets.GeneratorBasedBuilder):
|
|
215 |
|
216 |
source_row = source_seg.strip()
|
217 |
target_row = target_seg.strip()
|
218 |
-
else:
|
219 |
-
continue
|
220 |
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
else: # train
|
228 |
for source_row, target_row in zip(sf, tf):
|
229 |
source_row = source_row.strip()
|
@@ -233,8 +231,7 @@ class IWSLT217(datasets.GeneratorBasedBuilder):
|
|
233 |
if source_row.startswith("<doc"):
|
234 |
doc_id = int(re.findall(DOCID_PATTERN, source_row)[0])
|
235 |
seg_id = 0
|
236 |
-
|
237 |
-
continue
|
238 |
yield id_, {
|
239 |
"doc_id": doc_id,
|
240 |
"seg_id": seg_id,
|
|
|
215 |
|
216 |
source_row = source_seg.strip()
|
217 |
target_row = target_seg.strip()
|
|
|
|
|
218 |
|
219 |
+
yield id_, {
|
220 |
+
"doc_id": doc_id,
|
221 |
+
"seg_id": seg_id,
|
222 |
+
"translation": {source: source_row, target: target_row}
|
223 |
+
}
|
224 |
+
id_ += 1
|
225 |
else: # train
|
226 |
for source_row, target_row in zip(sf, tf):
|
227 |
source_row = source_row.strip()
|
|
|
231 |
if source_row.startswith("<doc"):
|
232 |
doc_id = int(re.findall(DOCID_PATTERN, source_row)[0])
|
233 |
seg_id = 0
|
234 |
+
continue
|
|
|
235 |
yield id_, {
|
236 |
"doc_id": doc_id,
|
237 |
"seg_id": seg_id,
|