Update EC40.py
Browse files
EC40.py
CHANGED
@@ -133,9 +133,11 @@ class EC40(datasets.GeneratorBasedBuilder):
|
|
133 |
src_tag, tgt_tag = self.config.language_pair.split("-")
|
134 |
src, tgt = None, None
|
135 |
|
136 |
-
|
137 |
-
|
138 |
-
|
|
|
|
|
139 |
if src is not None and tgt is not None:
|
140 |
for idx, (s, t) in enumerate(zip(src, tgt)):
|
141 |
yield idx, {"translation": {src_tag: s, tgt_tag: t}}
|
|
|
133 |
src_tag, tgt_tag = self.config.language_pair.split("-")
|
134 |
src, tgt = None, None
|
135 |
|
136 |
+
with open(filepath, encoding="utf-8") as f:
|
137 |
+
src = f.read().decode("utf-8").split("\n")
|
138 |
+
with open(labelpath, encoding="utf-8") as f:
|
139 |
+
tgt = f.read().decode("utf-8").split("\n")
|
140 |
+
|
141 |
if src is not None and tgt is not None:
|
142 |
for idx, (s, t) in enumerate(zip(src, tgt)):
|
143 |
yield idx, {"translation": {src_tag: s, tgt_tag: t}}
|