Datasets:
Commit
•
8362267
1
Parent(s):
d458f79
Convert dataset to Parquet (#2)
Browse files- Convert dataset to Parquet (940a408f4facaa18457e9da72dfc3ea06858c99c)
- Add bg-csb data files (8a2654072a6d5dee6f6a04a90a6e933825e69e45)
- Add ca-en_GB data files (e7c3e0d3c29c8df55075bfec3b0abadfcb6b7619)
- Add cs-eo data files (ee7ba7d4f1d30c075b7b576a9bf4f4170fdac0c6)
- Add cs-tk data files (12a8928af37a9befc3bec97f2dcc4e261c444524)
- Add da-vi data files (197cd6b792103d5e9f0cb4694dbc75100e207f58)
- Add de-ha data files (1a66a01ed7ad327d43108b9dadf5c43739093de9)
- Add de-tt data files (22e728aa9b5eaf1ecf0846914c803963020e1c25)
- Add el-sk data files (8b8dfb578c58547c3ada55e6f055acb260e59dc2)
- Add en_GB-my data files (d866c6881440dd8f89857f4caeb08c7c5b73d823)
- Delete loading script (0608e871625fe741d871ddd13cfc240c47589f1b)
- README.md +116 -76
- ar-bal/train-00000-of-00001.parquet +3 -0
- bg-csb/train-00000-of-00001.parquet +3 -0
- ca-en_GB/train-00000-of-00001.parquet +3 -0
- cs-eo/train-00000-of-00001.parquet +3 -0
- cs-tk/train-00000-of-00001.parquet +3 -0
- da-vi/train-00000-of-00001.parquet +3 -0
- de-ha/train-00000-of-00001.parquet +3 -0
- de-tt/train-00000-of-00001.parquet +3 -0
- el-sk/train-00000-of-00001.parquet +3 -0
- en_GB-my/train-00000-of-00001.parquet +3 -0
- opus_gnome.py +0 -133
README.md
CHANGED
@@ -141,6 +141,31 @@ language:
|
|
141 |
- yo
|
142 |
- zh
|
143 |
- zu
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
language_bcp47:
|
145 |
- ar-TN
|
146 |
- az-IR
|
@@ -189,21 +214,6 @@ language_bcp47:
|
|
189 |
- zh-CN
|
190 |
- zh-HK
|
191 |
- zh-TW
|
192 |
-
license:
|
193 |
-
- unknown
|
194 |
-
multilinguality:
|
195 |
-
- multilingual
|
196 |
-
size_categories:
|
197 |
-
- 10K<n<100K
|
198 |
-
- 1K<n<10K
|
199 |
-
- n<1K
|
200 |
-
source_datasets:
|
201 |
-
- original
|
202 |
-
task_categories:
|
203 |
-
- translation
|
204 |
-
task_ids: []
|
205 |
-
paperswithcode_id: null
|
206 |
-
pretty_name: OpusGnome
|
207 |
dataset_info:
|
208 |
- config_name: ar-bal
|
209 |
features:
|
@@ -217,10 +227,10 @@ dataset_info:
|
|
217 |
- bal
|
218 |
splits:
|
219 |
- name: train
|
220 |
-
num_bytes:
|
221 |
num_examples: 60
|
222 |
-
download_size:
|
223 |
-
dataset_size:
|
224 |
- config_name: bg-csb
|
225 |
features:
|
226 |
- name: id
|
@@ -233,10 +243,10 @@ dataset_info:
|
|
233 |
- csb
|
234 |
splits:
|
235 |
- name: train
|
236 |
-
num_bytes:
|
237 |
num_examples: 1768
|
238 |
-
download_size:
|
239 |
-
dataset_size:
|
240 |
- config_name: ca-en_GB
|
241 |
features:
|
242 |
- name: id
|
@@ -249,10 +259,10 @@ dataset_info:
|
|
249 |
- en_GB
|
250 |
splits:
|
251 |
- name: train
|
252 |
-
num_bytes:
|
253 |
num_examples: 7982
|
254 |
-
download_size:
|
255 |
-
dataset_size:
|
256 |
- config_name: cs-eo
|
257 |
features:
|
258 |
- name: id
|
@@ -265,11 +275,11 @@ dataset_info:
|
|
265 |
- eo
|
266 |
splits:
|
267 |
- name: train
|
268 |
-
num_bytes:
|
269 |
num_examples: 73
|
270 |
-
download_size:
|
271 |
-
dataset_size:
|
272 |
-
- config_name:
|
273 |
features:
|
274 |
- name: id
|
275 |
dtype: string
|
@@ -277,15 +287,15 @@ dataset_info:
|
|
277 |
dtype:
|
278 |
translation:
|
279 |
languages:
|
280 |
-
-
|
281 |
-
-
|
282 |
splits:
|
283 |
- name: train
|
284 |
-
num_bytes:
|
285 |
-
num_examples:
|
286 |
-
download_size:
|
287 |
-
dataset_size:
|
288 |
-
- config_name:
|
289 |
features:
|
290 |
- name: id
|
291 |
dtype: string
|
@@ -293,15 +303,15 @@ dataset_info:
|
|
293 |
dtype:
|
294 |
translation:
|
295 |
languages:
|
296 |
-
-
|
297 |
-
-
|
298 |
splits:
|
299 |
- name: train
|
300 |
-
num_bytes:
|
301 |
-
num_examples:
|
302 |
-
download_size:
|
303 |
-
dataset_size:
|
304 |
-
- config_name:
|
305 |
features:
|
306 |
- name: id
|
307 |
dtype: string
|
@@ -309,15 +319,15 @@ dataset_info:
|
|
309 |
dtype:
|
310 |
translation:
|
311 |
languages:
|
312 |
-
-
|
313 |
-
-
|
314 |
splits:
|
315 |
- name: train
|
316 |
-
num_bytes:
|
317 |
-
num_examples:
|
318 |
-
download_size:
|
319 |
-
dataset_size:
|
320 |
-
- config_name:
|
321 |
features:
|
322 |
- name: id
|
323 |
dtype: string
|
@@ -325,14 +335,14 @@ dataset_info:
|
|
325 |
dtype:
|
326 |
translation:
|
327 |
languages:
|
328 |
-
-
|
329 |
-
-
|
330 |
splits:
|
331 |
- name: train
|
332 |
-
num_bytes:
|
333 |
-
num_examples:
|
334 |
-
download_size:
|
335 |
-
dataset_size:
|
336 |
- config_name: el-sk
|
337 |
features:
|
338 |
- name: id
|
@@ -345,11 +355,11 @@ dataset_info:
|
|
345 |
- sk
|
346 |
splits:
|
347 |
- name: train
|
348 |
-
num_bytes:
|
349 |
num_examples: 150
|
350 |
-
download_size:
|
351 |
-
dataset_size:
|
352 |
-
- config_name:
|
353 |
features:
|
354 |
- name: id
|
355 |
dtype: string
|
@@ -357,25 +367,55 @@ dataset_info:
|
|
357 |
dtype:
|
358 |
translation:
|
359 |
languages:
|
360 |
-
-
|
361 |
-
-
|
362 |
splits:
|
363 |
- name: train
|
364 |
-
num_bytes:
|
365 |
-
num_examples:
|
366 |
-
download_size:
|
367 |
-
dataset_size:
|
368 |
-
|
369 |
-
- ar-bal
|
370 |
-
|
371 |
-
-
|
372 |
-
|
373 |
-
-
|
374 |
-
|
375 |
-
-
|
376 |
-
|
377 |
-
-
|
378 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
379 |
---
|
380 |
|
381 |
# Dataset Card for Opus Gnome
|
|
|
141 |
- yo
|
142 |
- zh
|
143 |
- zu
|
144 |
+
license:
|
145 |
+
- unknown
|
146 |
+
multilinguality:
|
147 |
+
- multilingual
|
148 |
+
size_categories:
|
149 |
+
- 10K<n<100K
|
150 |
+
- 1K<n<10K
|
151 |
+
- n<1K
|
152 |
+
source_datasets:
|
153 |
+
- original
|
154 |
+
task_categories:
|
155 |
+
- translation
|
156 |
+
task_ids: []
|
157 |
+
pretty_name: OpusGnome
|
158 |
+
config_names:
|
159 |
+
- ar-bal
|
160 |
+
- bg-csb
|
161 |
+
- ca-en_GB
|
162 |
+
- cs-eo
|
163 |
+
- cs-tk
|
164 |
+
- da-vi
|
165 |
+
- de-ha
|
166 |
+
- de-tt
|
167 |
+
- el-sk
|
168 |
+
- en_GB-my
|
169 |
language_bcp47:
|
170 |
- ar-TN
|
171 |
- az-IR
|
|
|
214 |
- zh-CN
|
215 |
- zh-HK
|
216 |
- zh-TW
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
217 |
dataset_info:
|
218 |
- config_name: ar-bal
|
219 |
features:
|
|
|
227 |
- bal
|
228 |
splits:
|
229 |
- name: train
|
230 |
+
num_bytes: 5138
|
231 |
num_examples: 60
|
232 |
+
download_size: 3695
|
233 |
+
dataset_size: 5138
|
234 |
- config_name: bg-csb
|
235 |
features:
|
236 |
- name: id
|
|
|
243 |
- csb
|
244 |
splits:
|
245 |
- name: train
|
246 |
+
num_bytes: 172533
|
247 |
num_examples: 1768
|
248 |
+
download_size: 48120
|
249 |
+
dataset_size: 172533
|
250 |
- config_name: ca-en_GB
|
251 |
features:
|
252 |
- name: id
|
|
|
259 |
- en_GB
|
260 |
splits:
|
261 |
- name: train
|
262 |
+
num_bytes: 1007476
|
263 |
num_examples: 7982
|
264 |
+
download_size: 422733
|
265 |
+
dataset_size: 1007476
|
266 |
- config_name: cs-eo
|
267 |
features:
|
268 |
- name: id
|
|
|
275 |
- eo
|
276 |
splits:
|
277 |
- name: train
|
278 |
+
num_bytes: 2883
|
279 |
num_examples: 73
|
280 |
+
download_size: 4183
|
281 |
+
dataset_size: 2883
|
282 |
+
- config_name: cs-tk
|
283 |
features:
|
284 |
- name: id
|
285 |
dtype: string
|
|
|
287 |
dtype:
|
288 |
translation:
|
289 |
languages:
|
290 |
+
- cs
|
291 |
+
- tk
|
292 |
splits:
|
293 |
- name: train
|
294 |
+
num_bytes: 1197707
|
295 |
+
num_examples: 18686
|
296 |
+
download_size: 387467
|
297 |
+
dataset_size: 1197707
|
298 |
+
- config_name: da-vi
|
299 |
features:
|
300 |
- name: id
|
301 |
dtype: string
|
|
|
303 |
dtype:
|
304 |
translation:
|
305 |
languages:
|
306 |
+
- da
|
307 |
+
- vi
|
308 |
splits:
|
309 |
- name: train
|
310 |
+
num_bytes: 9360
|
311 |
+
num_examples: 149
|
312 |
+
download_size: 8243
|
313 |
+
dataset_size: 9360
|
314 |
+
- config_name: de-ha
|
315 |
features:
|
316 |
- name: id
|
317 |
dtype: string
|
|
|
319 |
dtype:
|
320 |
translation:
|
321 |
languages:
|
322 |
+
- de
|
323 |
+
- ha
|
324 |
splits:
|
325 |
- name: train
|
326 |
+
num_bytes: 22887
|
327 |
+
num_examples: 216
|
328 |
+
download_size: 8846
|
329 |
+
dataset_size: 22887
|
330 |
+
- config_name: de-tt
|
331 |
features:
|
332 |
- name: id
|
333 |
dtype: string
|
|
|
335 |
dtype:
|
336 |
translation:
|
337 |
languages:
|
338 |
+
- de
|
339 |
+
- tt
|
340 |
splits:
|
341 |
- name: train
|
342 |
+
num_bytes: 134966
|
343 |
+
num_examples: 2169
|
344 |
+
download_size: 38009
|
345 |
+
dataset_size: 134966
|
346 |
- config_name: el-sk
|
347 |
features:
|
348 |
- name: id
|
|
|
355 |
- sk
|
356 |
splits:
|
357 |
- name: train
|
358 |
+
num_bytes: 12109
|
359 |
num_examples: 150
|
360 |
+
download_size: 9379
|
361 |
+
dataset_size: 12109
|
362 |
+
- config_name: en_GB-my
|
363 |
features:
|
364 |
- name: id
|
365 |
dtype: string
|
|
|
367 |
dtype:
|
368 |
translation:
|
369 |
languages:
|
370 |
+
- en_GB
|
371 |
+
- my
|
372 |
splits:
|
373 |
- name: train
|
374 |
+
num_bytes: 3298038
|
375 |
+
num_examples: 28232
|
376 |
+
download_size: 1045971
|
377 |
+
dataset_size: 3298038
|
378 |
+
configs:
|
379 |
+
- config_name: ar-bal
|
380 |
+
data_files:
|
381 |
+
- split: train
|
382 |
+
path: ar-bal/train-*
|
383 |
+
- config_name: bg-csb
|
384 |
+
data_files:
|
385 |
+
- split: train
|
386 |
+
path: bg-csb/train-*
|
387 |
+
- config_name: ca-en_GB
|
388 |
+
data_files:
|
389 |
+
- split: train
|
390 |
+
path: ca-en_GB/train-*
|
391 |
+
- config_name: cs-eo
|
392 |
+
data_files:
|
393 |
+
- split: train
|
394 |
+
path: cs-eo/train-*
|
395 |
+
- config_name: cs-tk
|
396 |
+
data_files:
|
397 |
+
- split: train
|
398 |
+
path: cs-tk/train-*
|
399 |
+
- config_name: da-vi
|
400 |
+
data_files:
|
401 |
+
- split: train
|
402 |
+
path: da-vi/train-*
|
403 |
+
- config_name: de-ha
|
404 |
+
data_files:
|
405 |
+
- split: train
|
406 |
+
path: de-ha/train-*
|
407 |
+
- config_name: de-tt
|
408 |
+
data_files:
|
409 |
+
- split: train
|
410 |
+
path: de-tt/train-*
|
411 |
+
- config_name: el-sk
|
412 |
+
data_files:
|
413 |
+
- split: train
|
414 |
+
path: el-sk/train-*
|
415 |
+
- config_name: en_GB-my
|
416 |
+
data_files:
|
417 |
+
- split: train
|
418 |
+
path: en_GB-my/train-*
|
419 |
---
|
420 |
|
421 |
# Dataset Card for Opus Gnome
|
ar-bal/train-00000-of-00001.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:95f5fc64ced5e6bebf573e1f1d0872410b6660588cf6db899e023142e81730ec
|
3 |
+
size 3695
|
bg-csb/train-00000-of-00001.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9af3035e5c5245550d3d172e1b87b60b7ffefa7493a2791bb99d8dfa7239c8b7
|
3 |
+
size 48120
|
ca-en_GB/train-00000-of-00001.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0f0ed7c0f62ce9c15565f7d5482ecee3e3239c3a18646160555e7618b3246961
|
3 |
+
size 422733
|
cs-eo/train-00000-of-00001.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:22dfffc17ea3dc9ffa6a69c1a3a88c0af0f8f6385da1c3626ae0c2daddb9f8f3
|
3 |
+
size 4183
|
cs-tk/train-00000-of-00001.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6b0545af44fedb666f7b4bfc65e8a2d79cd7898246143eb42e9d0f7e287915a4
|
3 |
+
size 387467
|
da-vi/train-00000-of-00001.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b60fdcf6dd94f9bb6fcf2186763b002acd637da36c02dc4982f42b7a08b09f99
|
3 |
+
size 8243
|
de-ha/train-00000-of-00001.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:36a8832647f9171c8f8dd991e3eb08ceee97db073d4be8a25dfcc77758b3ca4f
|
3 |
+
size 8846
|
de-tt/train-00000-of-00001.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8990d329536d9fb3d0a28c4548172be1f0ad01fb0389c66f849d7501ebb54173
|
3 |
+
size 38009
|
el-sk/train-00000-of-00001.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:315adb9a2709abf4169c53f314521a041a2f7c351054ad5884de92d711d191ab
|
3 |
+
size 9379
|
en_GB-my/train-00000-of-00001.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:58136c665ab1785871487139380a6d248546476092f245e59ac32d698db5bd89
|
3 |
+
size 1045971
|
opus_gnome.py
DELETED
@@ -1,133 +0,0 @@
|
|
1 |
-
# coding=utf-8
|
2 |
-
# Copyright 2020 HuggingFace Datasets Authors.
|
3 |
-
#
|
4 |
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
5 |
-
# you may not use this file except in compliance with the License.
|
6 |
-
# You may obtain a copy of the License at
|
7 |
-
#
|
8 |
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9 |
-
#
|
10 |
-
# Unless required by applicable law or agreed to in writing, software
|
11 |
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
12 |
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13 |
-
# See the License for the specific language governing permissions and
|
14 |
-
# limitations under the License.
|
15 |
-
|
16 |
-
# Lint as: python3
|
17 |
-
import os
|
18 |
-
|
19 |
-
import datasets
|
20 |
-
|
21 |
-
|
22 |
-
_DESCRIPTION = """\
|
23 |
-
A parallel corpus of GNOME localization files. Source: https://l10n.gnome.org
|
24 |
-
|
25 |
-
187 languages, 12,822 bitexts
|
26 |
-
total number of files: 113,344
|
27 |
-
total number of tokens: 267.27M
|
28 |
-
total number of sentence fragments: 58.12M
|
29 |
-
"""
|
30 |
-
_HOMEPAGE_URL = "http://opus.nlpl.eu/GNOME.php"
|
31 |
-
_CITATION = """\
|
32 |
-
@InProceedings{TIEDEMANN12.463,
|
33 |
-
author = {J{\"o}rg Tiedemann},
|
34 |
-
title = {Parallel Data, Tools and Interfaces in OPUS},
|
35 |
-
booktitle = {Proceedings of the Eight International Conference on Language Resources and Evaluation (LREC'12)},
|
36 |
-
year = {2012},
|
37 |
-
month = {may},
|
38 |
-
date = {23-25},
|
39 |
-
address = {Istanbul, Turkey},
|
40 |
-
editor = {Nicoletta Calzolari (Conference Chair) and Khalid Choukri and Thierry Declerck and Mehmet Ugur Dogan and Bente Maegaard and Joseph Mariani and Jan Odijk and Stelios Piperidis},
|
41 |
-
publisher = {European Language Resources Association (ELRA)},
|
42 |
-
isbn = {978-2-9517408-7-7},
|
43 |
-
language = {english}
|
44 |
-
}
|
45 |
-
"""
|
46 |
-
|
47 |
-
_VERSION = "1.0.0"
|
48 |
-
_BASE_NAME = "GNOME.{}.{}"
|
49 |
-
_BASE_URL = "https://object.pouta.csc.fi/OPUS-GNOME/v1/moses/{}-{}.txt.zip"
|
50 |
-
# Please note that only few pairs are shown here. You can use config to generate data for all language pairs
|
51 |
-
_LANGUAGE_PAIRS = [
|
52 |
-
("ar", "bal"),
|
53 |
-
("bg", "csb"),
|
54 |
-
("ca", "en_GB"),
|
55 |
-
("cs", "eo"),
|
56 |
-
("de", "ha"),
|
57 |
-
("cs", "tk"),
|
58 |
-
("da", "vi"),
|
59 |
-
("en_GB", "my"),
|
60 |
-
("el", "sk"),
|
61 |
-
("de", "tt"),
|
62 |
-
]
|
63 |
-
|
64 |
-
|
65 |
-
class GnomeConfig(datasets.BuilderConfig):
|
66 |
-
def __init__(self, *args, lang1=None, lang2=None, **kwargs):
|
67 |
-
super().__init__(
|
68 |
-
*args,
|
69 |
-
name=f"{lang1}-{lang2}",
|
70 |
-
**kwargs,
|
71 |
-
)
|
72 |
-
self.lang1 = lang1
|
73 |
-
self.lang2 = lang2
|
74 |
-
|
75 |
-
|
76 |
-
class OpusGnome(datasets.GeneratorBasedBuilder):
|
77 |
-
BUILDER_CONFIGS = [
|
78 |
-
GnomeConfig(
|
79 |
-
lang1=lang1,
|
80 |
-
lang2=lang2,
|
81 |
-
description=f"Translating {lang1} to {lang2} or vice versa",
|
82 |
-
version=datasets.Version(_VERSION),
|
83 |
-
)
|
84 |
-
for lang1, lang2 in _LANGUAGE_PAIRS
|
85 |
-
]
|
86 |
-
BUILDER_CONFIG_CLASS = GnomeConfig
|
87 |
-
|
88 |
-
def _info(self):
|
89 |
-
return datasets.DatasetInfo(
|
90 |
-
description=_DESCRIPTION,
|
91 |
-
features=datasets.Features(
|
92 |
-
{
|
93 |
-
"id": datasets.Value("string"),
|
94 |
-
"translation": datasets.Translation(languages=(self.config.lang1, self.config.lang2)),
|
95 |
-
},
|
96 |
-
),
|
97 |
-
supervised_keys=None,
|
98 |
-
homepage=_HOMEPAGE_URL,
|
99 |
-
citation=_CITATION,
|
100 |
-
)
|
101 |
-
|
102 |
-
def _split_generators(self, dl_manager):
|
103 |
-
def _base_url(lang1, lang2):
|
104 |
-
return _BASE_URL.format(lang1, lang2)
|
105 |
-
|
106 |
-
download_url = _base_url(self.config.lang1, self.config.lang2)
|
107 |
-
path = dl_manager.download_and_extract(download_url)
|
108 |
-
return [
|
109 |
-
datasets.SplitGenerator(
|
110 |
-
name=datasets.Split.TRAIN,
|
111 |
-
gen_kwargs={"datapath": path},
|
112 |
-
)
|
113 |
-
]
|
114 |
-
|
115 |
-
def _generate_examples(self, datapath):
|
116 |
-
l1, l2 = self.config.lang1, self.config.lang2
|
117 |
-
folder = l1 + "-" + l2
|
118 |
-
l1_file = _BASE_NAME.format(folder, l1)
|
119 |
-
l2_file = _BASE_NAME.format(folder, l2)
|
120 |
-
l1_path = os.path.join(datapath, l1_file)
|
121 |
-
l2_path = os.path.join(datapath, l2_file)
|
122 |
-
with open(l1_path, encoding="utf-8") as f1, open(l2_path, encoding="utf-8") as f2:
|
123 |
-
for sentence_counter, (x, y) in enumerate(zip(f1, f2)):
|
124 |
-
x = x.strip()
|
125 |
-
y = y.strip()
|
126 |
-
result = (
|
127 |
-
sentence_counter,
|
128 |
-
{
|
129 |
-
"id": str(sentence_counter),
|
130 |
-
"translation": {l1: x, l2: y},
|
131 |
-
},
|
132 |
-
)
|
133 |
-
yield result
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|