Update EC40.py
Browse files
EC40.py
CHANGED
@@ -133,13 +133,21 @@ class EC40(datasets.GeneratorBasedBuilder):
|
|
133 |
src_tag, tgt_tag = self.config.language_pair.split("-")
|
134 |
src, tgt = None, None
|
135 |
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
|
144 |
#for path, f in files:
|
145 |
# if path == filepath:
|
|
|
133 |
src_tag, tgt_tag = self.config.language_pair.split("-")
|
134 |
src, tgt = None, None
|
135 |
|
136 |
+
|
137 |
+
src = filepath.read().decode("utf-8").split("\n")
|
138 |
+
tgt = labelpath.read().decode("utf-8").split("\n")
|
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}}
|
142 |
+
|
143 |
+
|
144 |
+
#for path, f in filepath:
|
145 |
+
# src = f.read().decode("utf-8").split("\n")
|
146 |
+
# tgt = f.read().decode("utf-8").split("\n")
|
147 |
+
# if src is not None and tgt is not None:
|
148 |
+
# for idx, (s, t) in enumerate(zip(src, tgt)):
|
149 |
+
# yield idx, {"translation": {src_tag: s, tgt_tag: t}}
|
150 |
+
# break
|
151 |
|
152 |
#for path, f in files:
|
153 |
# if path == filepath:
|