Update forai_ml-ted_talk_iwslt.py
Browse files- forai_ml-ted_talk_iwslt.py +20 -7
forai_ml-ted_talk_iwslt.py
CHANGED
@@ -187,6 +187,16 @@ _LANGUAGE_PAIRS = [
|
|
187 |
("fr-ca", "hi"),
|
188 |
]
|
189 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
190 |
# Year subscripts for the specific folder
|
191 |
_YEAR = {"2014": "-20140120", "2015": "-20150530", "2016": "-20160408"}
|
192 |
|
@@ -251,9 +261,14 @@ class TedTalksIWSLT(datasets.GeneratorBasedBuilder):
|
|
251 |
def _info(self):
|
252 |
features = datasets.Features(
|
253 |
{
|
254 |
-
"translation": datasets.features.Translation(
|
255 |
-
|
256 |
-
),
|
|
|
|
|
|
|
|
|
|
|
257 |
},
|
258 |
)
|
259 |
|
@@ -432,11 +447,9 @@ class TedTalksIWSLT(datasets.GeneratorBasedBuilder):
|
|
432 |
translation.extend(transcriptions)
|
433 |
for talk_segment in translation:
|
434 |
result = {
|
435 |
-
"translation": {
|
436 |
"source": talk_segment[language_pair[0]],
|
437 |
"target": talk_segment[language_pair[1]],
|
438 |
-
"
|
439 |
-
"
|
440 |
-
}
|
441 |
}
|
442 |
yield talk_segment["id"], result
|
|
|
187 |
("fr-ca", "hi"),
|
188 |
]
|
189 |
|
190 |
+
_LANGUAGE_TO_FULL_NAME = {
|
191 |
+
"eu": "Basque",
|
192 |
+
"de": "German",
|
193 |
+
"nl": "Dutch",
|
194 |
+
"hi": "Hindi",
|
195 |
+
"ja": "Japanese",
|
196 |
+
"fr-ca": "French",
|
197 |
+
"ca": "Catalan"
|
198 |
+
}
|
199 |
+
|
200 |
# Year subscripts for the specific folder
|
201 |
_YEAR = {"2014": "-20140120", "2015": "-20150530", "2016": "-20160408"}
|
202 |
|
|
|
261 |
def _info(self):
|
262 |
features = datasets.Features(
|
263 |
{
|
264 |
+
# "translation": datasets.features.Translation(
|
265 |
+
# languages=self.config.language_pair
|
266 |
+
# ),
|
267 |
+
|
268 |
+
"source": datasets.Value("string"),
|
269 |
+
"target": datasets.Value("string"),
|
270 |
+
"source_lang": datasets.Value("string"),
|
271 |
+
"target_lang": datasets.Value("string"),
|
272 |
},
|
273 |
)
|
274 |
|
|
|
447 |
translation.extend(transcriptions)
|
448 |
for talk_segment in translation:
|
449 |
result = {
|
|
|
450 |
"source": talk_segment[language_pair[0]],
|
451 |
"target": talk_segment[language_pair[1]],
|
452 |
+
"source_lang": _LANGUAGE_TO_FULL_NAME[language_pair[0]],
|
453 |
+
"target_lang": _LANGUAGE_TO_FULL_NAME[language_pair[1]],
|
|
|
454 |
}
|
455 |
yield talk_segment["id"], result
|