Commit
•
47bbdcd
0
Parent(s):
Update files from the datasets library (from 1.2.0)
Browse filesRelease notes: https://github.com/huggingface/datasets/releases/tag/1.2.0
- .gitattributes +27 -0
- README.md +164 -0
- dataset_infos.json +1 -0
- dummy/cs-en/1.0.0/dummy_data.zip +3 -0
- dummy/de-fr/1.0.0/dummy_data.zip +3 -0
- dummy/el-it/1.0.0/dummy_data.zip +3 -0
- dummy/en-nl/1.0.0/dummy_data.zip +3 -0
- dummy/fi-pl/1.0.0/dummy_data.zip +3 -0
- ecb.py +128 -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,164 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
annotations_creators:
|
3 |
+
- found
|
4 |
+
language_creators:
|
5 |
+
- found
|
6 |
+
languages:
|
7 |
+
- cs
|
8 |
+
- da
|
9 |
+
- de
|
10 |
+
- el
|
11 |
+
- en
|
12 |
+
- es
|
13 |
+
- et
|
14 |
+
- fi
|
15 |
+
- fr
|
16 |
+
- hu
|
17 |
+
- it
|
18 |
+
- lt
|
19 |
+
- lv
|
20 |
+
- mt
|
21 |
+
- nl
|
22 |
+
- pl
|
23 |
+
- pt
|
24 |
+
- sk
|
25 |
+
- sl
|
26 |
+
licenses:
|
27 |
+
- unknown
|
28 |
+
multilinguality:
|
29 |
+
- multilingual
|
30 |
+
size_categories:
|
31 |
+
- 100K<n<1M
|
32 |
+
source_datasets:
|
33 |
+
- original
|
34 |
+
task_categories:
|
35 |
+
- conditional-text-generation
|
36 |
+
task_ids:
|
37 |
+
- machine-translation
|
38 |
+
---
|
39 |
+
|
40 |
+
# Dataset Card Creation Guide
|
41 |
+
|
42 |
+
## Table of Contents
|
43 |
+
- [Dataset Description](#dataset-description)
|
44 |
+
- [Dataset Summary](#dataset-summary)
|
45 |
+
- [Supported Tasks](#supported-tasks-and-leaderboards)
|
46 |
+
- [Languages](#languages)
|
47 |
+
- [Dataset Structure](#dataset-structure)
|
48 |
+
- [Data Instances](#data-instances)
|
49 |
+
- [Data Fields](#data-instances)
|
50 |
+
- [Data Splits](#data-instances)
|
51 |
+
- [Dataset Creation](#dataset-creation)
|
52 |
+
- [Curation Rationale](#curation-rationale)
|
53 |
+
- [Source Data](#source-data)
|
54 |
+
- [Annotations](#annotations)
|
55 |
+
- [Personal and Sensitive Information](#personal-and-sensitive-information)
|
56 |
+
- [Considerations for Using the Data](#considerations-for-using-the-data)
|
57 |
+
- [Social Impact of Dataset](#social-impact-of-dataset)
|
58 |
+
- [Discussion of Biases](#discussion-of-biases)
|
59 |
+
- [Other Known Limitations](#other-known-limitations)
|
60 |
+
- [Additional Information](#additional-information)
|
61 |
+
- [Dataset Curators](#dataset-curators)
|
62 |
+
- [Licensing Information](#licensing-information)
|
63 |
+
- [Citation Information](#citation-information)
|
64 |
+
|
65 |
+
## Dataset Description
|
66 |
+
|
67 |
+
- **Homepage:** http://opus.nlpl.eu/ECB.php
|
68 |
+
- **Repository:** None
|
69 |
+
- **Paper:** http://www.lrec-conf.org/proceedings/lrec2012/pdf/463_Paper.pdf
|
70 |
+
- **Leaderboard:** [More Information Needed]
|
71 |
+
- **Point of Contact:** [More Information Needed]
|
72 |
+
|
73 |
+
### Dataset Summary
|
74 |
+
|
75 |
+
To load a language pair which isn't part of the config, all you need to do is specify the language code as pairs.
|
76 |
+
You can find the valid pairs in Homepage section of Dataset Description: http://opus.nlpl.eu/ECB.php
|
77 |
+
E.g.
|
78 |
+
|
79 |
+
`dataset = load_dataset("ecb", lang1="en", lang2="fi")`
|
80 |
+
|
81 |
+
### Supported Tasks and Leaderboards
|
82 |
+
|
83 |
+
[More Information Needed]
|
84 |
+
|
85 |
+
### Languages
|
86 |
+
|
87 |
+
[More Information Needed]
|
88 |
+
|
89 |
+
## Dataset Structure
|
90 |
+
|
91 |
+
### Data Instances
|
92 |
+
|
93 |
+
Here are some examples of questions and facts:
|
94 |
+
|
95 |
+
|
96 |
+
### Data Fields
|
97 |
+
|
98 |
+
[More Information Needed]
|
99 |
+
|
100 |
+
### Data Splits
|
101 |
+
|
102 |
+
[More Information Needed]
|
103 |
+
|
104 |
+
## Dataset Creation
|
105 |
+
|
106 |
+
### Curation Rationale
|
107 |
+
|
108 |
+
[More Information Needed]
|
109 |
+
|
110 |
+
### Source Data
|
111 |
+
|
112 |
+
[More Information Needed]
|
113 |
+
|
114 |
+
#### Initial Data Collection and Normalization
|
115 |
+
|
116 |
+
[More Information Needed]
|
117 |
+
|
118 |
+
#### Who are the source language producers?
|
119 |
+
|
120 |
+
[More Information Needed]
|
121 |
+
|
122 |
+
### Annotations
|
123 |
+
|
124 |
+
[More Information Needed]
|
125 |
+
|
126 |
+
#### Annotation process
|
127 |
+
|
128 |
+
[More Information Needed]
|
129 |
+
|
130 |
+
#### Who are the annotators?
|
131 |
+
|
132 |
+
[More Information Needed]
|
133 |
+
|
134 |
+
### Personal and Sensitive Information
|
135 |
+
|
136 |
+
[More Information Needed]
|
137 |
+
|
138 |
+
## Considerations for Using the Data
|
139 |
+
|
140 |
+
### Social Impact of Dataset
|
141 |
+
|
142 |
+
[More Information Needed]
|
143 |
+
|
144 |
+
### Discussion of Biases
|
145 |
+
|
146 |
+
[More Information Needed]
|
147 |
+
|
148 |
+
### Other Known Limitations
|
149 |
+
|
150 |
+
[More Information Needed]
|
151 |
+
|
152 |
+
## Additional Information
|
153 |
+
|
154 |
+
### Dataset Curators
|
155 |
+
|
156 |
+
[More Information Needed]
|
157 |
+
|
158 |
+
### Licensing Information
|
159 |
+
|
160 |
+
[More Information Needed]
|
161 |
+
|
162 |
+
### Citation Information
|
163 |
+
|
164 |
+
[More Information Needed]
|
dataset_infos.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"de-fr": {"description": "Original source: Website and documentatuion from the European Central Bank, compiled and made available by Alberto Simoes (thank you very much!)\n19 languages, 170 bitexts\ntotal number of files: 340\ntotal number of tokens: 757.37M\ntotal number of sentence fragments: 30.55M\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": "", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "translation": {"languages": ["de", "fr"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": null, "builder_name": "ecb", "config_name": "de-fr", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 39514115, "num_examples": 105116, "dataset_name": "ecb"}}, "download_checksums": {"https://object.pouta.csc.fi/OPUS-ECB/v1/moses/de-fr.txt.zip": {"num_bytes": 10326178, "checksum": "99812e3c814fac41c749eaed07351cbde4e80bccfed4411a37400196e0054682"}}, "download_size": 10326178, "post_processing_size": null, "dataset_size": 39514115, "size_in_bytes": 49840293}, "cs-en": {"description": "Original source: Website and documentatuion from the European Central Bank, compiled and made available by Alberto Simoes (thank you very much!)\n19 languages, 170 bitexts\ntotal number of files: 340\ntotal number of tokens: 757.37M\ntotal number of sentence fragments: 30.55M\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": "", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "translation": {"languages": ["cs", "en"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": null, "builder_name": "ecb", "config_name": "cs-en", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 19524831, "num_examples": 63716, "dataset_name": "ecb"}}, "download_checksums": {"https://object.pouta.csc.fi/OPUS-ECB/v1/moses/cs-en.txt.zip": {"num_bytes": 5360485, "checksum": "88951c38f54ab407646acde8489176036176438bfbd0ca45477278dfc5fb0424"}}, "download_size": 5360485, "post_processing_size": null, "dataset_size": 19524831, "size_in_bytes": 24885316}, "el-it": {"description": "Original source: Website and documentatuion from the European Central Bank, compiled and made available by Alberto Simoes (thank you very much!)\n19 languages, 170 bitexts\ntotal number of files: 340\ntotal number of tokens: 757.37M\ntotal number of sentence fragments: 30.55M\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": "", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "translation": {"languages": ["el", "it"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": null, "builder_name": "ecb", "config_name": "el-it", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 47300471, "num_examples": 94712, "dataset_name": "ecb"}}, "download_checksums": {"https://object.pouta.csc.fi/OPUS-ECB/v1/moses/el-it.txt.zip": {"num_bytes": 10394277, "checksum": "859a831ce48aa2334f65deafa46a57ef5c1972181370cddddfed006f769f331f"}}, "download_size": 10394277, "post_processing_size": null, "dataset_size": 47300471, "size_in_bytes": 57694748}, "en-nl": {"description": "Original source: Website and documentatuion from the European Central Bank, compiled and made available by Alberto Simoes (thank you very much!)\n19 languages, 170 bitexts\ntotal number of files: 340\ntotal number of tokens: 757.37M\ntotal number of sentence fragments: 30.55M\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": "", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "translation": {"languages": ["en", "nl"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": null, "builder_name": "ecb", "config_name": "en-nl", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 43118164, "num_examples": 126482, "dataset_name": "ecb"}}, "download_checksums": {"https://object.pouta.csc.fi/OPUS-ECB/v1/moses/en-nl.txt.zip": {"num_bytes": 11360895, "checksum": "fd3565cce4a51ffd24fae324c5f23d5465cdf60494b0ce0f91cefc838818e91b"}}, "download_size": 11360895, "post_processing_size": null, "dataset_size": 43118164, "size_in_bytes": 54479059}, "fi-pl": {"description": "Original source: Website and documentatuion from the European Central Bank, compiled and made available by Alberto Simoes (thank you very much!)\n19 languages, 170 bitexts\ntotal number of files: 340\ntotal number of tokens: 757.37M\ntotal number of sentence fragments: 30.55M\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": "", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "translation": {"languages": ["fi", "pl"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": null, "builder_name": "ecb", "config_name": "fi-pl", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 12973283, "num_examples": 41686, "dataset_name": "ecb"}}, "download_checksums": {"https://object.pouta.csc.fi/OPUS-ECB/v1/moses/fi-pl.txt.zip": {"num_bytes": 3521950, "checksum": "1e14311230608f1eba068f243163cd52b266aa97e2e0e3a6373faaac70c6389f"}}, "download_size": 3521950, "post_processing_size": null, "dataset_size": 12973283, "size_in_bytes": 16495233}}
|
dummy/cs-en/1.0.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:83608f5e40e234f5b363b6700c34c8cc1cc422ec58d51da3d0db591c33b916cf
|
3 |
+
size 976
|
dummy/de-fr/1.0.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a4cf6871052c3021d1b28f11c59f5d9e71ac4409b8e680142ad61d32e1f3b789
|
3 |
+
size 1040
|
dummy/el-it/1.0.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2b639fc8e61fdf42da9a13eae59cf38170dc5101cb3f8a39b0d994e83a31b274
|
3 |
+
size 1458
|
dummy/en-nl/1.0.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2cce5ea6abfe9c4d3b097c973eace31dbfa68477e0ada5c23bd0d667ad1299bc
|
3 |
+
size 1546
|
dummy/fi-pl/1.0.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:49764a668d01a0f6b051c3b4af63a5401a40bd51a1c318d29b0ab3c4d40a4204
|
3 |
+
size 1102
|
ecb.py
ADDED
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
Original source: Website and documentatuion from the European Central Bank, compiled and made available by Alberto Simoes (thank you very much!)
|
24 |
+
19 languages, 170 bitexts
|
25 |
+
total number of files: 340
|
26 |
+
total number of tokens: 757.37M
|
27 |
+
total number of sentence fragments: 30.55M
|
28 |
+
"""
|
29 |
+
_HOMEPAGE_URL = ""
|
30 |
+
_CITATION = """\
|
31 |
+
@InProceedings{TIEDEMANN12.463,
|
32 |
+
author = {J�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 = "ECB.{}.{}"
|
48 |
+
_BASE_URL = "https://object.pouta.csc.fi/OPUS-ECB/v1/moses/{}-{}.txt.zip"
|
49 |
+
|
50 |
+
# Please note that only few pairs are shown here. You can use config to generate data for all language pairs
|
51 |
+
_LANGUAGE_PAIRS = [
|
52 |
+
("de", "fr"),
|
53 |
+
("cs", "en"),
|
54 |
+
("el", "it"),
|
55 |
+
("en", "nl"),
|
56 |
+
("fi", "pl"),
|
57 |
+
]
|
58 |
+
|
59 |
+
|
60 |
+
class EcbConfig(datasets.BuilderConfig):
|
61 |
+
def __init__(self, *args, lang1=None, lang2=None, **kwargs):
|
62 |
+
super().__init__(
|
63 |
+
*args,
|
64 |
+
name=f"{lang1}-{lang2}",
|
65 |
+
**kwargs,
|
66 |
+
)
|
67 |
+
self.lang1 = lang1
|
68 |
+
self.lang2 = lang2
|
69 |
+
|
70 |
+
|
71 |
+
class Ecb(datasets.GeneratorBasedBuilder):
|
72 |
+
BUILDER_CONFIGS = [
|
73 |
+
EcbConfig(
|
74 |
+
lang1=lang1,
|
75 |
+
lang2=lang2,
|
76 |
+
description=f"Translating {lang1} to {lang2} or vice versa",
|
77 |
+
version=datasets.Version(_VERSION),
|
78 |
+
)
|
79 |
+
for lang1, lang2 in _LANGUAGE_PAIRS
|
80 |
+
]
|
81 |
+
BUILDER_CONFIG_CLASS = EcbConfig
|
82 |
+
|
83 |
+
def _info(self):
|
84 |
+
return datasets.DatasetInfo(
|
85 |
+
description=_DESCRIPTION,
|
86 |
+
features=datasets.Features(
|
87 |
+
{
|
88 |
+
"id": datasets.Value("string"),
|
89 |
+
"translation": datasets.Translation(languages=(self.config.lang1, self.config.lang2)),
|
90 |
+
},
|
91 |
+
),
|
92 |
+
supervised_keys=None,
|
93 |
+
homepage=_HOMEPAGE_URL,
|
94 |
+
citation=_CITATION,
|
95 |
+
)
|
96 |
+
|
97 |
+
def _split_generators(self, dl_manager):
|
98 |
+
def _base_url(lang1, lang2):
|
99 |
+
return _BASE_URL.format(lang1, lang2)
|
100 |
+
|
101 |
+
download_url = _base_url(self.config.lang1, self.config.lang2)
|
102 |
+
path = dl_manager.download_and_extract(download_url)
|
103 |
+
return [
|
104 |
+
datasets.SplitGenerator(
|
105 |
+
name=datasets.Split.TRAIN,
|
106 |
+
gen_kwargs={"datapath": path},
|
107 |
+
)
|
108 |
+
]
|
109 |
+
|
110 |
+
def _generate_examples(self, datapath):
|
111 |
+
l1, l2 = self.config.lang1, self.config.lang2
|
112 |
+
folder = l1 + "-" + l2
|
113 |
+
l1_file = _BASE_NAME.format(folder, l1)
|
114 |
+
l2_file = _BASE_NAME.format(folder, l2)
|
115 |
+
l1_path = os.path.join(datapath, l1_file)
|
116 |
+
l2_path = os.path.join(datapath, l2_file)
|
117 |
+
with open(l1_path, encoding="utf-8") as f1, open(l2_path, encoding="utf-8") as f2:
|
118 |
+
for sentence_counter, (x, y) in enumerate(zip(f1, f2)):
|
119 |
+
x = x.strip()
|
120 |
+
y = y.strip()
|
121 |
+
result = (
|
122 |
+
sentence_counter,
|
123 |
+
{
|
124 |
+
"id": str(sentence_counter),
|
125 |
+
"translation": {l1: x, l2: y},
|
126 |
+
},
|
127 |
+
)
|
128 |
+
yield result
|