Datasets:

Multilinguality:
translation
Size Categories:
1M<n<10M
Source Datasets:
original
ArXiv:
Tags:
License:
system HF staff commited on
Commit
5af0d18
0 Parent(s):

Update files from the datasets library (from 1.2.0)

Browse files

Release notes: https://github.com/huggingface/datasets/releases/tag/1.2.0

.gitattributes ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bin.* filter=lfs diff=lfs merge=lfs -text
5
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.model filter=lfs diff=lfs merge=lfs -text
12
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
13
+ *.onnx filter=lfs diff=lfs merge=lfs -text
14
+ *.ot filter=lfs diff=lfs merge=lfs -text
15
+ *.parquet filter=lfs diff=lfs merge=lfs -text
16
+ *.pb filter=lfs diff=lfs merge=lfs -text
17
+ *.pt filter=lfs diff=lfs merge=lfs -text
18
+ *.pth filter=lfs diff=lfs merge=lfs -text
19
+ *.rar filter=lfs diff=lfs merge=lfs -text
20
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
21
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
22
+ *.tflite filter=lfs diff=lfs merge=lfs -text
23
+ *.tgz filter=lfs diff=lfs merge=lfs -text
24
+ *.xz filter=lfs diff=lfs merge=lfs -text
25
+ *.zip filter=lfs diff=lfs merge=lfs -text
26
+ *.zstandard filter=lfs diff=lfs merge=lfs -text
27
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,238 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ annotations_creators:
3
+ - crowdsourced
4
+ - expert-generated
5
+ - found
6
+ - machine-generated
7
+ language_creators:
8
+ - expert-generated
9
+ - found
10
+ - machine-generated
11
+ languages:
12
+ - en
13
+ - th
14
+ licenses:
15
+ - cc-by-sa-4-0
16
+ multilinguality:
17
+ - translation
18
+ size_categories:
19
+ - n>1M
20
+ source_datasets:
21
+ - original
22
+ task_categories:
23
+ - conditional-text-generation
24
+ task_ids:
25
+ - machine-translation
26
+ ---
27
+
28
+ # Dataset Card for `scb_mt_enth_2020`
29
+
30
+ ## Table of Contents
31
+ - [Dataset Description](#dataset-description)
32
+ - [Dataset Summary](#dataset-summary)
33
+ - [Supported Tasks](#supported-tasks-and-leaderboards)
34
+ - [Languages](#languages)
35
+ - [Dataset Structure](#dataset-structure)
36
+ - [Data Instances](#data-instances)
37
+ - [Data Fields](#data-instances)
38
+ - [Data Splits](#data-instances)
39
+ - [Dataset Creation](#dataset-creation)
40
+ - [Curation Rationale](#curation-rationale)
41
+ - [Source Data](#source-data)
42
+ - [Annotations](#annotations)
43
+ - [Personal and Sensitive Information](#personal-and-sensitive-information)
44
+ - [Considerations for Using the Data](#considerations-for-using-the-data)
45
+ - [Social Impact of Dataset](#social-impact-of-dataset)
46
+ - [Discussion of Biases](#discussion-of-biases)
47
+ - [Other Known Limitations](#other-known-limitations)
48
+ - [Additional Information](#additional-information)
49
+ - [Dataset Curators](#dataset-curators)
50
+ - [Licensing Information](#licensing-information)
51
+ - [Citation Information](#citation-information)
52
+
53
+ ## Dataset Description
54
+
55
+ - **Homepage:** https://airesearch.in.th/
56
+ - **Repository:** https://github.com/vistec-AI/thai2nmt
57
+ - **Paper:** https://arxiv.org/abs/2007.03541
58
+ - **Leaderboard:**
59
+ - **Point of Contact:** https://airesearch.in.th/
60
+
61
+ ### Dataset Summary
62
+
63
+ scb-mt-en-th-2020: A Large English-Thai Parallel Corpus
64
+ The primary objective of our work is to build a large-scale English-Thai dataset for machine translation.
65
+ We construct an English-Thai machine translation dataset with over 1 million segment pairs, curated from various sources,
66
+ namely news, Wikipedia articles, SMS messages, task-based dialogs, web-crawled data and government documents.
67
+ Methodology for gathering data, building parallel texts and removing noisy sentence pairs are presented in a reproducible manner.
68
+ We train machine translation models based on this dataset. Our models' performance are comparable to that of
69
+ Google Translation API (as of May 2020) for Thai-English and outperform Google when the Open Parallel Corpus (OPUS) is
70
+ included in the training data for both Thai-English and English-Thai translation.
71
+ The dataset, pre-trained models, and source code to reproduce our work are available for public use.
72
+
73
+ ### Supported Tasks and Leaderboards
74
+
75
+ machine translation
76
+
77
+ ### Languages
78
+
79
+ English, Thai
80
+
81
+ ## Dataset Structure
82
+
83
+ ### Data Instances
84
+
85
+ ```
86
+ {'subdataset': 'aqdf', 'translation': {'en': 'FAR LEFT: Indonesian National Police Chief Tito Karnavian, from left, Philippine National Police Chief Ronald Dela Rosa and Royal Malaysian Police Inspector General Khalid Abu Bakar link arms before the Trilateral Security Meeting in Pasay city, southeast of Manila, Philippines, in June 2017. [THE ASSOCIATED PRESS]', 'th': '(ซ้ายสุด) นายติโต คาร์นาเวียน ผู้บัญชาการตํารวจแห่งชาติอินโดนีเซีย (จากซ้าย) นายโรนัลด์ เดลา โรซา ผู้บัญชาการตํารวจแห่งชาติฟิลิปปินส์ และนายคาลิด อาบู บาการ์ ผู้บัญชาการตํารวจแห่งชาติมาเลเซีย ไขว้แขนกันก่อนเริ่มการประชุมความมั่นคงไตรภาคีในเมืองปาเซย์ ซึ่งอยู่ทางตะวันออกเฉียงใต้ของกรุงมะนิลา ประเทศฟิลิปปินส์ ในเดือนมิถุนายน พ.ศ. 2560 ดิแอสโซซิเอทเต็ด เพรส'}}
87
+ {'subdataset': 'thai_websites', 'translation': {'en': "*Applicants from certain countries may be required to pay a visa issuance fee after their application is approved. The Department of State's website has more information about visa issuance fees and can help you determine if an issuance fee applies to your nationality.", 'th': 'ประเภทวีซ่า รวมถึงค่าธรรมเนียม และข้อกําหนดในการสัมภาษณ์วีซ่า จะขึ้นอยู่กับชนิดของหนังสือเดินทาง และจุดประสงค์ในการเดินทางของท่าน โปรดดูตารางด้านล่างก่อนการสมัครวีซ่า'}}
88
+ {'subdataset': 'nus_sms', 'translation': {'en': 'Yup... Okay. Cya tmr... So long nvr write already... Dunno whether tmr can come up with 500 words', 'th': 'ใช่...ได้ แล้วเจอกันพรุ่งนี้... นานแล้วไม่เคยเขียน... ไม่รู้ว่าพรุ่งนี้จะทําได้ถึง500คําไหมเลย'}}
89
+ ```
90
+
91
+ ### Data Fields
92
+
93
+ - `subdataset`: subdataset from which the sentence pair comes from
94
+ - `translation`:
95
+ - `en`: English sentences (original source)
96
+ - `th`: Thai sentences (originally target for translation)
97
+
98
+ ### Data Splits
99
+
100
+ ```
101
+ Split ratio (train, valid, test) : (0.8, 0.1, 0.1)
102
+ Number of paris (train, valid, test): 801,402 | 100,173 | 100,177
103
+
104
+ # Train
105
+ generated_reviews_yn: 218,637 ( 27.28% )
106
+ task_master_1: 185,671 ( 23.17% )
107
+ generated_reviews_translator: 105,561 ( 13.17% )
108
+ thai_websites: 93,518 ( 11.67% )
109
+ paracrawl: 46,802 ( 5.84% )
110
+ nus_sms: 34,495 ( 4.30% )
111
+ mozilla_common_voice: 2,451 ( 4.05% )
112
+ wikipedia: 26,163 ( 3.26% cd)
113
+ generated_reviews_crowd: 19,769 ( 2.47% )
114
+ assorted_government: 19,712 ( 2.46% )
115
+ aqdf: 10,466 ( 1.31% )
116
+ msr_paraphrase: 8,157 ( 1.02% )
117
+
118
+ # Valid
119
+ generated_reviews_yn: 30,786 ( 30.73% )
120
+ task_master_1: 18,531 ( 18.50% )
121
+ generated_reviews_translator: 13,884 ( 13.86% )
122
+ thai_websites: 13,381 ( 13.36% )
123
+ paracrawl: 6,618 ( 6.61% )
124
+ nus_sms: 4,628 ( 4.62% )
125
+ wikipedia: 3,796 ( 3.79% )
126
+ assorted_government: 2,842 ( 2.83% )
127
+ generated_reviews_crowd: 2,409 ( 2.40% )
128
+ aqdf: 1,518 ( 1.52% )
129
+ msr_paraphrase: 1,107 ( 1.11% )
130
+ mozilla_common_voice: 673 ( 0.67% )
131
+
132
+ # Test
133
+ generated_reviews_yn: 30,785 ( 30.73% )
134
+ task_master_1: 18,531 ( 18.50% )
135
+ generated_reviews_translator: 13,885 ( 13.86% )
136
+ thai_websites: 13,381 ( 13.36% )
137
+ paracrawl: 6,619 ( 6.61% )
138
+ nus_sms: 4,627 ( 4.62% )
139
+ wikipedia: 3,797 ( 3.79% )
140
+ assorted_government: 2,844 ( 2.83% )
141
+ generated_reviews_crowd: 2,409 ( 2.40% )
142
+ aqdf: 1,519 ( 1.52% )
143
+ msr_paraphrase: 1,107 ( 1.11% )
144
+ mozilla_common_voice : 673 ( 0.67% )
145
+ ```
146
+
147
+ ## Dataset Creation
148
+
149
+ ### Curation Rationale
150
+
151
+ [AIResearch](https://airesearch.in.th/), funded by [VISTEC](https://www.vistec.ac.th/) and [depa](https://www.depa.or.th/th/home), curated this dataset as part of public NLP infrastructure. The center releases the dataset and baseline models under CC-BY-SA 4.0.
152
+
153
+ ### Source Data
154
+
155
+ #### Initial Data Collection and Normalization
156
+
157
+ The sentence pairs are curated from news, Wikipedia articles, SMS messages, task-based dialogs, webcrawled data and government documents. Sentence pairs are generated by:
158
+ - Professional translators
159
+ - Crowdsourced translators
160
+ - Google Translate API and human annotators (accepted or rejected)
161
+ - Sentence alignment with [multilingual universal sentence encoder](https://tfhub.dev/google/universal-sentence-encoder-multilingual/3); the author created [CRFCut](https://github.com/vistec-AI/crfcut) to segment Thai sentences to be abel to align with their English counterparts (sentence segmented by [NLTK](https://www.nltk.org/))
162
+
163
+ For detailed explanation of dataset curation, see https://arxiv.org/pdf/2007.03541.pdf
164
+
165
+ ### Annotations
166
+
167
+ #### Sources and Annotation process
168
+
169
+ - generated_reviews_yn: generated by [CTRL](https://arxiv.org/abs/1909.05858), translated to Thai by Google Translate API and annotated as accepted or rejected by human annotators (we do not include rejected sentence pairs)
170
+ - task_master_1: [Taskmaster-1](https://research.google/tools/datasets/taskmaster-1/) translated by professional translators hired by [AIResearch](https://airesearch.in.th/)
171
+ - generated_reviews_translator: professional translators hired by [AIResearch](https://airesearch.in.th/)
172
+ - thai_websites: webcrawling from top 500 websites in Thailand; respective content creators; the authors only did sentence alignment
173
+ - paracrawl: replicating Paracrawl's methodology for webcrawling; respective content creators; the authors only did sentence alignment
174
+ - nus_sms: [The National University of Singapore SMS Corpus](https://scholarbank.nus.edu.sg/handle/10635/137343) translated by crowdsourced translators hired by [AIResearch](https://airesearch.in.th/)
175
+ - wikipedia: Thai Wikipedia; respective content creators; the authors only did sentence alignment
176
+ - assorted_government: Government document in PDFs from various government websites; respective content creators; the authors only did sentence alignment
177
+ - generated_reviews_crowd: generated by [CTRL](https://arxiv.org/abs/1909.05858), translated to Thai by crowdsourced translators hired by [AIResearch](https://airesearch.in.th/)
178
+ - aqdf: Bilingual news from [Asia Pacific Defense Forum](https://ipdefenseforum.com/); respective content creators; the authors only did sentence alignment
179
+ - msr_paraphrase: [Microsoft Research Paraphrase Corpus](https://www.microsoft.com/en-us/download/details.aspx?id=52398) translated to Thai by crowdsourced translators hired by [AIResearch](https://airesearch.in.th/)
180
+ - mozilla_common_voice: English version of [Mozilla Common Voice](https://commonvoice.mozilla.org/) translated to Thai by crowdsourced translators hired by [AIResearch](https://airesearch.in.th/)
181
+
182
+ ### Personal and Sensitive Information
183
+
184
+ There are risks of personal information to be included in the webcrawled data namely `paracrawl` and `thai_websites`.
185
+
186
+ ## Considerations for Using the Data
187
+
188
+ ### Social Impact of Dataset
189
+
190
+ - The first and currently largest English-Thai machine translation dataset that is strictly cleaned and deduplicated, compare to other sources such as Paracrawl.
191
+
192
+ ### Discussion of Biases
193
+
194
+ - Gender-based ending honorifics in Thai (ครับ/ค่ะ) might not be balanced due to more female translators than male for `task_master_1`
195
+
196
+ ### Other Known Limitations
197
+
198
+ #### Segment Alignment between Languages With and Without Boundaries
199
+ Unlike English, there is no segment boundary marking in Thai. One segment in Thai may or may not cover all
200
+ the content of an English segment. Currently, we mitigate this problem by grouping Thai segments together before
201
+ computing the text similarity scores. We then choose the combination with the highest text similarity score. It can be
202
+ said that adequacy is the main issue in building this dataset.
203
+ Quality of Translation from Crawled Websites
204
+ Some websites use machine translation models such as Google Translate to localize their content. As a result, Thai
205
+ segments retrieved from web crawling might face issues of fluency since we do not use human annotators to perform
206
+ quality control.
207
+
208
+ #### Quality Control of Crowdsourced Translators
209
+ When we use a crowdsourcing platform to translate the content, we can not fully control the quality of the translation.
210
+ To combat this, we filter out low-quality segments by using a text similarity threshold, based on cosine similarity of
211
+ universal sentence encoder vectors. Moreover, some crowdsourced translators might copy and paste source segments to
212
+ a translation engine and take the results as answers to the platform. To further improve, we can apply techniques such
213
+ as described in [Zaidan, 2012] to control the quality and avoid fraud on the platform.
214
+
215
+ #### Domain Dependence of Machine Tranlsation Models
216
+ We test domain dependence of machine translation models by comparing models trained and tested on the same dataset,
217
+ using 80/10/10 train-validation-test split, and models trained on one dataset and tested on the other.
218
+
219
+ ## Additional Information
220
+
221
+ ### Dataset Curators
222
+
223
+ [AIResearch](https://airesearch.in.th/), funded by [VISTEC](https://www.vistec.ac.th/) and [depa](https://www.depa.or.th/th/home)
224
+
225
+ ### Licensing Information
226
+
227
+ CC-BY-SA 4.0
228
+
229
+ ### Citation Information
230
+
231
+ ```
232
+ @article{lowphansirikul2020scb,
233
+ title={scb-mt-en-th-2020: A Large English-Thai Parallel Corpus},
234
+ author={Lowphansirikul, Lalita and Polpanumas, Charin and Rutherford, Attapol T and Nutanong, Sarana},
235
+ journal={arXiv preprint arXiv:2007.03541},
236
+ year={2020}
237
+ }
238
+ ```
dataset_infos.json ADDED
@@ -0,0 +1 @@
 
1
+ {"enth": {"description": "scb-mt-en-th-2020: A Large English-Thai Parallel Corpus\nThe primary objective of our work is to build a large-scale English-Thai dataset for machine translation.\nWe construct an English-Thai machine translation dataset with over 1 million segment pairs, curated from various sources,\nnamely news, Wikipedia articles, SMS messages, task-based dialogs, web-crawled data and government documents.\nMethodology for gathering data, building parallel texts and removing noisy sentence pairs are presented in a reproducible manner.\nWe train machine translation models based on this dataset. Our models' performance are comparable to that of\nGoogle Translation API (as of May 2020) for Thai-English and outperform Google when the Open Parallel Corpus (OPUS) is\nincluded in the training data for both Thai-English and English-Thai translation.\nThe dataset, pre-trained models, and source code to reproduce our work are available for public use.\n", "citation": "@article{lowphansirikul2020scb,\n title={scb-mt-en-th-2020: A Large English-Thai Parallel Corpus},\n author={Lowphansirikul, Lalita and Polpanumas, Charin and Rutherford, Attapol T and Nutanong, Sarana},\n journal={arXiv preprint arXiv:2007.03541},\n year={2020}\n}\n", "homepage": "https://airesearch.in.th/", "license": "", "features": {"translation": {"languages": ["en", "th"], "id": null, "_type": "Translation"}, "subdataset": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "builder_name": "scb_mt_enth2020", "config_name": "enth", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 390411946, "num_examples": 801402, "dataset_name": "scb_mt_enth2020"}, "validation": {"name": "validation", "num_bytes": 54167280, "num_examples": 100173, "dataset_name": "scb_mt_enth2020"}, "test": {"name": "test", "num_bytes": 53782790, "num_examples": 100177, "dataset_name": "scb_mt_enth2020"}}, "download_checksums": {"https://archive.org/download/scb_mt_enth_2020/data.zip": {"num_bytes": 138415559, "checksum": "58441cf2ee5fd4c4995930afb1a460ec80210d77e6109b4365eab5f117497afc"}}, "download_size": 138415559, "post_processing_size": null, "dataset_size": 498362016, "size_in_bytes": 636777575}, "then": {"description": "scb-mt-en-th-2020: A Large English-Thai Parallel Corpus\nThe primary objective of our work is to build a large-scale English-Thai dataset for machine translation.\nWe construct an English-Thai machine translation dataset with over 1 million segment pairs, curated from various sources,\nnamely news, Wikipedia articles, SMS messages, task-based dialogs, web-crawled data and government documents.\nMethodology for gathering data, building parallel texts and removing noisy sentence pairs are presented in a reproducible manner.\nWe train machine translation models based on this dataset. Our models' performance are comparable to that of\nGoogle Translation API (as of May 2020) for Thai-English and outperform Google when the Open Parallel Corpus (OPUS) is\nincluded in the training data for both Thai-English and English-Thai translation.\nThe dataset, pre-trained models, and source code to reproduce our work are available for public use.\n", "citation": "@article{lowphansirikul2020scb,\n title={scb-mt-en-th-2020: A Large English-Thai Parallel Corpus},\n author={Lowphansirikul, Lalita and Polpanumas, Charin and Rutherford, Attapol T and Nutanong, Sarana},\n journal={arXiv preprint arXiv:2007.03541},\n year={2020}\n}\n", "homepage": "https://airesearch.in.th/", "license": "", "features": {"translation": {"languages": ["th", "en"], "id": null, "_type": "Translation"}, "subdataset": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "builder_name": "scb_mt_enth2020", "config_name": "then", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 390411946, "num_examples": 801402, "dataset_name": "scb_mt_enth2020"}, "validation": {"name": "validation", "num_bytes": 54167280, "num_examples": 100173, "dataset_name": "scb_mt_enth2020"}, "test": {"name": "test", "num_bytes": 53782790, "num_examples": 100177, "dataset_name": "scb_mt_enth2020"}}, "download_checksums": {"https://archive.org/download/scb_mt_enth_2020/data.zip": {"num_bytes": 138415559, "checksum": "58441cf2ee5fd4c4995930afb1a460ec80210d77e6109b4365eab5f117497afc"}}, "download_size": 138415559, "post_processing_size": null, "dataset_size": 498362016, "size_in_bytes": 636777575}}
dummy/enth/1.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:65413c565454fd34bda4d382bfdf3ce7902c0d1d661b4ca13f8513b968dfa475
3
+ size 4596
dummy/then/1.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:92d39efb3372480313cd53a43077c3d9f2231331a6d3361a860dbc3dde32e8fd
3
+ size 4596
scb_mt_enth_2020.py ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import absolute_import, division, print_function
2
+
3
+ import json
4
+ import os
5
+
6
+ import datasets
7
+
8
+
9
+ _CITATION = """\
10
+ @article{lowphansirikul2020scb,
11
+ title={scb-mt-en-th-2020: A Large English-Thai Parallel Corpus},
12
+ author={Lowphansirikul, Lalita and Polpanumas, Charin and Rutherford, Attapol T and Nutanong, Sarana},
13
+ journal={arXiv preprint arXiv:2007.03541},
14
+ year={2020}
15
+ }
16
+ """
17
+
18
+ _DESCRIPTION = """\
19
+ scb-mt-en-th-2020: A Large English-Thai Parallel Corpus
20
+ The primary objective of our work is to build a large-scale English-Thai dataset for machine translation.
21
+ We construct an English-Thai machine translation dataset with over 1 million segment pairs, curated from various sources,
22
+ namely news, Wikipedia articles, SMS messages, task-based dialogs, web-crawled data and government documents.
23
+ Methodology for gathering data, building parallel texts and removing noisy sentence pairs are presented in a reproducible manner.
24
+ We train machine translation models based on this dataset. Our models' performance are comparable to that of
25
+ Google Translation API (as of May 2020) for Thai-English and outperform Google when the Open Parallel Corpus (OPUS) is
26
+ included in the training data for both Thai-English and English-Thai translation.
27
+ The dataset, pre-trained models, and source code to reproduce our work are available for public use.
28
+ """
29
+
30
+
31
+ class ScbMtEnth2020Config(datasets.BuilderConfig):
32
+ """BuilderConfig for ScbMtEnth2020."""
33
+
34
+ def __init__(self, language_pair=(None, None), **kwargs):
35
+ """BuilderConfig for ScbMtEnth2020.
36
+
37
+ Args:
38
+ **kwargs: keyword arguments forwarded to super.
39
+ """
40
+ super(ScbMtEnth2020Config, self).__init__(
41
+ name=f"{language_pair[0]}{language_pair[1]}",
42
+ description="Translate {language_pair[0]} to {language_pair[1]}",
43
+ version=datasets.Version("1.0.0"),
44
+ **kwargs,
45
+ )
46
+ self.language_pair = language_pair
47
+
48
+
49
+ class ScbMtEnth2020(datasets.GeneratorBasedBuilder):
50
+ """scb-mt-en-th-2020: A Large English-Thai Parallel Corpus"""
51
+
52
+ _DOWNLOAD_URL = "https://archive.org/download/scb_mt_enth_2020/data.zip"
53
+ _TRAIN_FILE = "train.jsonl"
54
+ _VAL_FILE = "valid.jsonl"
55
+ _TEST_FILE = "test.jsonl"
56
+ BUILDER_CONFIG_CLASS = ScbMtEnth2020Config
57
+ BUILDER_CONFIGS = [
58
+ ScbMtEnth2020Config(
59
+ language_pair=("en", "th"),
60
+ ),
61
+ ScbMtEnth2020Config(
62
+ language_pair=("th", "en"),
63
+ ),
64
+ ]
65
+
66
+ def _info(self):
67
+ return datasets.DatasetInfo(
68
+ description=_DESCRIPTION,
69
+ features=datasets.Features(
70
+ {
71
+ "translation": datasets.features.Translation(languages=self.config.language_pair),
72
+ "subdataset": datasets.Value("string"),
73
+ }
74
+ ),
75
+ supervised_keys=None,
76
+ homepage="https://airesearch.in.th/",
77
+ citation=_CITATION,
78
+ )
79
+
80
+ def _split_generators(self, dl_manager):
81
+ arch_path = dl_manager.download_and_extract(self._DOWNLOAD_URL)
82
+ data_dir = os.path.join(arch_path, "data")
83
+ return [
84
+ datasets.SplitGenerator(
85
+ name=datasets.Split.TRAIN, gen_kwargs={"filepath": os.path.join(data_dir, self._TRAIN_FILE)}
86
+ ),
87
+ datasets.SplitGenerator(
88
+ name=datasets.Split.VALIDATION, gen_kwargs={"filepath": os.path.join(data_dir, self._VAL_FILE)}
89
+ ),
90
+ datasets.SplitGenerator(
91
+ name=datasets.Split.TEST, gen_kwargs={"filepath": os.path.join(data_dir, self._TEST_FILE)}
92
+ ),
93
+ ]
94
+
95
+ def _generate_examples(self, filepath):
96
+ """Generate examples."""
97
+ source, target = self.config.language_pair
98
+ with open(filepath, encoding="utf-8") as f:
99
+ for id_, row in enumerate(f):
100
+ data = json.loads(row)
101
+ yield id_, {
102
+ "translation": {source: data[source], target: data[target]},
103
+ "subdataset": data["subdataset"],
104
+ }