Datasets:
Multilinguality:
translation
Size Categories:
1M<n<10M
Language Creators:
found
Annotations Creators:
no-annotation
License:
Commit
•
7aac43a
1
Parent(s):
c9051c1
Add loading script
Browse files
mtet.py
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""MTet dataset."""
|
2 |
+
|
3 |
+
import json
|
4 |
+
|
5 |
+
import datasets
|
6 |
+
|
7 |
+
|
8 |
+
_CITATION = """\
|
9 |
+
@article{mTet2022,
|
10 |
+
author = {Chinh Ngo, Hieu Tran, Long Phan, Trieu H. Trinh, Hieu Nguyen, Minh Nguyen, Minh-Thang Luong},
|
11 |
+
title = {MTet: Multi-domain Translation for English and Vietnamese},
|
12 |
+
journal = {https://github.com/vietai/mTet},
|
13 |
+
year = {2022},
|
14 |
+
}
|
15 |
+
"""
|
16 |
+
|
17 |
+
_DESCRIPTION = """\
|
18 |
+
MTet (Multi-domain Translation for English-Vietnamese) dataset contains roughly 4.2 million English-Vietnamese pairs of
|
19 |
+
texts, ranging across multiple different domains such as medical publications, religious texts, engineering articles,
|
20 |
+
literature, news, and poems.
|
21 |
+
|
22 |
+
This dataset extends our previous SAT (Style Augmented Translation) dataset (v1.0) by adding more high-quality
|
23 |
+
English-Vietnamese sentence pairs on various domains.
|
24 |
+
"""
|
25 |
+
|
26 |
+
_HOMEPAGE = "https://github.com/vietai/mTet"
|
27 |
+
|
28 |
+
_LICENSE = "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)"
|
29 |
+
|
30 |
+
_URLS = {
|
31 |
+
"en": "https://storage.googleapis.com/vietai_public/best_vi_translation/v2/train.en",
|
32 |
+
"vi": "https://storage.googleapis.com/vietai_public/best_vi_translation/v2/train.vi",
|
33 |
+
}
|
34 |
+
|
35 |
+
|
36 |
+
class Mtet(datasets.GeneratorBasedBuilder):
|
37 |
+
"""MTet dataset."""
|
38 |
+
|
39 |
+
VERSION = datasets.Version("1.0.0")
|
40 |
+
|
41 |
+
def _info(self):
|
42 |
+
return datasets.DatasetInfo(
|
43 |
+
description=_DESCRIPTION,
|
44 |
+
features=datasets.Features({"translation": datasets.features.Translation(languages=["en", "vi"])}),
|
45 |
+
homepage=_HOMEPAGE,
|
46 |
+
license=_LICENSE,
|
47 |
+
citation=_CITATION,
|
48 |
+
)
|
49 |
+
|
50 |
+
def _split_generators(self, dl_manager):
|
51 |
+
data_paths = dl_manager.download(_URLS)
|
52 |
+
return [
|
53 |
+
datasets.SplitGenerator(
|
54 |
+
name=datasets.Split.TRAIN,
|
55 |
+
gen_kwargs={
|
56 |
+
"data_paths": data_paths,
|
57 |
+
},
|
58 |
+
),
|
59 |
+
]
|
60 |
+
|
61 |
+
def _generate_examples(self, data_paths):
|
62 |
+
with open(data_paths["en"], encoding="utf-8") as f_en, open(data_paths["vi"], encoding="utf-8") as f_vi:
|
63 |
+
for key, (sentence_en, sentence_vi) in enumerate(zip(f_en, f_vi)):
|
64 |
+
yield key, {"translation": {"en": sentence_en.strip(), "vi": sentence_vi.strip()}}
|