Update EC40.py
Browse files
EC40.py
CHANGED
@@ -128,16 +128,25 @@ class EC40(datasets.GeneratorBasedBuilder):
|
|
128 |
datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": test_src, "labelpath": test_tgt, "split": "test"}),
|
129 |
]
|
130 |
|
131 |
-
def _generate_examples(self, filepath, labelpath,
|
132 |
"""Yields examples."""
|
133 |
src_tag, tgt_tag = self.config.language_pair.split("-")
|
134 |
src, tgt = None, None
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
tgt = f.read().decode("utf-8").split("\n")[:-1]
|
140 |
if src is not None and tgt is not None:
|
141 |
for idx, (s, t) in enumerate(zip(src, tgt)):
|
142 |
yield idx, {"translation": {src_tag: s, tgt_tag: t}}
|
143 |
-
break
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": test_src, "labelpath": test_tgt, "split": "test"}),
|
129 |
]
|
130 |
|
131 |
+
def _generate_examples(self, filepath, labelpath, split):
|
132 |
"""Yields examples."""
|
133 |
src_tag, tgt_tag = self.config.language_pair.split("-")
|
134 |
src, tgt = None, None
|
135 |
+
|
136 |
+
for path, f in filepath:
|
137 |
+
src = f.read().decode("utf-8").split("\n")
|
138 |
+
tgt = f.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 |
+
break
|
143 |
+
|
144 |
+
#for path, f in files:
|
145 |
+
# if path == filepath:
|
146 |
+
# src = f.read().decode("utf-8").split("\n")#[:-1]
|
147 |
+
# elif path == labelpath:
|
148 |
+
# tgt = f.read().decode("utf-8").split("\n")#[:-1]
|
149 |
+
# if src is not None and tgt is not None:
|
150 |
+
# for idx, (s, t) in enumerate(zip(src, tgt)):
|
151 |
+
# yield idx, {"translation": {src_tag: s, tgt_tag: t}}
|
152 |
+
# break
|