Datasets:
ArXiv:
License:
update
Browse files- README.md +1 -1
- data/europa_ecdc_tm.jsonl +3 -0
- dataset_details.md +144 -0
- docs/picture/europa_ecdc_tm_text_length.jpg +3 -0
- examples/make_subset_details.py +1 -1
- examples/preprocess/preprocess_europa_ecdc_tm.py +138 -0
- language_identification.py +14 -2
README.md
CHANGED
@@ -43,7 +43,7 @@ Tips:
|
|
43 |
| chr_en | [2010.04791](https://arxiv.org/abs/2010.04791) | 样本个数 | ChrEn 是切罗基语-英语并行数据集,用于促进切罗基语和英语之间的机器翻译研究。 ChrEn 资源极少,总共包含 14k 个句子对,其分割方式有利于域内和域外评估。 ChrEn 还包含 5k 切罗基语单语数据以实现半监督学习。 | [chr_en](https://huggingface.co/datasets/chr_en) |
|
44 |
| cmu_hinglish_dog | [CMU_DoG](https://github.com/festvox/datasets-CMU_DoG); [1809.07358](https://arxiv.org/abs/1809.07358) | TRAIN: 13146, VALID: 1645, TEST: 1616 | 这是印度英语(印地语-英语之间的代码混合)文本对话及其相应的英语版本的集合。 可用于两者之间的翻译。 该数据集由 CMU 的 Alan Black 教授团队提供。 | [cmu_hinglish_dog](https://huggingface.co/datasets/cmu_hinglish_dog) |
|
45 |
| europa_eac_tm | [EAC-Translation Memory](https://joint-research-centre.ec.europa.eu/language-technology-resources/eac-translation-memory_en) | TRAIN: 16543 | 该数据集是从英语到多达 25 种语言的手动翻译的语料库,由欧盟教育和文化总局 (EAC) 于 2012 年发布。 | [europa_eac_tm](https://huggingface.co/datasets/europa_eac_tm) |
|
46 |
-
| europa_ecdc_tm | [ECDC-Translation Memory](https://joint-research-centre.ec.europa.eu/language-technology-resources/ecdc-translation-memory_en) |
|
47 |
| flores | [1902.01382](https://arxiv.org/abs/1902.01382) | 样本个数 | 低资源机器翻译的评估数据集:尼泊尔语-英语和僧伽罗语-英语。 | [flores](https://huggingface.co/datasets/flores) |
|
48 |
| giga_fren | | 样本个数 | | [giga_fren](https://huggingface.co/datasets/giga_fren) |
|
49 |
| hind_encorp | [HindEnCorp](https://aclanthology.org/L14-1643/) | 样本个数 | HindEnCorp 并行文本(句子对齐)来自以下来源:Tides,其中包含主要取自新闻文章的 50K 句对。 该数据集最初是为 2002 年 DARPA-TIDES 惊喜语言竞赛收集的,后来在 IIIT 海得拉巴进行了完善,并提供给 ICON 2008 的 NLP 工具竞赛(Venkatapathy,2008)。 | [hind_encorp](https://huggingface.co/datasets/hind_encorp) |
|
|
|
43 |
| chr_en | [2010.04791](https://arxiv.org/abs/2010.04791) | 样本个数 | ChrEn 是切罗基语-英语并行数据集,用于促进切罗基语和英语之间的机器翻译研究。 ChrEn 资源极少,总共包含 14k 个句子对,其分割方式有利于域内和域外评估。 ChrEn 还包含 5k 切罗基语单语数据以实现半监督学习。 | [chr_en](https://huggingface.co/datasets/chr_en) |
|
44 |
| cmu_hinglish_dog | [CMU_DoG](https://github.com/festvox/datasets-CMU_DoG); [1809.07358](https://arxiv.org/abs/1809.07358) | TRAIN: 13146, VALID: 1645, TEST: 1616 | 这是印度英语(印地语-英语之间的代码混合)文本对话及其相应的英语版本的集合。 可用于两者之间的翻译。 该数据集由 CMU 的 Alan Black 教授团队提供。 | [cmu_hinglish_dog](https://huggingface.co/datasets/cmu_hinglish_dog) |
|
45 |
| europa_eac_tm | [EAC-Translation Memory](https://joint-research-centre.ec.europa.eu/language-technology-resources/eac-translation-memory_en) | TRAIN: 16543 | 该数据集是从英语到多达 25 种语言的手动翻译的语料库,由欧盟教育和文化总局 (EAC) 于 2012 年发布。 | [europa_eac_tm](https://huggingface.co/datasets/europa_eac_tm) |
|
46 |
+
| europa_ecdc_tm | [ECDC-Translation Memory](https://joint-research-centre.ec.europa.eu/language-technology-resources/ecdc-translation-memory_en) | TRAIN: 58968 | 2012 年 10 月,欧盟 (EU) 机构“欧洲疾病预防和控制中心”(ECDC) 发布了翻译记忆库 (TM),即 25 种语言的句子及其专业翻译的集合。 | [europa_ecdc_tm](https://huggingface.co/datasets/europa_ecdc_tm) |
|
47 |
| flores | [1902.01382](https://arxiv.org/abs/1902.01382) | 样本个数 | 低资源机器翻译的评估数据集:尼泊尔语-英语和僧伽罗语-英语。 | [flores](https://huggingface.co/datasets/flores) |
|
48 |
| giga_fren | | 样本个数 | | [giga_fren](https://huggingface.co/datasets/giga_fren) |
|
49 |
| hind_encorp | [HindEnCorp](https://aclanthology.org/L14-1643/) | 样本个数 | HindEnCorp 并行文本(句子对齐)来自以下来源:Tides,其中包含主要取自新闻文章的 50K 句对。 该数据集最初是为 2002 年 DARPA-TIDES 惊喜语言竞赛收集的,后来在 IIIT 海得拉巴进行了完善,并提供给 ICON 2008 的 NLP 工具竞赛(Venkatapathy,2008)。 | [hind_encorp](https://huggingface.co/datasets/hind_encorp) |
|
data/europa_ecdc_tm.jsonl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:14fdf7a23efb4bd3aed16e4fee331792e5c5ee7a41420a527d9d928d4935ae5a
|
3 |
+
size 12523484
|
dataset_details.md
CHANGED
@@ -351,6 +351,150 @@ es: 3863
|
|
351 |
![europa_eac_tm_text_length.jpg](docs/picture/europa_eac_tm_text_length.jpg)
|
352 |
|
353 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
354 |
#### iwslt2017
|
355 |
以下都是 train 训练集的信息
|
356 |
|
|
|
351 |
![europa_eac_tm_text_length.jpg](docs/picture/europa_eac_tm_text_length.jpg)
|
352 |
|
353 |
|
354 |
+
#### europa_ecdc_tm
|
355 |
+
以下都是 train 训练集的信息
|
356 |
+
|
357 |
+
```text
|
358 |
+
语种数量:
|
359 |
+
en: 3071
|
360 |
+
fi: 2451
|
361 |
+
bg: 2449
|
362 |
+
cs: 2430
|
363 |
+
hu: 2411
|
364 |
+
et: 2403
|
365 |
+
mt: 2403
|
366 |
+
ro: 2398
|
367 |
+
es: 2393
|
368 |
+
lt: 2391
|
369 |
+
pl: 2383
|
370 |
+
fr: 2382
|
371 |
+
lv: 2382
|
372 |
+
el: 2378
|
373 |
+
da: 2365
|
374 |
+
de: 2359
|
375 |
+
sl: 2358
|
376 |
+
it: 2355
|
377 |
+
is: 2347
|
378 |
+
sk: 2332
|
379 |
+
nl: 2323
|
380 |
+
sv: 2312
|
381 |
+
pt: 2301
|
382 |
+
no: 2260
|
383 |
+
ga: 1331
|
384 |
+
```
|
385 |
+
|
386 |
+
样本示例:
|
387 |
+
|
388 |
+
|
389 |
+
| 数据 | 语种 | 样本 |
|
390 |
+
| :---: | :---: | :---: |
|
391 |
+
| europa_ecdc_tm | bg | Засега няма ваксина срещу хепатит С. |
|
392 |
+
| europa_ecdc_tm | bg | Инфекция с човешки имунодефицитен вирус (ХИВ) |
|
393 |
+
| europa_ecdc_tm | bg | Човешкият имунодефицитен вирус (ХИВ) остава едно от най-значимите заразни заболявания в Европа. |
|
394 |
+
| europa_ecdc_tm | cs | Očkování proti hepatitidě C zatím není k dispozici. |
|
395 |
+
| europa_ecdc_tm | cs | Infekce HIV |
|
396 |
+
| europa_ecdc_tm | cs | Virus lidské imunodeficience (human immunodeficiency virus, HIV) zůstává jedním z nejzávažnějších přenosných onemocnění v Evropě. |
|
397 |
+
| europa_ecdc_tm | da | Der findes endnu ingen vaccination mod hepatitis C. |
|
398 |
+
| europa_ecdc_tm | da | HIV-infektion |
|
399 |
+
| europa_ecdc_tm | da | Hiv (humant immundefektvirus), er fortsat blandt de vigtigste overførbare sygdomme i Europa. |
|
400 |
+
| europa_ecdc_tm | de | Es gibt derzeit noch keinen Impfstoff gegen Hepatitis C. |
|
401 |
+
| europa_ecdc_tm | de | HIV-Infektion |
|
402 |
+
| europa_ecdc_tm | de | Das humane Immundefizienz-Virus HIV gehört weiterhin zu den bedeutendsten Infektionserregern in Europa. |
|
403 |
+
| europa_ecdc_tm | el | Επί του παρόντος δεν διατίθεται εμβόλιο έναντι της ηπατίτιδας C. |
|
404 |
+
| europa_ecdc_tm | el | Λοίμωξη από τον ιό της ανοσολογικής ανεπάρκειας του ανθρώπου (HIV) |
|
405 |
+
| europa_ecdc_tm | el | Ο ιός της ανοσολογικής ανεπάρκειας του ανθρώπου παραμένει μία από τις πιο σημαντικές μεταδοτικές νόσους στην Ευρώπη. |
|
406 |
+
| europa_ecdc_tm | es | Todavía no hay ninguna vacuna contra la hepatitis C. |
|
407 |
+
| europa_ecdc_tm | es | VIH, infección por el |
|
408 |
+
| europa_ecdc_tm | es | La infección por el virus de la inmunodeficiencia humana (VIH) sigue siendo una de las enfermedades transmisibles más importantes en Europa. |
|
409 |
+
| europa_ecdc_tm | en | Vaccination against hepatitis C is not yet available. |
|
410 |
+
| europa_ecdc_tm | en | HIV infection |
|
411 |
+
| europa_ecdc_tm | en | The human immunodeficiency virus (HIV) remains one of the most important communicable diseases in Europe. |
|
412 |
+
| europa_ecdc_tm | et | C-hepatiidi vastast vaktsiini veel ei ole. |
|
413 |
+
| europa_ecdc_tm | et | HIV-nakkus |
|
414 |
+
| europa_ecdc_tm | et | Inimese immuunpuudulikkuse viiruse (HIV) nakkus on endiselt Euroopas üks tähtsaimaid nakkushaigusi. |
|
415 |
+
| europa_ecdc_tm | fi | Hepatiitti C:hen ei ole vielä rokotetta. |
|
416 |
+
| europa_ecdc_tm | fi | HIV-infektio |
|
417 |
+
| europa_ecdc_tm | fi | Ihmisen immuunikatovirus (HIV) kuuluu Euroopan merkittävimpiin tartuntatauteihin. |
|
418 |
+
| europa_ecdc_tm | fr | Aucune vaccination contre l’hépatite C n’est encore disponible. |
|
419 |
+
| europa_ecdc_tm | fr | Infection à VIH |
|
420 |
+
| europa_ecdc_tm | fr | L’infection par le virus de l’immunodéficience humaine (VIH) reste l’une des principales maladies contagieuses en Europe. |
|
421 |
+
| europa_ecdc_tm | ga | Níl vacsaíniú ar fáil fós i gcoinne heipitítis C. |
|
422 |
+
| europa_ecdc_tm | ga | Ionfhabhtú VEID |
|
423 |
+
| europa_ecdc_tm | ga | Tá an víreas easpa imdhíonachta daonna (VEID) fós ar cheann de na galair thógálacha is tábhachtaí san Eoraip. |
|
424 |
+
| europa_ecdc_tm | hu | A hepatitisz C ellen nincs még védőoltás. |
|
425 |
+
| europa_ecdc_tm | hu | HIV fertőzés |
|
426 |
+
| europa_ecdc_tm | hu | A humán immunhiányos betegséget okozó vírusfertőzés (human immunodeficiency virus, HIV) továbbra is az egyik legmeghatározóbb fertőző betegség Európában. |
|
427 |
+
| europa_ecdc_tm | is | Bólusetning gegn lifrarbólgu C er enn ekki til. |
|
428 |
+
| europa_ecdc_tm | is | HIV smitun |
|
429 |
+
| europa_ecdc_tm | is | Alnæmisveira í mönnum (HIV) er enn sem fyrr einn alvarlegasti smitsjúkdómurinn í Evrópu. |
|
430 |
+
| europa_ecdc_tm | it | Non c'è ancora un vaccino per l'epatite C. |
|
431 |
+
| europa_ecdc_tm | it | Infezione da HIV |
|
432 |
+
| europa_ecdc_tm | it | Il virus dell'immunodeficienza umana (HIV) resta una delle più importanti malattie trasmissibili in Europa. |
|
433 |
+
| europa_ecdc_tm | lt | Vakcinos nuo hepatito C dar nėra. |
|
434 |
+
| europa_ecdc_tm | lt | ŽIV infekcija |
|
435 |
+
| europa_ecdc_tm | lt | Žmogaus imunodeficito virusas (ŽIV) ir toliau lieka viena iš pagrindinių užkrečiamųjų ligų Europoje. |
|
436 |
+
| europa_ecdc_tm | lv | Pagaidām pret hepatītu C nav iespējams vakcinēties. |
|
437 |
+
| europa_ecdc_tm | lv | HIV infekcija |
|
438 |
+
| europa_ecdc_tm | lv | Cilvēka imūndeficīta vīruss (HIV) joprojām ir viens no vissvarīgākajiem infekcijas slimību izraisītājiem Eiropā. |
|
439 |
+
| europa_ecdc_tm | mt | It-tilqim kontra l-epatite Ċ għadu mhux disponibbli. |
|
440 |
+
| europa_ecdc_tm | mt | Infezzjoni HIV |
|
441 |
+
| europa_ecdc_tm | mt | Il-virus tal-immunodefiċenza tal-bniedem (HIV) jibqa’ wieħed mill-mard li jinxtered l-aktar importanti fl-Ewropa. |
|
442 |
+
| europa_ecdc_tm | nl | Er is nog geen vaccin tegen hepatitis C beschikbaar. |
|
443 |
+
| europa_ecdc_tm | nl | Hiv-infectie |
|
444 |
+
| europa_ecdc_tm | nl | Het humaan immunodeficiëntievirus (hiv) is nog altijd een van de belangrijkste overdraagbare ziekten in Europa. |
|
445 |
+
| europa_ecdc_tm | no | Det finnes foreløpig ingen vaksine mot hepatitt C, og sykdomsbyrden er høy. |
|
446 |
+
| europa_ecdc_tm | no | HIV-infeksjon |
|
447 |
+
| europa_ecdc_tm | no | Humant immunsviktvirus (HIV) er fortsatt en av de viktigste smittsomme sykdommene i Europa. |
|
448 |
+
| europa_ecdc_tm | pl | Niestety nadal nie jest dostępna szczepionka przeciwko wirusowemu zapaleniu wątroby typu C. |
|
449 |
+
| europa_ecdc_tm | pl | Zakażenie wirusem HIV |
|
450 |
+
| europa_ecdc_tm | pl | Ludzki wirus upośledzenia odporności (HIV) powoduje jedną z najważniejszych chorób zakaźnych w Europie. |
|
451 |
+
| europa_ecdc_tm | pt | De momento, não existe qualquer vacina disponível contra o vírus da hepatite C. |
|
452 |
+
| europa_ecdc_tm | pt | Infecção por VIH |
|
453 |
+
| europa_ecdc_tm | pt | O vírus da imunodeficiência humana (VIH) continua a ser uma das doenças transmissíveis mais importantes na Europa. |
|
454 |
+
| europa_ecdc_tm | ro | Nu există încă niciun vaccin disponibil împotriva hepatitei C. |
|
455 |
+
| europa_ecdc_tm | ro | Infecţia cu HIV |
|
456 |
+
| europa_ecdc_tm | ro | Infecţia cu virusul imunodeficienţei umane (HIV) rămâne una dintre cele mai importante boli transmisibile din Europa. |
|
457 |
+
| europa_ecdc_tm | sk | Proti hepatitíde C nie je zatiaľ dostupné očkovanie. |
|
458 |
+
| europa_ecdc_tm | sk | Infekcia HIV |
|
459 |
+
| europa_ecdc_tm | sk | Vírus ľudskej imunitnej nedostatočnosti (HIV) naďalej predstavuje jedno z najvýznamnejších nákazlivých ochorení v Európe. |
|
460 |
+
| europa_ecdc_tm | sl | Cepiva proti hepatitisu C še ni. |
|
461 |
+
| europa_ecdc_tm | sl | Okužba s HIV |
|
462 |
+
| europa_ecdc_tm | sl | Virus humane imunske pomanjkljivosti (HIV) ostaja ena najpomembnejših nalezljivih bolezni v Evropi. |
|
463 |
+
| europa_ecdc_tm | sv | Det finns ännu inget vaccin mot hepatit C. |
|
464 |
+
| europa_ecdc_tm | sv | Humant immunbristvirus (HIV) är fortfarande en av de dominerande smittsamma sjukdomarna i Europa. |
|
465 |
+
| europa_ecdc_tm | sv | HIV-infektion är kopplad till allvarlig sjukdom, långvariga och höga kostnader för behandling och vård, ett betydande antal dödsfall samt kortare förväntad livslängd. |
|
466 |
+
|
467 |
+
<details>
|
468 |
+
<summary>文本长度</summary>
|
469 |
+
<pre><code>0-10: 1375
|
470 |
+
10-20: 4146
|
471 |
+
20-30: 3820
|
472 |
+
30-40: 3390
|
473 |
+
40-50: 2955
|
474 |
+
50-60: 2864
|
475 |
+
60-70: 3009
|
476 |
+
70-80: 2837
|
477 |
+
80-90: 2779
|
478 |
+
90-100: 2839
|
479 |
+
100-110: 2817
|
480 |
+
110-120: 2589
|
481 |
+
120-130: 2545
|
482 |
+
130-140: 2390
|
483 |
+
140-150: 2174
|
484 |
+
150-160: 2058
|
485 |
+
160-170: 1710
|
486 |
+
170-180: 1574
|
487 |
+
180-190: 1399
|
488 |
+
190-200: 1290
|
489 |
+
200-210: 8408
|
490 |
+
</code></pre>
|
491 |
+
</details>
|
492 |
+
|
493 |
+
文本长度统计图像:
|
494 |
+
|
495 |
+
![europa_ecdc_tm_text_length.jpg](docs/picture/europa_ecdc_tm_text_length.jpg)
|
496 |
+
|
497 |
+
|
498 |
#### iwslt2017
|
499 |
以下都是 train 训练集的信息
|
500 |
|
docs/picture/europa_ecdc_tm_text_length.jpg
ADDED
Git LFS Details
|
examples/make_subset_details.py
CHANGED
@@ -12,7 +12,7 @@ from project_settings import project_path
|
|
12 |
|
13 |
def get_args():
|
14 |
parser = argparse.ArgumentParser()
|
15 |
-
parser.add_argument("--dataset_name", default="
|
16 |
parser.add_argument(
|
17 |
"--dataset_cache_dir",
|
18 |
default=(project_path / "hub_datasets").as_posix(),
|
|
|
12 |
|
13 |
def get_args():
|
14 |
parser = argparse.ArgumentParser()
|
15 |
+
parser.add_argument("--dataset_name", default="europa_ecdc_tm", type=str)
|
16 |
parser.add_argument(
|
17 |
"--dataset_cache_dir",
|
18 |
default=(project_path / "hub_datasets").as_posix(),
|
examples/preprocess/preprocess_europa_ecdc_tm.py
ADDED
@@ -0,0 +1,138 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import argparse
|
4 |
+
from collections import defaultdict
|
5 |
+
import json
|
6 |
+
import os
|
7 |
+
from pathlib import Path
|
8 |
+
import re
|
9 |
+
import sys
|
10 |
+
import tempfile
|
11 |
+
from typing import List
|
12 |
+
import zipfile
|
13 |
+
|
14 |
+
pwd = os.path.abspath(os.path.dirname(__file__))
|
15 |
+
sys.path.append(os.path.join(pwd, "../../"))
|
16 |
+
|
17 |
+
from datasets import load_dataset, DownloadMode
|
18 |
+
import requests
|
19 |
+
from tqdm import tqdm
|
20 |
+
from xml.etree import ElementTree
|
21 |
+
|
22 |
+
from language_identification import LANGUAGE_MAP
|
23 |
+
from project_settings import project_path
|
24 |
+
|
25 |
+
|
26 |
+
def get_args():
|
27 |
+
parser = argparse.ArgumentParser()
|
28 |
+
parser.add_argument(
|
29 |
+
"--data_url",
|
30 |
+
default="http://optima.jrc.it/Resources/ECDC-TM/ECDC-TM.zip",
|
31 |
+
type=str
|
32 |
+
)
|
33 |
+
parser.add_argument(
|
34 |
+
"--output_file",
|
35 |
+
default=(project_path / "data/europa_ecdc_tm.jsonl"),
|
36 |
+
type=str
|
37 |
+
)
|
38 |
+
|
39 |
+
args = parser.parse_args()
|
40 |
+
return args
|
41 |
+
|
42 |
+
|
43 |
+
_AVAILABLE_LANGUAGES = (
|
44 |
+
"bg",
|
45 |
+
"cs",
|
46 |
+
"da",
|
47 |
+
"de",
|
48 |
+
"el",
|
49 |
+
"es",
|
50 |
+
"en",
|
51 |
+
"et",
|
52 |
+
"fi",
|
53 |
+
"fr",
|
54 |
+
"ga",
|
55 |
+
"hu",
|
56 |
+
"is",
|
57 |
+
"it",
|
58 |
+
"lt",
|
59 |
+
"lv",
|
60 |
+
"mt",
|
61 |
+
"nl",
|
62 |
+
"no",
|
63 |
+
"pl",
|
64 |
+
"pt",
|
65 |
+
"ro",
|
66 |
+
"sk",
|
67 |
+
"sl",
|
68 |
+
"sv",
|
69 |
+
)
|
70 |
+
|
71 |
+
|
72 |
+
def _find_sentence(translation, language):
|
73 |
+
namespaces = {"xml": "http://www.w3.org/XML/1998/namespace"}
|
74 |
+
seg_tag = translation.find(path=f".//tuv[@xml:lang='{language.upper()}']/seg", namespaces=namespaces)
|
75 |
+
if seg_tag is not None:
|
76 |
+
return seg_tag.text
|
77 |
+
return None
|
78 |
+
|
79 |
+
|
80 |
+
def main():
|
81 |
+
args = get_args()
|
82 |
+
data_url = Path(args.data_url)
|
83 |
+
|
84 |
+
# download
|
85 |
+
filename = os.path.join(tempfile.gettempdir(), data_url.name)
|
86 |
+
print(filename)
|
87 |
+
if not os.path.exists(filename):
|
88 |
+
resp = requests.get(args.data_url)
|
89 |
+
with open(filename, "wb") as f:
|
90 |
+
f.write(resp.content)
|
91 |
+
|
92 |
+
# unzip
|
93 |
+
unzip_dir = "data/{}".format(data_url.stem)
|
94 |
+
if not os.path.exists(unzip_dir):
|
95 |
+
zip_file = zipfile.ZipFile(filename)
|
96 |
+
zip_file.extractall(unzip_dir)
|
97 |
+
filepath = os.path.join(unzip_dir, "ECDC-TM", "ECDC.tmx")
|
98 |
+
|
99 |
+
xml_element_tree = ElementTree.parse(filepath)
|
100 |
+
xml_body_tag = xml_element_tree.getroot().find("body")
|
101 |
+
assert xml_body_tag is not None, f"Invalid data: <body></body> tag not found in {filepath}"
|
102 |
+
|
103 |
+
# Translations are stored in <tu>...</tu> tags
|
104 |
+
translation_units = xml_body_tag.iter("tu")
|
105 |
+
text_set = set()
|
106 |
+
counter = defaultdict(int)
|
107 |
+
split = "train"
|
108 |
+
with open(args.output_file, "w", encoding="utf-8") as f:
|
109 |
+
for _id, translation in enumerate(translation_units):
|
110 |
+
for language in _AVAILABLE_LANGUAGES:
|
111 |
+
text = _find_sentence(translation=translation, language=language)
|
112 |
+
if text is None:
|
113 |
+
continue
|
114 |
+
text = text.strip()
|
115 |
+
|
116 |
+
if text in text_set:
|
117 |
+
continue
|
118 |
+
text_set.add(text)
|
119 |
+
|
120 |
+
if language not in LANGUAGE_MAP.keys():
|
121 |
+
raise AssertionError("language: {}, text: {}".format(language, text))
|
122 |
+
|
123 |
+
row = {
|
124 |
+
"text": text,
|
125 |
+
"language": language,
|
126 |
+
"data_source": "europa_ecdc_tm",
|
127 |
+
"split": split
|
128 |
+
}
|
129 |
+
row = json.dumps(row, ensure_ascii=False)
|
130 |
+
f.write("{}\n".format(row))
|
131 |
+
counter[split] += 1
|
132 |
+
|
133 |
+
print("counter: {}".format(counter))
|
134 |
+
return
|
135 |
+
|
136 |
+
|
137 |
+
if __name__ == "__main__":
|
138 |
+
main()
|
language_identification.py
CHANGED
@@ -15,6 +15,7 @@ _URLS = {
|
|
15 |
"bucc2018": "data/bucc2018.jsonl",
|
16 |
"cmu_hinglish_dog": "data/cmu_hinglish_dog.jsonl",
|
17 |
"europa_eac_tm": "data/europa_eac_tm.jsonl",
|
|
|
18 |
"iwslt2017": "data/iwslt2017.jsonl",
|
19 |
"mike0307": "data/mike0307.jsonl",
|
20 |
"nbnn": "data/nbnn.jsonl",
|
@@ -42,30 +43,40 @@ _CITATION = """\
|
|
42 |
LANGUAGE_MAP = {
|
43 |
"ar": "arabic",
|
44 |
"bg": "bulgarian",
|
|
|
45 |
"da": "danish",
|
46 |
"de": "german",
|
47 |
"el": "modern greek",
|
48 |
"en": "english",
|
49 |
"eo": "esperanto",
|
50 |
"es": "spanish",
|
|
|
|
|
51 |
"fo": "faroese",
|
52 |
"fr": "french",
|
|
|
53 |
"gl": "galician",
|
54 |
"hi": "hindi",
|
55 |
-
"hi_en": "hindi
|
|
|
56 |
"is": "icelandic",
|
57 |
"it": "italian",
|
58 |
"ja": "japanese",
|
59 |
"ko": "korean",
|
|
|
|
|
|
|
|
|
60 |
"nl": "dutch",
|
61 |
"no": "norwegian",
|
62 |
"no-b": "norwegian (bokmål)",
|
63 |
"no-n": "norwegian (nynorsk)",
|
64 |
-
"mr": "marathi",
|
65 |
"pl": "polish",
|
66 |
"pt": "portuguese",
|
67 |
"ro": "romanian",
|
68 |
"ru": "russian",
|
|
|
|
|
69 |
"sw": "swahili",
|
70 |
"sv": "swedish",
|
71 |
"th": "thai",
|
@@ -91,6 +102,7 @@ class LanguageIdentification(datasets.GeneratorBasedBuilder):
|
|
91 |
datasets.BuilderConfig(name="bucc2018", version=VERSION, description="bucc2018"),
|
92 |
datasets.BuilderConfig(name="cmu_hinglish_dog", version=VERSION, description="cmu_hinglish_dog"),
|
93 |
datasets.BuilderConfig(name="europa_eac_tm", version=VERSION, description="europa_eac_tm"),
|
|
|
94 |
datasets.BuilderConfig(name="iwslt2017", version=VERSION, description="iwslt2017"),
|
95 |
datasets.BuilderConfig(name="mike0307", version=VERSION, description="mike0307"),
|
96 |
datasets.BuilderConfig(name="nbnn", version=VERSION, description="nbnn"),
|
|
|
15 |
"bucc2018": "data/bucc2018.jsonl",
|
16 |
"cmu_hinglish_dog": "data/cmu_hinglish_dog.jsonl",
|
17 |
"europa_eac_tm": "data/europa_eac_tm.jsonl",
|
18 |
+
"europa_ecdc_tm": "data/europa_ecdc_tm.jsonl",
|
19 |
"iwslt2017": "data/iwslt2017.jsonl",
|
20 |
"mike0307": "data/mike0307.jsonl",
|
21 |
"nbnn": "data/nbnn.jsonl",
|
|
|
43 |
LANGUAGE_MAP = {
|
44 |
"ar": "arabic",
|
45 |
"bg": "bulgarian",
|
46 |
+
"cs": "czech",
|
47 |
"da": "danish",
|
48 |
"de": "german",
|
49 |
"el": "modern greek",
|
50 |
"en": "english",
|
51 |
"eo": "esperanto",
|
52 |
"es": "spanish",
|
53 |
+
"et": "estonian",
|
54 |
+
"fi": "finnish",
|
55 |
"fo": "faroese",
|
56 |
"fr": "french",
|
57 |
+
"ga": "irish",
|
58 |
"gl": "galician",
|
59 |
"hi": "hindi",
|
60 |
+
"hi_en": "hindi english",
|
61 |
+
"hu": "hungarian",
|
62 |
"is": "icelandic",
|
63 |
"it": "italian",
|
64 |
"ja": "japanese",
|
65 |
"ko": "korean",
|
66 |
+
"lt": "lithuanian",
|
67 |
+
"lv": "latvian",
|
68 |
+
"mr": "marathi",
|
69 |
+
"mt": "maltese",
|
70 |
"nl": "dutch",
|
71 |
"no": "norwegian",
|
72 |
"no-b": "norwegian (bokmål)",
|
73 |
"no-n": "norwegian (nynorsk)",
|
|
|
74 |
"pl": "polish",
|
75 |
"pt": "portuguese",
|
76 |
"ro": "romanian",
|
77 |
"ru": "russian",
|
78 |
+
"sk": "slovak",
|
79 |
+
"sl": "slovenian",
|
80 |
"sw": "swahili",
|
81 |
"sv": "swedish",
|
82 |
"th": "thai",
|
|
|
102 |
datasets.BuilderConfig(name="bucc2018", version=VERSION, description="bucc2018"),
|
103 |
datasets.BuilderConfig(name="cmu_hinglish_dog", version=VERSION, description="cmu_hinglish_dog"),
|
104 |
datasets.BuilderConfig(name="europa_eac_tm", version=VERSION, description="europa_eac_tm"),
|
105 |
+
datasets.BuilderConfig(name="europa_ecdc_tm", version=VERSION, description="europa_ecdc_tm"),
|
106 |
datasets.BuilderConfig(name="iwslt2017", version=VERSION, description="iwslt2017"),
|
107 |
datasets.BuilderConfig(name="mike0307", version=VERSION, description="mike0307"),
|
108 |
datasets.BuilderConfig(name="nbnn", version=VERSION, description="nbnn"),
|