system HF staff commited on
Commit
b97c6db
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,184 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ annotations_creators:
3
+ - found
4
+ language_creators:
5
+ - found
6
+ languages:
7
+ - bg
8
+ - ca
9
+ - cs
10
+ - da
11
+ - de
12
+ - el
13
+ - es
14
+ - et
15
+ - eu
16
+ - fi
17
+ - fr
18
+ - ga
19
+ - gl
20
+ - ha
21
+ - hr
22
+ - hu
23
+ - ig
24
+ - is
25
+ - it
26
+ - km
27
+ - lt
28
+ - lv
29
+ - mt
30
+ - my
31
+ - nb
32
+ - ne
33
+ - nl
34
+ - nn
35
+ - pl
36
+ - ps
37
+ - pt
38
+ - ro
39
+ - ru
40
+ - si
41
+ - sk
42
+ - sl
43
+ - so
44
+ - sv
45
+ - sw
46
+ - tl
47
+ licenses:
48
+ - cc0-1-0
49
+ multilinguality:
50
+ - multilingual
51
+ size_categories:
52
+ - 100K<n<1M
53
+ source_datasets:
54
+ - original
55
+ task_categories:
56
+ - conditional-text-generation
57
+ task_ids:
58
+ - machine-translation
59
+ ---
60
+
61
+ # Dataset Card Creation Guide
62
+
63
+ ## Table of Contents
64
+ - [Dataset Description](#dataset-description)
65
+ - [Dataset Summary](#dataset-summary)
66
+ - [Supported Tasks](#supported-tasks-and-leaderboards)
67
+ - [Languages](#languages)
68
+ - [Dataset Structure](#dataset-structure)
69
+ - [Data Instances](#data-instances)
70
+ - [Data Fields](#data-instances)
71
+ - [Data Splits](#data-instances)
72
+ - [Dataset Creation](#dataset-creation)
73
+ - [Curation Rationale](#curation-rationale)
74
+ - [Source Data](#source-data)
75
+ - [Annotations](#annotations)
76
+ - [Personal and Sensitive Information](#personal-and-sensitive-information)
77
+ - [Considerations for Using the Data](#considerations-for-using-the-data)
78
+ - [Social Impact of Dataset](#social-impact-of-dataset)
79
+ - [Discussion of Biases](#discussion-of-biases)
80
+ - [Other Known Limitations](#other-known-limitations)
81
+ - [Additional Information](#additional-information)
82
+ - [Dataset Curators](#dataset-curators)
83
+ - [Licensing Information](#licensing-information)
84
+ - [Citation Information](#citation-information)
85
+
86
+ ## Dataset Description
87
+
88
+ - **Homepage:** http://opus.nlpl.eu/MultiParaCrawl.php
89
+ - **Repository:** None
90
+ - **Paper:** http://www.lrec-conf.org/proceedings/lrec2012/pdf/463_Paper.pdf
91
+ - **Leaderboard:** [More Information Needed]
92
+ - **Point of Contact:** [More Information Needed]
93
+
94
+ ### Dataset Summary
95
+
96
+ To load a language pair which isn't part of the config, all you need to do is specify the language code as pairs.
97
+ You can find the valid pairs in Homepage section of Dataset Description: http://opus.nlpl.eu/MultiParaCrawl.php
98
+ E.g.
99
+
100
+ `dataset = load_dataset("multi_para_crawl", lang1="en", lang2="nl")`
101
+
102
+ ### Supported Tasks and Leaderboards
103
+
104
+ [More Information Needed]
105
+
106
+ ### Languages
107
+
108
+ [More Information Needed]
109
+
110
+ ## Dataset Structure
111
+
112
+ ### Data Instances
113
+
114
+ [More Information Needed]
115
+
116
+ ### Data Fields
117
+
118
+ [More Information Needed]
119
+
120
+ ### Data Splits
121
+
122
+ [More Information Needed]
123
+
124
+ ## Dataset Creation
125
+
126
+ ### Curation Rationale
127
+
128
+ [More Information Needed]
129
+
130
+ ### Source Data
131
+
132
+ [More Information Needed]
133
+
134
+ #### Initial Data Collection and Normalization
135
+
136
+ [More Information Needed]
137
+
138
+ #### Who are the source language producers?
139
+
140
+ [More Information Needed]
141
+
142
+ ### Annotations
143
+
144
+ [More Information Needed]
145
+
146
+ #### Annotation process
147
+
148
+ [More Information Needed]
149
+
150
+ #### Who are the annotators?
151
+
152
+ [More Information Needed]
153
+
154
+ ### Personal and Sensitive Information
155
+
156
+ [More Information Needed]
157
+
158
+ ## Considerations for Using the Data
159
+
160
+ ### Social Impact of Dataset
161
+
162
+ [More Information Needed]
163
+
164
+ ### Discussion of Biases
165
+
166
+ [More Information Needed]
167
+
168
+ ### Other Known Limitations
169
+
170
+ [More Information Needed]
171
+
172
+ ## Additional Information
173
+
174
+ ### Dataset Curators
175
+
176
+ [More Information Needed]
177
+
178
+ ### Licensing Information
179
+
180
+ [More Information Needed]
181
+
182
+ ### Citation Information
183
+
184
+ [More Information Needed]
dataset_infos.json ADDED
@@ -0,0 +1 @@
 
1
+ {"cs-is": {"description": "Parallel corpora from Web Crawls collected in the ParaCrawl project and further processed for making it a multi-parallel corpus by pivoting via English. Here we only provide the additional language pairs that came out of pivoting. The bitexts for English are available from the ParaCrawl release.\n40 languages, 669 bitexts\ntotal number of files: 40\ntotal number of tokens: 10.14G\ntotal number of sentence fragments: 505.48M\n\nPlease, acknowledge the ParaCrawl project at http://paracrawl.eu. This version is derived from the original release at their website adjusted for redistribution via the OPUS corpus collection. Please, acknowledge OPUS as well for this service.\n", "citation": "@InProceedings{TIEDEMANN12.463,\n author = {J\ufffdrg Tiedemann},\n title = {Parallel Data, Tools and Interfaces in OPUS},\n booktitle = {Proceedings of the Eight International Conference on Language Resources and Evaluation (LREC'12)},\n year = {2012},\n month = {may},\n date = {23-25},\n address = {Istanbul, Turkey},\n 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},\n publisher = {European Language Resources Association (ELRA)},\n isbn = {978-2-9517408-7-7},\n language = {english}\n }\n", "homepage": "http://opus.nlpl.eu/MultiParaCrawl.php", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "translation": {"languages": ["cs", "is"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": null, "builder_name": "multi_para_crawl", "config_name": "cs-is", "version": {"version_str": "7.1.0", "description": "", "major": 7, "minor": 1, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 148967967, "num_examples": 691006, "dataset_name": "multi_para_crawl"}}, "download_checksums": {"https://object.pouta.csc.fi/OPUS-MultiParaCrawl/v7.1/moses/cs-is.txt.zip": {"num_bytes": 61609317, "checksum": "c8c396786e0125bba1d4062b437652bf8ed8e8d5e3ad053fdf80f8f5a4d4ae0b"}}, "download_size": 61609317, "post_processing_size": null, "dataset_size": 148967967, "size_in_bytes": 210577284}, "ga-sk": {"description": "Parallel corpora from Web Crawls collected in the ParaCrawl project and further processed for making it a multi-parallel corpus by pivoting via English. Here we only provide the additional language pairs that came out of pivoting. The bitexts for English are available from the ParaCrawl release.\n40 languages, 669 bitexts\ntotal number of files: 40\ntotal number of tokens: 10.14G\ntotal number of sentence fragments: 505.48M\n\nPlease, acknowledge the ParaCrawl project at http://paracrawl.eu. This version is derived from the original release at their website adjusted for redistribution via the OPUS corpus collection. Please, acknowledge OPUS as well for this service.\n", "citation": "@InProceedings{TIEDEMANN12.463,\n author = {J\ufffdrg Tiedemann},\n title = {Parallel Data, Tools and Interfaces in OPUS},\n booktitle = {Proceedings of the Eight International Conference on Language Resources and Evaluation (LREC'12)},\n year = {2012},\n month = {may},\n date = {23-25},\n address = {Istanbul, Turkey},\n 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},\n publisher = {European Language Resources Association (ELRA)},\n isbn = {978-2-9517408-7-7},\n language = {english}\n }\n", "homepage": "http://opus.nlpl.eu/MultiParaCrawl.php", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "translation": {"languages": ["ga", "sk"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": null, "builder_name": "multi_para_crawl", "config_name": "ga-sk", "version": {"version_str": "7.1.0", "description": "", "major": 7, "minor": 1, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 92802332, "num_examples": 390327, "dataset_name": "multi_para_crawl"}}, "download_checksums": {"https://object.pouta.csc.fi/OPUS-MultiParaCrawl/v7.1/moses/ga-sk.txt.zip": {"num_bytes": 39574554, "checksum": "0d424537cbfd2d8310dff435db8de739e662b918dfd6c71ea0d3385bbe6585dd"}}, "download_size": 39574554, "post_processing_size": null, "dataset_size": 92802332, "size_in_bytes": 132376886}, "lv-mt": {"description": "Parallel corpora from Web Crawls collected in the ParaCrawl project and further processed for making it a multi-parallel corpus by pivoting via English. Here we only provide the additional language pairs that came out of pivoting. The bitexts for English are available from the ParaCrawl release.\n40 languages, 669 bitexts\ntotal number of files: 40\ntotal number of tokens: 10.14G\ntotal number of sentence fragments: 505.48M\n\nPlease, acknowledge the ParaCrawl project at http://paracrawl.eu. This version is derived from the original release at their website adjusted for redistribution via the OPUS corpus collection. Please, acknowledge OPUS as well for this service.\n", "citation": "@InProceedings{TIEDEMANN12.463,\n author = {J\ufffdrg Tiedemann},\n title = {Parallel Data, Tools and Interfaces in OPUS},\n booktitle = {Proceedings of the Eight International Conference on Language Resources and Evaluation (LREC'12)},\n year = {2012},\n month = {may},\n date = {23-25},\n address = {Istanbul, Turkey},\n 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},\n publisher = {European Language Resources Association (ELRA)},\n isbn = {978-2-9517408-7-7},\n language = {english}\n }\n", "homepage": "http://opus.nlpl.eu/MultiParaCrawl.php", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "translation": {"languages": ["lv", "mt"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": null, "builder_name": "multi_para_crawl", "config_name": "lv-mt", "version": {"version_str": "7.1.0", "description": "", "major": 7, "minor": 1, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 116533998, "num_examples": 464160, "dataset_name": "multi_para_crawl"}}, "download_checksums": {"https://object.pouta.csc.fi/OPUS-MultiParaCrawl/v7.1/moses/lv-mt.txt.zip": {"num_bytes": 49770574, "checksum": "9c6a7840ff792857f3cd0fb21c2eb358ec865df2cb8dd9e91ddcd4e623c32b96"}}, "download_size": 49770574, "post_processing_size": null, "dataset_size": 116533998, "size_in_bytes": 166304572}, "nb-ru": {"description": "Parallel corpora from Web Crawls collected in the ParaCrawl project and further processed for making it a multi-parallel corpus by pivoting via English. Here we only provide the additional language pairs that came out of pivoting. The bitexts for English are available from the ParaCrawl release.\n40 languages, 669 bitexts\ntotal number of files: 40\ntotal number of tokens: 10.14G\ntotal number of sentence fragments: 505.48M\n\nPlease, acknowledge the ParaCrawl project at http://paracrawl.eu. This version is derived from the original release at their website adjusted for redistribution via the OPUS corpus collection. Please, acknowledge OPUS as well for this service.\n", "citation": "@InProceedings{TIEDEMANN12.463,\n author = {J\ufffdrg Tiedemann},\n title = {Parallel Data, Tools and Interfaces in OPUS},\n booktitle = {Proceedings of the Eight International Conference on Language Resources and Evaluation (LREC'12)},\n year = {2012},\n month = {may},\n date = {23-25},\n address = {Istanbul, Turkey},\n 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},\n publisher = {European Language Resources Association (ELRA)},\n isbn = {978-2-9517408-7-7},\n language = {english}\n }\n", "homepage": "http://opus.nlpl.eu/MultiParaCrawl.php", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "translation": {"languages": ["nb", "ru"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": null, "builder_name": "multi_para_crawl", "config_name": "nb-ru", "version": {"version_str": "7.1.0", "description": "", "major": 7, "minor": 1, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 116899303, "num_examples": 399050, "dataset_name": "multi_para_crawl"}}, "download_checksums": {"https://object.pouta.csc.fi/OPUS-MultiParaCrawl/v7.1/moses/nb-ru.txt.zip": {"num_bytes": 40932849, "checksum": "e8df32dbf030dafb823dcec1526bb3f3839fcd2afefac19095f179c86a3146a6"}}, "download_size": 40932849, "post_processing_size": null, "dataset_size": 116899303, "size_in_bytes": 157832152}, "de-tl": {"description": "Parallel corpora from Web Crawls collected in the ParaCrawl project and further processed for making it a multi-parallel corpus by pivoting via English. Here we only provide the additional language pairs that came out of pivoting. The bitexts for English are available from the ParaCrawl release.\n40 languages, 669 bitexts\ntotal number of files: 40\ntotal number of tokens: 10.14G\ntotal number of sentence fragments: 505.48M\n\nPlease, acknowledge the ParaCrawl project at http://paracrawl.eu. This version is derived from the original release at their website adjusted for redistribution via the OPUS corpus collection. Please, acknowledge OPUS as well for this service.\n", "citation": "@InProceedings{TIEDEMANN12.463,\n author = {J\ufffdrg Tiedemann},\n title = {Parallel Data, Tools and Interfaces in OPUS},\n booktitle = {Proceedings of the Eight International Conference on Language Resources and Evaluation (LREC'12)},\n year = {2012},\n month = {may},\n date = {23-25},\n address = {Istanbul, Turkey},\n 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},\n publisher = {European Language Resources Association (ELRA)},\n isbn = {978-2-9517408-7-7},\n language = {english}\n }\n", "homepage": "http://opus.nlpl.eu/MultiParaCrawl.php", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "translation": {"languages": ["de", "tl"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": null, "builder_name": "multi_para_crawl", "config_name": "de-tl", "version": {"version_str": "7.1.0", "description": "", "major": 7, "minor": 1, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 30880849, "num_examples": 98156, "dataset_name": "multi_para_crawl"}}, "download_checksums": {"https://object.pouta.csc.fi/OPUS-MultiParaCrawl/v7.1/moses/de-tl.txt.zip": {"num_bytes": 12116471, "checksum": "62228fb767ca630c6dbd5a21fb073b6407b85a7595b3b34474f91fbe06493ceb"}}, "download_size": 12116471, "post_processing_size": null, "dataset_size": 30880849, "size_in_bytes": 42997320}}
dummy/cs-is/7.1.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:63963fc761605d2cd76aeccafff541e868bae9c64cd3df78ff21608aa0aa58b5
3
+ size 1447
dummy/de-tl/7.1.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6d41d1041b5dd4f5cac9fb591e50498ac3b58c384ba9fa9fecc103e14ab5a176
3
+ size 1731
dummy/ga-sk/7.1.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1f2fe0b757fce6ceff8cf91d96473c56fd4f1cbda541661809d9519d1547e3ae
3
+ size 1464
dummy/lv-mt/7.1.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6d1b1e678ea0c35ed13005552e101cdf93802cd8dd821795ca7de1c024c24d3e
3
+ size 2676
dummy/nb-ru/7.1.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3856ba1c94bee509217aa7ba88a227df4dbd5f45da5b4aba5d02e033217accda
3
+ size 1700
multi_para_crawl.py ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ Parallel corpora from Web Crawls collected in the ParaCrawl project and further processed for making it a multi-parallel corpus by pivoting via English. Here we only provide the additional language pairs that came out of pivoting. The bitexts for English are available from the ParaCrawl release.
24
+ 40 languages, 669 bitexts
25
+ total number of files: 40
26
+ total number of tokens: 10.14G
27
+ total number of sentence fragments: 505.48M
28
+
29
+ Please, acknowledge the ParaCrawl project at http://paracrawl.eu. This version is derived from the original release at their website adjusted for redistribution via the OPUS corpus collection. Please, acknowledge OPUS as well for this service.
30
+ """
31
+ _HOMEPAGE_URL = "http://opus.nlpl.eu/MultiParaCrawl.php"
32
+ _CITATION = """\
33
+ @InProceedings{TIEDEMANN12.463,
34
+ author = {J�rg Tiedemann},
35
+ title = {Parallel Data, Tools and Interfaces in OPUS},
36
+ booktitle = {Proceedings of the Eight International Conference on Language Resources and Evaluation (LREC'12)},
37
+ year = {2012},
38
+ month = {may},
39
+ date = {23-25},
40
+ address = {Istanbul, Turkey},
41
+ 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},
42
+ publisher = {European Language Resources Association (ELRA)},
43
+ isbn = {978-2-9517408-7-7},
44
+ language = {english}
45
+ }
46
+ """
47
+
48
+ _VERSION = "7.1.0"
49
+ _BASE_NAME = "MultiParaCrawl.{}.{}"
50
+ _BASE_URL = "https://object.pouta.csc.fi/OPUS-MultiParaCrawl/v7.1/moses/{}-{}.txt.zip"
51
+
52
+ # Please note that only few pairs are shown here. You can use config to generate data for all language pairs
53
+ _LANGUAGE_PAIRS = [
54
+ ("cs", "is"),
55
+ ("ga", "sk"),
56
+ ("lv", "mt"),
57
+ ("nb", "ru"),
58
+ ("de", "tl"),
59
+ ]
60
+
61
+
62
+ class MultiParaCrawlConfig(datasets.BuilderConfig):
63
+ def __init__(self, *args, lang1=None, lang2=None, **kwargs):
64
+ super().__init__(
65
+ *args,
66
+ name=f"{lang1}-{lang2}",
67
+ **kwargs,
68
+ )
69
+ self.lang1 = lang1
70
+ self.lang2 = lang2
71
+
72
+
73
+ class MultiParaCrawl(datasets.GeneratorBasedBuilder):
74
+ BUILDER_CONFIGS = [
75
+ MultiParaCrawlConfig(
76
+ lang1=lang1,
77
+ lang2=lang2,
78
+ description=f"Translating {lang1} to {lang2} or vice versa",
79
+ version=datasets.Version(_VERSION),
80
+ )
81
+ for lang1, lang2 in _LANGUAGE_PAIRS
82
+ ]
83
+ BUILDER_CONFIG_CLASS = MultiParaCrawlConfig
84
+
85
+ def _info(self):
86
+ return datasets.DatasetInfo(
87
+ description=_DESCRIPTION,
88
+ features=datasets.Features(
89
+ {
90
+ "id": datasets.Value("string"),
91
+ "translation": datasets.Translation(languages=(self.config.lang1, self.config.lang2)),
92
+ },
93
+ ),
94
+ supervised_keys=None,
95
+ homepage=_HOMEPAGE_URL,
96
+ citation=_CITATION,
97
+ )
98
+
99
+ def _split_generators(self, dl_manager):
100
+ def _base_url(lang1, lang2):
101
+ return _BASE_URL.format(lang1, lang2)
102
+
103
+ download_url = _base_url(self.config.lang1, self.config.lang2)
104
+ path = dl_manager.download_and_extract(download_url)
105
+ return [
106
+ datasets.SplitGenerator(
107
+ name=datasets.Split.TRAIN,
108
+ gen_kwargs={"datapath": path},
109
+ )
110
+ ]
111
+
112
+ def _generate_examples(self, datapath):
113
+ l1, l2 = self.config.lang1, self.config.lang2
114
+ folder = l1 + "-" + l2
115
+ l1_file = _BASE_NAME.format(folder, l1)
116
+ l2_file = _BASE_NAME.format(folder, l2)
117
+ l1_path = os.path.join(datapath, l1_file)
118
+ l2_path = os.path.join(datapath, l2_file)
119
+ with open(l1_path, encoding="utf-8") as f1, open(l2_path, encoding="utf-8") as f2:
120
+ for sentence_counter, (x, y) in enumerate(zip(f1, f2)):
121
+ x = x.strip()
122
+ y = y.strip()
123
+ result = (
124
+ sentence_counter,
125
+ {
126
+ "id": str(sentence_counter),
127
+ "translation": {l1: x, l2: y},
128
+ },
129
+ )
130
+ yield result