Datasets:

Task Categories: translation
Multilinguality: multilingual
Language Creators: found
Annotations Creators: found
Source Datasets: original
Licenses: unknown
system commited on
Commit
b88debd
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,179 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ annotations_creators:
3
+ - found
4
+ language_creators:
5
+ - found
6
+ languages:
7
+ - ar
8
+ - bg
9
+ - cs
10
+ - de
11
+ - el
12
+ - en
13
+ - es
14
+ - fa
15
+ - fr
16
+ - he
17
+ - hu
18
+ - it
19
+ - nl
20
+ - pl
21
+ - pt
22
+ - ro
23
+ - ru
24
+ - sl
25
+ - tr
26
+ - vi
27
+
28
+ licenses:
29
+ - unknown
30
+ multilinguality:
31
+ - multilingual
32
+ size_categories:
33
+ - 10K<n<100K
34
+ source_datasets:
35
+ - original
36
+ task_categories:
37
+ - conditional-text-generation
38
+ task_ids:
39
+ - machine-translation
40
+ ---
41
+
42
+ # Dataset Card Creation Guide
43
+
44
+ ## Table of Contents
45
+ - [Dataset Description](#dataset-description)
46
+ - [Dataset Summary](#dataset-summary)
47
+ - [Supported Tasks](#supported-tasks-and-leaderboards)
48
+ - [Languages](#languages)
49
+ - [Dataset Structure](#dataset-structure)
50
+ - [Data Instances](#data-instances)
51
+ - [Data Fields](#data-instances)
52
+ - [Data Splits](#data-instances)
53
+ - [Dataset Creation](#dataset-creation)
54
+ - [Curation Rationale](#curation-rationale)
55
+ - [Source Data](#source-data)
56
+ - [Annotations](#annotations)
57
+ - [Personal and Sensitive Information](#personal-and-sensitive-information)
58
+ - [Considerations for Using the Data](#considerations-for-using-the-data)
59
+ - [Social Impact of Dataset](#social-impact-of-dataset)
60
+ - [Discussion of Biases](#discussion-of-biases)
61
+ - [Other Known Limitations](#other-known-limitations)
62
+ - [Additional Information](#additional-information)
63
+ - [Dataset Curators](#dataset-curators)
64
+ - [Licensing Information](#licensing-information)
65
+ - [Citation Information](#citation-information)
66
+
67
+ ## Dataset Description
68
+
69
+ - **Homepage:** http://opus.nlpl.eu/Wikipedia.php
70
+ - **Repository:** None
71
+ - **Paper:** http://www.lrec-conf.org/proceedings/lrec2012/pdf/463_Paper.pdf
72
+ - **Leaderboard:** [More Information Needed]
73
+ - **Point of Contact:** [More Information Needed]
74
+
75
+ ### Dataset Summary
76
+
77
+
78
+ To load a language pair which isn't part of the config, all you need to do is specify the language code as pairs.
79
+ You can find the valid pairs in Homepage section of Dataset Description: http://opus.nlpl.eu/Wikipedia.php
80
+ E.g.
81
+
82
+ `dataset = load_dataset("wikipedia", lang1="it", lang2="pl")`
83
+
84
+
85
+ ### Supported Tasks and Leaderboards
86
+
87
+ [More Information Needed]
88
+
89
+ ### Languages
90
+
91
+ [More Information Needed]
92
+
93
+ ## Dataset Structure
94
+
95
+ ### Data Instances
96
+
97
+ [More Information Needed]
98
+
99
+ ### Data Fields
100
+
101
+ [More Information Needed]
102
+
103
+ ### Data Splits
104
+
105
+ [More Information Needed]
106
+
107
+ ## Dataset Creation
108
+
109
+ ### Curation Rationale
110
+
111
+ [More Information Needed]
112
+
113
+ ### Source Data
114
+
115
+ [More Information Needed]
116
+
117
+ #### Initial Data Collection and Normalization
118
+
119
+ [More Information Needed]
120
+
121
+ #### Who are the source language producers?
122
+
123
+ [More Information Needed]
124
+
125
+ ### Annotations
126
+
127
+ [More Information Needed]
128
+
129
+ #### Annotation process
130
+
131
+ [More Information Needed]
132
+
133
+ #### Who are the annotators?
134
+
135
+ [More Information Needed]
136
+
137
+ ### Personal and Sensitive Information
138
+
139
+ [More Information Needed]
140
+
141
+ ## Considerations for Using the Data
142
+
143
+ ### Social Impact of Dataset
144
+
145
+ [More Information Needed]
146
+
147
+ ### Discussion of Biases
148
+
149
+ [More Information Needed]
150
+
151
+ ### Other Known Limitations
152
+
153
+ [More Information Needed]
154
+
155
+ ## Additional Information
156
+
157
+ ### Dataset Curators
158
+
159
+ [More Information Needed]
160
+
161
+ ### Licensing Information
162
+
163
+ [More Information Needed]
164
+
165
+ ### Citation Information
166
+
167
+ @InProceedings{TIEDEMANN12.463,
168
+ author = {J{\"o}rg Tiedemann},
169
+ title = {Parallel Data, Tools and Interfaces in OPUS},
170
+ booktitle = {Proceedings of the Eight International Conference on Language Resources and Evaluation (LREC'12)},
171
+ year = {2012},
172
+ month = {may},
173
+ date = {23-25},
174
+ address = {Istanbul, Turkey},
175
+ 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},
176
+ publisher = {European Language Resources Association (ELRA)},
177
+ isbn = {978-2-9517408-7-7},
178
+ language = {english}
179
+ }
dataset_infos.json ADDED
@@ -0,0 +1 @@
 
1
+ {"ar-en": {"description": "This is a corpus of parallel sentences extracted from Wikipedia by Krzysztof Wo\u0142k and Krzysztof Marasek. Please cite the following publication if you use the data: Krzysztof Wo\u0142k and Krzysztof Marasek: Building Subject-aligned Comparable Corpora and Mining it for Truly Parallel Sentence Pairs., Procedia Technology, 18, Elsevier, p.126-132, 2014\n20 languages, 36 bitexts\ntotal number of files: 114\ntotal number of tokens: 610.13M\ntotal number of sentence fragments: 25.90M\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/Wikipedia.php", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "translation": {"languages": ["ar", "en"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": null, "builder_name": "opus_wikipedia", "config_name": "ar-en", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 45207715, "num_examples": 151136, "dataset_name": "opus_wikipedia"}}, "download_checksums": {"https://object.pouta.csc.fi/OPUS-Wikipedia/v1.0/moses/ar-en.txt.zip": {"num_bytes": 16097997, "checksum": "6cae36918d61b77db5015db59fbd7d0425f148a620e44d1a6d54e821dfe41a08"}}, "download_size": 16097997, "post_processing_size": null, "dataset_size": 45207715, "size_in_bytes": 61305712}, "ar-pl": {"description": "This is a corpus of parallel sentences extracted from Wikipedia by Krzysztof Wo\u0142k and Krzysztof Marasek. Please cite the following publication if you use the data: Krzysztof Wo\u0142k and Krzysztof Marasek: Building Subject-aligned Comparable Corpora and Mining it for Truly Parallel Sentence Pairs., Procedia Technology, 18, Elsevier, p.126-132, 2014\n20 languages, 36 bitexts\ntotal number of files: 114\ntotal number of tokens: 610.13M\ntotal number of sentence fragments: 25.90M\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/Wikipedia.php", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "translation": {"languages": ["ar", "pl"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": null, "builder_name": "opus_wikipedia", "config_name": "ar-pl", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 304851676, "num_examples": 823715, "dataset_name": "opus_wikipedia"}}, "download_checksums": {"https://object.pouta.csc.fi/OPUS-Wikipedia/v1.0/moses/ar-pl.txt.zip": {"num_bytes": 104585718, "checksum": "4e52cfe2fe1bc4561249091afadd2079b65d739b0ac254a9db0f1e3a3ce9d396"}}, "download_size": 104585718, "post_processing_size": null, "dataset_size": 304851676, "size_in_bytes": 409437394}, "en-sl": {"description": "This is a corpus of parallel sentences extracted from Wikipedia by Krzysztof Wo\u0142k and Krzysztof Marasek. Please cite the following publication if you use the data: Krzysztof Wo\u0142k and Krzysztof Marasek: Building Subject-aligned Comparable Corpora and Mining it for Truly Parallel Sentence Pairs., Procedia Technology, 18, Elsevier, p.126-132, 2014\n20 languages, 36 bitexts\ntotal number of files: 114\ntotal number of tokens: 610.13M\ntotal number of sentence fragments: 25.90M\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/Wikipedia.php", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "translation": {"languages": ["en", "sl"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": null, "builder_name": "opus_wikipedia", "config_name": "en-sl", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 30479739, "num_examples": 140124, "dataset_name": "opus_wikipedia"}}, "download_checksums": {"https://object.pouta.csc.fi/OPUS-Wikipedia/v1.0/moses/en-sl.txt.zip": {"num_bytes": 11727538, "checksum": "050c79504fb8e49f32e0ab2625dfbe777ed5f7d430e0f154aaafa230dc71350e"}}, "download_size": 11727538, "post_processing_size": null, "dataset_size": 30479739, "size_in_bytes": 42207277}, "en-ru": {"description": "This is a corpus of parallel sentences extracted from Wikipedia by Krzysztof Wo\u0142k and Krzysztof Marasek. Please cite the following publication if you use the data: Krzysztof Wo\u0142k and Krzysztof Marasek: Building Subject-aligned Comparable Corpora and Mining it for Truly Parallel Sentence Pairs., Procedia Technology, 18, Elsevier, p.126-132, 2014\n20 languages, 36 bitexts\ntotal number of files: 114\ntotal number of tokens: 610.13M\ntotal number of sentence fragments: 25.90M\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/Wikipedia.php", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "translation": {"languages": ["en", "ru"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": null, "builder_name": "opus_wikipedia", "config_name": "en-ru", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 167649057, "num_examples": 572717, "dataset_name": "opus_wikipedia"}}, "download_checksums": {"https://object.pouta.csc.fi/OPUS-Wikipedia/v1.0/moses/en-ru.txt.zip": {"num_bytes": 57356138, "checksum": "7c863f5038ff572738ecab2bc5a4ecef08eb5d27cba6cc54a671a596098fc689"}}, "download_size": 57356138, "post_processing_size": null, "dataset_size": 167649057, "size_in_bytes": 225005195}, "en-vi": {"description": "This is a corpus of parallel sentences extracted from Wikipedia by Krzysztof Wo\u0142k and Krzysztof Marasek. Please cite the following publication if you use the data: Krzysztof Wo\u0142k and Krzysztof Marasek: Building Subject-aligned Comparable Corpora and Mining it for Truly Parallel Sentence Pairs., Procedia Technology, 18, Elsevier, p.126-132, 2014\n20 languages, 36 bitexts\ntotal number of files: 114\ntotal number of tokens: 610.13M\ntotal number of sentence fragments: 25.90M\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/Wikipedia.php", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "translation": {"languages": ["en", "vi"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": null, "builder_name": "opus_wikipedia", "config_name": "en-vi", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 7571598, "num_examples": 58116, "dataset_name": "opus_wikipedia"}}, "download_checksums": {"https://object.pouta.csc.fi/OPUS-Wikipedia/v1.0/moses/en-vi.txt.zip": {"num_bytes": 2422413, "checksum": "4214b9b17a3b6780ebacfdcd9d7ad256d03e61bbe43c786228f740c7c7a4a1e1"}}, "download_size": 2422413, "post_processing_size": null, "dataset_size": 7571598, "size_in_bytes": 9994011}}
dummy/ar-en/1.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:306d1cdc1079c0f537d9ae91d8f3e9cb650015ca2a7acab689715b2d541c8aaa
3
+ size 1523
dummy/ar-pl/1.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1f17c48b6c3031b0e7a6bcfe404073852cc4cd6f995fca25cf7856d1b2ad72e6
3
+ size 1777
dummy/en-ru/1.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a2bc868b93608c6cb88d41fb839f0746887648082a1174618c4a0bd09aece4e7
3
+ size 1474
dummy/en-sl/1.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5a75625752bb2b717ee459f471bda73ed7307be237cc4564c6f300270475fc57
3
+ size 1205
dummy/en-vi/1.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d4e601f5574406bf5bdbb8f3a8fac7d075f1952775f8b6b70ebed7a81fea8070
3
+ size 1389
opus_wikipedia.py ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 corpus of parallel sentences extracted from Wikipedia by Krzysztof Wołk and Krzysztof Marasek. Please cite the following publication if you use the data: Krzysztof Wołk and Krzysztof Marasek: Building Subject-aligned Comparable Corpora and Mining it for Truly Parallel Sentence Pairs., Procedia Technology, 18, Elsevier, p.126-132, 2014
24
+ 20 languages, 36 bitexts
25
+ total number of files: 114
26
+ total number of tokens: 610.13M
27
+ total number of sentence fragments: 25.90M
28
+ """
29
+ _HOMEPAGE_URL = "http://opus.nlpl.eu/Wikipedia.php"
30
+ _CITATION = """\
31
+ @InProceedings{TIEDEMANN12.463,
32
+ author = {J{\"o}rg Tiedemann},
33
+ title = {Parallel Data, Tools and Interfaces in OPUS},
34
+ booktitle = {Proceedings of the Eight International Conference on Language Resources and Evaluation (LREC'12)},
35
+ year = {2012},
36
+ month = {may},
37
+ date = {23-25},
38
+ address = {Istanbul, Turkey},
39
+ 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},
40
+ publisher = {European Language Resources Association (ELRA)},
41
+ isbn = {978-2-9517408-7-7},
42
+ language = {english}
43
+ }
44
+ """
45
+
46
+ _VERSION = "1.0.0"
47
+ _BASE_NAME = "Wikipedia.{}.{}"
48
+ _BASE_URL = "https://object.pouta.csc.fi/OPUS-Wikipedia/v1.0/moses/{}-{}.txt.zip"
49
+ # Please note that only few pairs are shown here. You can use config to generate data for all language pairs
50
+ _LANGUAGE_PAIRS = [
51
+ ("ar", "en"),
52
+ ("ar", "pl"),
53
+ ("en", "sl"),
54
+ ("en", "ru"),
55
+ ("en", "vi"),
56
+ ]
57
+
58
+
59
+ class WikipediaConfig(datasets.BuilderConfig):
60
+ def __init__(self, *args, lang1=None, lang2=None, **kwargs):
61
+ super().__init__(
62
+ *args,
63
+ name=f"{lang1}-{lang2}",
64
+ **kwargs,
65
+ )
66
+ self.lang1 = lang1
67
+ self.lang2 = lang2
68
+
69
+
70
+ class OpusWikipedia(datasets.GeneratorBasedBuilder):
71
+ BUILDER_CONFIGS = [
72
+ WikipediaConfig(
73
+ lang1=lang1,
74
+ lang2=lang2,
75
+ description=f"Translating {lang1} to {lang2} or vice versa",
76
+ version=datasets.Version(_VERSION),
77
+ )
78
+ for lang1, lang2 in _LANGUAGE_PAIRS
79
+ ]
80
+ BUILDER_CONFIG_CLASS = WikipediaConfig
81
+
82
+ def _info(self):
83
+ return datasets.DatasetInfo(
84
+ description=_DESCRIPTION,
85
+ features=datasets.Features(
86
+ {
87
+ "id": datasets.Value("string"),
88
+ "translation": datasets.Translation(languages=(self.config.lang1, self.config.lang2)),
89
+ },
90
+ ),
91
+ supervised_keys=None,
92
+ homepage=_HOMEPAGE_URL,
93
+ citation=_CITATION,
94
+ )
95
+
96
+ def _split_generators(self, dl_manager):
97
+ def _base_url(lang1, lang2):
98
+ return _BASE_URL.format(lang1, lang2)
99
+
100
+ download_url = _base_url(self.config.lang1, self.config.lang2)
101
+ path = dl_manager.download_and_extract(download_url)
102
+ return [
103
+ datasets.SplitGenerator(
104
+ name=datasets.Split.TRAIN,
105
+ gen_kwargs={"datapath": path},
106
+ )
107
+ ]
108
+
109
+ def _generate_examples(self, datapath):
110
+ l1, l2 = self.config.lang1, self.config.lang2
111
+ folder = l1 + "-" + l2
112
+ l1_file = _BASE_NAME.format(folder, l1)
113
+ l2_file = _BASE_NAME.format(folder, l2)
114
+ l1_path = os.path.join(datapath, l1_file)
115
+ l2_path = os.path.join(datapath, l2_file)
116
+ with open(l1_path, encoding="utf-8") as f1, open(l2_path, encoding="utf-8") as f2:
117
+ for sentence_counter, (x, y) in enumerate(zip(f1, f2)):
118
+ x = x.strip()
119
+ y = y.strip()
120
+ result = (
121
+ sentence_counter,
122
+ {
123
+ "id": str(sentence_counter),
124
+ "translation": {l1: x, l2: y},
125
+ },
126
+ )
127
+ yield result