Update iwslt14.py
Browse files- iwslt14.py +13 -12
iwslt14.py
CHANGED
@@ -175,15 +175,16 @@ class IWSLT14(datasets.GeneratorBasedBuilder):
|
|
175 |
talk_id = f"d{doc_counter}"
|
176 |
flag = ""
|
177 |
for source_file, target_file in zip(source_files, target_files):
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
|
|
|
175 |
talk_id = f"d{doc_counter}"
|
176 |
flag = ""
|
177 |
for source_file, target_file in zip(source_files, target_files):
|
178 |
+
if Path(source_file).is_file() and Path(target_file).is_file():
|
179 |
+
src = _parse(source_file)
|
180 |
+
trg = _parse(target_file)
|
181 |
+
|
182 |
+
for k, src_sent in src.items():
|
183 |
+
if k in trg:
|
184 |
+
trg_sent = trg[k]
|
185 |
+
|
186 |
+
yield id_, {
|
187 |
+
"id": k,
|
188 |
+
"translation": {source: src_sent, target: trg_sent}
|
189 |
+
}
|
190 |
+
id_ += 1
|