system HF staff commited on
Commit
f70275a
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,208 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ annotations_creators:
3
+ - found
4
+ language_creators:
5
+ - found
6
+ languages:
7
+ - af
8
+ - ar
9
+ - bg
10
+ - bn
11
+ - br
12
+ - bs
13
+ - ca
14
+ - cs
15
+ - da
16
+ - de
17
+ - el
18
+ - en
19
+ - eo
20
+ - es
21
+ - et
22
+ - eu
23
+ - fa
24
+ - fi
25
+ - fr
26
+ - gl
27
+ - he
28
+ - hi
29
+ - hr
30
+ - hu
31
+ - hy
32
+ - id
33
+ - is
34
+ - it
35
+ - ja
36
+ - ka
37
+ - kk
38
+ - ko
39
+ - lt
40
+ - lv
41
+ - mk
42
+ - ml
43
+ - ms
44
+ - nl
45
+ - no
46
+ - pl
47
+ - pt
48
+ - pt_br
49
+ - ro
50
+ - ru
51
+ - si
52
+ - sk
53
+ - sl
54
+ - sq
55
+ - sr
56
+ - sv
57
+ - ta
58
+ - te
59
+ - th
60
+ - tl
61
+ - tr
62
+ - uk
63
+ - ur
64
+ - vi
65
+ - ze_en
66
+ - ze_zh
67
+ - zh_cn
68
+ - zh_tw
69
+ licenses:
70
+ - unknown
71
+ multilinguality:
72
+ - multilingual
73
+ size_categories:
74
+ - n>1M
75
+ source_datasets:
76
+ - original
77
+ task_categories:
78
+ - conditional-text-generation
79
+ task_ids:
80
+ - machine-translation
81
+ ---
82
+
83
+ # Dataset Card Creation Guide
84
+
85
+ ## Table of Contents
86
+ - [Dataset Description](#dataset-description)
87
+ - [Dataset Summary](#dataset-summary)
88
+ - [Supported Tasks](#supported-tasks-and-leaderboards)
89
+ - [Languages](#languages)
90
+ - [Dataset Structure](#dataset-structure)
91
+ - [Data Instances](#data-instances)
92
+ - [Data Fields](#data-instances)
93
+ - [Data Splits](#data-instances)
94
+ - [Dataset Creation](#dataset-creation)
95
+ - [Curation Rationale](#curation-rationale)
96
+ - [Source Data](#source-data)
97
+ - [Annotations](#annotations)
98
+ - [Personal and Sensitive Information](#personal-and-sensitive-information)
99
+ - [Considerations for Using the Data](#considerations-for-using-the-data)
100
+ - [Social Impact of Dataset](#social-impact-of-dataset)
101
+ - [Discussion of Biases](#discussion-of-biases)
102
+ - [Other Known Limitations](#other-known-limitations)
103
+ - [Additional Information](#additional-information)
104
+ - [Dataset Curators](#dataset-curators)
105
+ - [Licensing Information](#licensing-information)
106
+ - [Citation Information](#citation-information)
107
+
108
+ ## Dataset Description
109
+
110
+ - **Homepage:** http://opus.nlpl.eu/OpenSubtitles.php
111
+ - **Repository:** None
112
+ - **Paper:** http://www.lrec-conf.org/proceedings/lrec2016/pdf/62_Paper.pdf
113
+ - **Leaderboard:** [More Information Needed]
114
+ - **Point of Contact:** [More Information Needed]
115
+
116
+ ### Dataset Summary
117
+
118
+ To load a language pair which isn't part of the config, all you need to do is specify the language code as pairs.
119
+ You can find the valid pairs in Homepage section of Dataset Description: http://opus.nlpl.eu/OpenSubtitles.php
120
+ E.g.
121
+
122
+ `dataset = load_dataset("open_subtitles", lang1="fi", lang2="hi")`
123
+
124
+
125
+ ### Supported Tasks and Leaderboards
126
+
127
+ [More Information Needed]
128
+
129
+ ### Languages
130
+
131
+ [More Information Needed]
132
+
133
+ ## Dataset Structure
134
+
135
+ ### Data Instances
136
+
137
+ Here are some examples of questions and facts:
138
+
139
+
140
+ ### Data Fields
141
+
142
+ [More Information Needed]
143
+
144
+ ### Data Splits
145
+
146
+ [More Information Needed]
147
+
148
+ ## Dataset Creation
149
+
150
+ ### Curation Rationale
151
+
152
+ [More Information Needed]
153
+
154
+ ### Source Data
155
+
156
+ [More Information Needed]
157
+
158
+ #### Initial Data Collection and Normalization
159
+
160
+ [More Information Needed]
161
+
162
+ #### Who are the source language producers?
163
+
164
+ [More Information Needed]
165
+
166
+ ### Annotations
167
+
168
+ [More Information Needed]
169
+
170
+ #### Annotation process
171
+
172
+ [More Information Needed]
173
+
174
+ #### Who are the annotators?
175
+
176
+ [More Information Needed]
177
+
178
+ ### Personal and Sensitive Information
179
+
180
+ [More Information Needed]
181
+
182
+ ## Considerations for Using the Data
183
+
184
+ ### Social Impact of Dataset
185
+
186
+ [More Information Needed]
187
+
188
+ ### Discussion of Biases
189
+
190
+ [More Information Needed]
191
+
192
+ ### Other Known Limitations
193
+
194
+ [More Information Needed]
195
+
196
+ ## Additional Information
197
+
198
+ ### Dataset Curators
199
+
200
+ [More Information Needed]
201
+
202
+ ### Licensing Information
203
+
204
+ [More Information Needed]
205
+
206
+ ### Citation Information
207
+
208
+ [More Information Needed]
dataset_infos.json ADDED
@@ -0,0 +1 @@
 
1
+ {"de-en": {"description": "This is a new collection of translated movie subtitles from http://www.opensubtitles.org/.\n\nIMPORTANT: If you use the OpenSubtitle corpus: Please, add a link to http://www.opensubtitles.org/ to your website and to your reports and publications produced with the data!\n\nThis is a slightly cleaner version of the subtitle collection using improved sentence alignment and better language checking.\n\n62 languages, 1,782 bitexts\ntotal number of files: 3,735,070\ntotal number of tokens: 22.10G\ntotal number of sentence fragments: 3.35G\n", "citation": "P. Lison and J. Tiedemann, 2016, OpenSubtitles2016: Extracting Large Parallel Corpora from Movie and TV Subtitles. In Proceedings of the 10th International Conference on Language Resources and Evaluation (LREC 2016)\n", "homepage": "http://opus.nlpl.eu/OpenSubtitles.php", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "translation": {"languages": ["de", "en"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": null, "builder_name": "open_subtitles", "config_name": "de-en", "version": {"version_str": "2018.0.0", "description": "", "major": 2018, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 1960641457, "num_examples": 22512639, "dataset_name": "open_subtitles"}}, "download_checksums": {"https://object.pouta.csc.fi/OPUS-OpenSubtitles/v2018/moses/de-en.txt.zip": {"num_bytes": 710557991, "checksum": "b1bdd09f3667a85ba9fd0688c8a943c710317e11e5f0f722b7f0f3f0bc38300c"}}, "download_size": 710557991, "post_processing_size": null, "dataset_size": 1960641457, "size_in_bytes": 2671199448}, "en-fr": {"description": "This is a new collection of translated movie subtitles from http://www.opensubtitles.org/.\n\nIMPORTANT: If you use the OpenSubtitle corpus: Please, add a link to http://www.opensubtitles.org/ to your website and to your reports and publications produced with the data!\n\nThis is a slightly cleaner version of the subtitle collection using improved sentence alignment and better language checking.\n\n62 languages, 1,782 bitexts\ntotal number of files: 3,735,070\ntotal number of tokens: 22.10G\ntotal number of sentence fragments: 3.35G\n", "citation": "P. Lison and J. Tiedemann, 2016, OpenSubtitles2016: Extracting Large Parallel Corpora from Movie and TV Subtitles. In Proceedings of the 10th International Conference on Language Resources and Evaluation (LREC 2016)\n", "homepage": "http://opus.nlpl.eu/OpenSubtitles.php", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "translation": {"languages": ["en", "fr"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": null, "builder_name": "open_subtitles", "config_name": "en-fr", "version": {"version_str": "2018.0.0", "description": "", "major": 2018, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 3644573238, "num_examples": 41763488, "dataset_name": "open_subtitles"}}, "download_checksums": {"https://object.pouta.csc.fi/OPUS-OpenSubtitles/v2018/moses/en-fr.txt.zip": {"num_bytes": 1296192799, "checksum": "96e547fe3f710c444639bbf594569634931c46ffdbeb7b3e0766cb2c72171240"}}, "download_size": 1296192799, "post_processing_size": null, "dataset_size": 3644573238, "size_in_bytes": 4940766037}, "en-es": {"description": "This is a new collection of translated movie subtitles from http://www.opensubtitles.org/.\n\nIMPORTANT: If you use the OpenSubtitle corpus: Please, add a link to http://www.opensubtitles.org/ to your website and to your reports and publications produced with the data!\n\nThis is a slightly cleaner version of the subtitle collection using improved sentence alignment and better language checking.\n\n62 languages, 1,782 bitexts\ntotal number of files: 3,735,070\ntotal number of tokens: 22.10G\ntotal number of sentence fragments: 3.35G\n", "citation": "P. Lison and J. Tiedemann, 2016, OpenSubtitles2016: Extracting Large Parallel Corpora from Movie and TV Subtitles. In Proceedings of the 10th International Conference on Language Resources and Evaluation (LREC 2016)\n", "homepage": "http://opus.nlpl.eu/OpenSubtitles.php", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "translation": {"languages": ["en", "es"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": null, "builder_name": "open_subtitles", "config_name": "en-es", "version": {"version_str": "2018.0.0", "description": "", "major": 2018, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 5281909678, "num_examples": 61434251, "dataset_name": "open_subtitles"}}, "download_checksums": {"https://object.pouta.csc.fi/OPUS-OpenSubtitles/v2018/moses/en-es.txt.zip": {"num_bytes": 1888798249, "checksum": "e35e174b135b0fe2d48a0c9275dc456babd9732529e8de3d80141d241704e983"}}, "download_size": 1888798249, "post_processing_size": null, "dataset_size": 5281909678, "size_in_bytes": 7170707927}, "bs-eo": {"description": "This is a new collection of translated movie subtitles from http://www.opensubtitles.org/.\n\nIMPORTANT: If you use the OpenSubtitle corpus: Please, add a link to http://www.opensubtitles.org/ to your website and to your reports and publications produced with the data!\n\nThis is a slightly cleaner version of the subtitle collection using improved sentence alignment and better language checking.\n\n62 languages, 1,782 bitexts\ntotal number of files: 3,735,070\ntotal number of tokens: 22.10G\ntotal number of sentence fragments: 3.35G\n", "citation": "P. Lison and J. Tiedemann, 2016, OpenSubtitles2016: Extracting Large Parallel Corpora from Movie and TV Subtitles. In Proceedings of the 10th International Conference on Language Resources and Evaluation (LREC 2016)\n", "homepage": "http://opus.nlpl.eu/OpenSubtitles.php", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "translation": {"languages": ["bs", "eo"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": null, "builder_name": "open_subtitles", "config_name": "bs-eo", "version": {"version_str": "2018.0.0", "description": "", "major": 2018, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 840882, "num_examples": 10989, "dataset_name": "open_subtitles"}}, "download_checksums": {"https://object.pouta.csc.fi/OPUS-OpenSubtitles/v2018/moses/bs-eo.txt.zip": {"num_bytes": 333050, "checksum": "47bad0c4bc1d63d10d601708ffaf637ee3eef1e289521cd009812e84ef338fbc"}}, "download_size": 333050, "post_processing_size": null, "dataset_size": 840882, "size_in_bytes": 1173932}, "fr-hy": {"description": "This is a new collection of translated movie subtitles from http://www.opensubtitles.org/.\n\nIMPORTANT: If you use the OpenSubtitle corpus: Please, add a link to http://www.opensubtitles.org/ to your website and to your reports and publications produced with the data!\n\nThis is a slightly cleaner version of the subtitle collection using improved sentence alignment and better language checking.\n\n62 languages, 1,782 bitexts\ntotal number of files: 3,735,070\ntotal number of tokens: 22.10G\ntotal number of sentence fragments: 3.35G\n", "citation": "P. Lison and J. Tiedemann, 2016, OpenSubtitles2016: Extracting Large Parallel Corpora from Movie and TV Subtitles. In Proceedings of the 10th International Conference on Language Resources and Evaluation (LREC 2016)\n", "homepage": "http://opus.nlpl.eu/OpenSubtitles.php", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "translation": {"languages": ["fr", "hy"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": null, "builder_name": "open_subtitles", "config_name": "fr-hy", "version": {"version_str": "2018.0.0", "description": "", "major": 2018, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 109834, "num_examples": 668, "dataset_name": "open_subtitles"}}, "download_checksums": {"https://object.pouta.csc.fi/OPUS-OpenSubtitles/v2018/moses/fr-hy.txt.zip": {"num_bytes": 41861, "checksum": "2f1b42fc7b7856b466b73b02860f68e90ee4a12f3327e9114e87d26a9b5e77cd"}}, "download_size": 41861, "post_processing_size": null, "dataset_size": 109834, "size_in_bytes": 151695}, "da-ru": {"description": "This is a new collection of translated movie subtitles from http://www.opensubtitles.org/.\n\nIMPORTANT: If you use the OpenSubtitle corpus: Please, add a link to http://www.opensubtitles.org/ to your website and to your reports and publications produced with the data!\n\nThis is a slightly cleaner version of the subtitle collection using improved sentence alignment and better language checking.\n\n62 languages, 1,782 bitexts\ntotal number of files: 3,735,070\ntotal number of tokens: 22.10G\ntotal number of sentence fragments: 3.35G\n", "citation": "P. Lison and J. Tiedemann, 2016, OpenSubtitles2016: Extracting Large Parallel Corpora from Movie and TV Subtitles. In Proceedings of the 10th International Conference on Language Resources and Evaluation (LREC 2016)\n", "homepage": "http://opus.nlpl.eu/OpenSubtitles.php", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "translation": {"languages": ["da", "ru"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": null, "builder_name": "open_subtitles", "config_name": "da-ru", "version": {"version_str": "2018.0.0", "description": "", "major": 2018, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 833254549, "num_examples": 7543012, "dataset_name": "open_subtitles"}}, "download_checksums": {"https://object.pouta.csc.fi/OPUS-OpenSubtitles/v2018/moses/da-ru.txt.zip": {"num_bytes": 267995167, "checksum": "c9fae94d519a6bd6374f1dea8550ba535cabfb3a4e8b92eeb5921e8981bde98a"}}, "download_size": 267995167, "post_processing_size": null, "dataset_size": 833254549, "size_in_bytes": 1101249716}, "en-hi": {"description": "This is a new collection of translated movie subtitles from http://www.opensubtitles.org/.\n\nIMPORTANT: If you use the OpenSubtitle corpus: Please, add a link to http://www.opensubtitles.org/ to your website and to your reports and publications produced with the data!\n\nThis is a slightly cleaner version of the subtitle collection using improved sentence alignment and better language checking.\n\n62 languages, 1,782 bitexts\ntotal number of files: 3,735,070\ntotal number of tokens: 22.10G\ntotal number of sentence fragments: 3.35G\n", "citation": "P. Lison and J. Tiedemann, 2016, OpenSubtitles2016: Extracting Large Parallel Corpora from Movie and TV Subtitles. In Proceedings of the 10th International Conference on Language Resources and Evaluation (LREC 2016)\n", "homepage": "http://opus.nlpl.eu/OpenSubtitles.php", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "translation": {"languages": ["en", "hi"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": null, "builder_name": "open_subtitles", "config_name": "en-hi", "version": {"version_str": "2018.0.0", "description": "", "major": 2018, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 10820088, "num_examples": 93016, "dataset_name": "open_subtitles"}}, "download_checksums": {"https://object.pouta.csc.fi/OPUS-OpenSubtitles/v2018/moses/en-hi.txt.zip": {"num_bytes": 2967295, "checksum": "3e099b7738ec2fdcf47e6d7a4363b6435bf63a34f703168b086e742a8bc9f4ed"}}, "download_size": 2967295, "post_processing_size": null, "dataset_size": 10820088, "size_in_bytes": 13787383}, "bn-is": {"description": "This is a new collection of translated movie subtitles from http://www.opensubtitles.org/.\n\nIMPORTANT: If you use the OpenSubtitle corpus: Please, add a link to http://www.opensubtitles.org/ to your website and to your reports and publications produced with the data!\n\nThis is a slightly cleaner version of the subtitle collection using improved sentence alignment and better language checking.\n\n62 languages, 1,782 bitexts\ntotal number of files: 3,735,070\ntotal number of tokens: 22.10G\ntotal number of sentence fragments: 3.35G\n", "citation": "P. Lison and J. Tiedemann, 2016, OpenSubtitles2016: Extracting Large Parallel Corpora from Movie and TV Subtitles. In Proceedings of the 10th International Conference on Language Resources and Evaluation (LREC 2016)\n", "homepage": "http://opus.nlpl.eu/OpenSubtitles.php", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "translation": {"languages": ["bn", "is"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": null, "builder_name": "open_subtitles", "config_name": "bn-is", "version": {"version_str": "2018.0.0", "description": "", "major": 2018, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 5096887, "num_examples": 38272, "dataset_name": "open_subtitles"}}, "download_checksums": {"https://object.pouta.csc.fi/OPUS-OpenSubtitles/v2018/moses/bn-is.txt.zip": {"num_bytes": 1411625, "checksum": "06ff1ed8e20cee1123046accb7e99f40ecf0263c2677b371a04ee80951c5a23f"}}, "download_size": 1411625, "post_processing_size": null, "dataset_size": 5096887, "size_in_bytes": 6508512}}
dummy/bn-is/2018.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:afaf9c8958ad5362f2bf60350289a24bd5dd8f5dc20cfc296e22ccc35e6786e5
3
+ size 1148
dummy/bs-eo/2018.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:77a9fcdeaf65db3472bf2320cea4d164a1257e4f52155db256b7960e33e87340
3
+ size 1093
dummy/da-ru/2018.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ccc50e761e1cc98b39fe956db1dd8520a6a4de3a82512c28be4ee968dd2b7bd1
3
+ size 1279
dummy/en-hi/2018.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1e9986f2953886832bfe3b9d824b56771e5ca3f164637677801be94b898a87fb
3
+ size 1000
dummy/fr-hy/2018.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1599fc125fbcec23eeb2d111fd6c4992b56fac335207c1b7252bb3fdf770e097
3
+ size 1256
open_subtitles.py ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ This is a new collection of translated movie subtitles from http://www.opensubtitles.org/.
24
+
25
+ IMPORTANT: If you use the OpenSubtitle corpus: Please, add a link to http://www.opensubtitles.org/ to your website and to your reports and publications produced with the data!
26
+
27
+ This is a slightly cleaner version of the subtitle collection using improved sentence alignment and better language checking.
28
+
29
+ 62 languages, 1,782 bitexts
30
+ total number of files: 3,735,070
31
+ total number of tokens: 22.10G
32
+ total number of sentence fragments: 3.35G
33
+ """
34
+ _HOMEPAGE_URL = "http://opus.nlpl.eu/OpenSubtitles.php"
35
+ _CITATION = """\
36
+ P. Lison and J. Tiedemann, 2016, OpenSubtitles2016: Extracting Large Parallel Corpora from Movie and TV Subtitles. In Proceedings of the 10th International Conference on Language Resources and Evaluation (LREC 2016)
37
+ """
38
+
39
+ _VERSION = "2018.0.0"
40
+ _BASE_NAME = "OpenSubtitles.{}.{}"
41
+ _BASE_URL = "https://object.pouta.csc.fi/OPUS-OpenSubtitles/v2018/moses/{}-{}.txt.zip"
42
+
43
+ # Please note that only few pairs are shown here. You can use config to generate data for all language pairs
44
+ _LANGUAGE_PAIRS = [
45
+ ("bs", "eo"),
46
+ ("fr", "hy"),
47
+ ("da", "ru"),
48
+ ("en", "hi"),
49
+ ("bn", "is"),
50
+ ]
51
+
52
+
53
+ class OpenSubtitlesConfig(datasets.BuilderConfig):
54
+ def __init__(self, *args, lang1=None, lang2=None, **kwargs):
55
+ super().__init__(
56
+ *args,
57
+ name=f"{lang1}-{lang2}",
58
+ **kwargs,
59
+ )
60
+ self.lang1 = lang1
61
+ self.lang2 = lang2
62
+
63
+
64
+ class OpenSubtitles(datasets.GeneratorBasedBuilder):
65
+ BUILDER_CONFIGS = [
66
+ OpenSubtitlesConfig(
67
+ lang1=lang1,
68
+ lang2=lang2,
69
+ description=f"Translating {lang1} to {lang2} or vice versa",
70
+ version=datasets.Version(_VERSION),
71
+ )
72
+ for lang1, lang2 in _LANGUAGE_PAIRS
73
+ ]
74
+ BUILDER_CONFIG_CLASS = OpenSubtitlesConfig
75
+
76
+ def _info(self):
77
+ return datasets.DatasetInfo(
78
+ description=_DESCRIPTION,
79
+ features=datasets.Features(
80
+ {
81
+ "id": datasets.Value("string"),
82
+ "translation": datasets.Translation(languages=(self.config.lang1, self.config.lang2)),
83
+ },
84
+ ),
85
+ supervised_keys=None,
86
+ homepage=_HOMEPAGE_URL,
87
+ citation=_CITATION,
88
+ )
89
+
90
+ def _split_generators(self, dl_manager):
91
+ def _base_url(lang1, lang2):
92
+ return _BASE_URL.format(lang1, lang2)
93
+
94
+ download_url = _base_url(self.config.lang1, self.config.lang2)
95
+ path = dl_manager.download_and_extract(download_url)
96
+ return [
97
+ datasets.SplitGenerator(
98
+ name=datasets.Split.TRAIN,
99
+ gen_kwargs={"datapath": path},
100
+ )
101
+ ]
102
+
103
+ def _generate_examples(self, datapath):
104
+ l1, l2 = self.config.lang1, self.config.lang2
105
+ folder = l1 + "-" + l2
106
+ l1_file = _BASE_NAME.format(folder, l1)
107
+ l2_file = _BASE_NAME.format(folder, l2)
108
+ l1_path = os.path.join(datapath, l1_file)
109
+ l2_path = os.path.join(datapath, l2_file)
110
+ with open(l1_path, encoding="utf-8") as f1, open(l2_path, encoding="utf-8") as f2:
111
+ for sentence_counter, (x, y) in enumerate(zip(f1, f2)):
112
+ x = x.strip()
113
+ y = y.strip()
114
+ result = (
115
+ sentence_counter,
116
+ {
117
+ "id": str(sentence_counter),
118
+ "translation": {l1: x, l2: y},
119
+ },
120
+ )
121
+ sentence_counter += 1
122
+ yield result