Commit
•
98dfa9f
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 +167 -0
- dataset_infos.json +1 -0
- dummy/bg-el/3.0.0/dummy_data.zip +3 -0
- dummy/cs-et/3.0.0/dummy_data.zip +3 -0
- dummy/de-mt/3.0.0/dummy_data.zip +3 -0
- dummy/es-lt/3.0.0/dummy_data.zip +3 -0
- dummy/fr-sk/3.0.0/dummy_data.zip +3 -0
- emea.py +119 -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,167 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
annotations_creators:
|
3 |
+
- found
|
4 |
+
language_creators:
|
5 |
+
- found
|
6 |
+
languages:
|
7 |
+
- bg
|
8 |
+
- cs
|
9 |
+
- da
|
10 |
+
- de
|
11 |
+
- el
|
12 |
+
- en
|
13 |
+
- es
|
14 |
+
- et
|
15 |
+
- fi
|
16 |
+
- fr
|
17 |
+
- hu
|
18 |
+
- it
|
19 |
+
- lt
|
20 |
+
- lv
|
21 |
+
- mt
|
22 |
+
- nl
|
23 |
+
- pl
|
24 |
+
- pt
|
25 |
+
- ro
|
26 |
+
- sk
|
27 |
+
- sl
|
28 |
+
- sv
|
29 |
+
licenses:
|
30 |
+
- unknown
|
31 |
+
multilinguality:
|
32 |
+
- multilingual
|
33 |
+
size_categories:
|
34 |
+
- n>1M
|
35 |
+
source_datasets:
|
36 |
+
- original
|
37 |
+
task_categories:
|
38 |
+
- conditional-text-generation
|
39 |
+
task_ids:
|
40 |
+
- machine-translation
|
41 |
+
---
|
42 |
+
|
43 |
+
# Dataset Card Creation Guide
|
44 |
+
|
45 |
+
## Table of Contents
|
46 |
+
- [Dataset Description](#dataset-description)
|
47 |
+
- [Dataset Summary](#dataset-summary)
|
48 |
+
- [Supported Tasks](#supported-tasks-and-leaderboards)
|
49 |
+
- [Languages](#languages)
|
50 |
+
- [Dataset Structure](#dataset-structure)
|
51 |
+
- [Data Instances](#data-instances)
|
52 |
+
- [Data Fields](#data-instances)
|
53 |
+
- [Data Splits](#data-instances)
|
54 |
+
- [Dataset Creation](#dataset-creation)
|
55 |
+
- [Curation Rationale](#curation-rationale)
|
56 |
+
- [Source Data](#source-data)
|
57 |
+
- [Annotations](#annotations)
|
58 |
+
- [Personal and Sensitive Information](#personal-and-sensitive-information)
|
59 |
+
- [Considerations for Using the Data](#considerations-for-using-the-data)
|
60 |
+
- [Social Impact of Dataset](#social-impact-of-dataset)
|
61 |
+
- [Discussion of Biases](#discussion-of-biases)
|
62 |
+
- [Other Known Limitations](#other-known-limitations)
|
63 |
+
- [Additional Information](#additional-information)
|
64 |
+
- [Dataset Curators](#dataset-curators)
|
65 |
+
- [Licensing Information](#licensing-information)
|
66 |
+
- [Citation Information](#citation-information)
|
67 |
+
|
68 |
+
## Dataset Description
|
69 |
+
|
70 |
+
- **Homepage:** http://opus.nlpl.eu/EMEA.php
|
71 |
+
- **Repository:** None
|
72 |
+
- **Paper:** http://www.lrec-conf.org/proceedings/lrec2012/pdf/463_Paper.pdf
|
73 |
+
- **Leaderboard:** [More Information Needed]
|
74 |
+
- **Point of Contact:** [More Information Needed]
|
75 |
+
|
76 |
+
### Dataset Summary
|
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/EMEA.php
|
80 |
+
E.g.
|
81 |
+
|
82 |
+
`dataset = load_dataset("emea", lang1="en", lang2="nl")`
|
83 |
+
|
84 |
+
### Supported Tasks and Leaderboards
|
85 |
+
|
86 |
+
[More Information Needed]
|
87 |
+
|
88 |
+
### Languages
|
89 |
+
|
90 |
+
[More Information Needed]
|
91 |
+
|
92 |
+
## Dataset Structure
|
93 |
+
|
94 |
+
### Data Instances
|
95 |
+
|
96 |
+
Here are some examples of questions and facts:
|
97 |
+
|
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 |
+
[More Information Needed]
|
dataset_infos.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"bg-el": {"description": "This is a parallel corpus made out of PDF documents from the European Medicines Agency. All files are automatically converted from PDF to plain text using pdftotext with the command line arguments -layout -nopgbrk -eol unix. There are some known problems with tables and multi-column layouts - some of them are fixed in the current version.\n\nsource: http://www.emea.europa.eu/\n\n22 languages, 231 bitexts\ntotal number of files: 41,957\ntotal number of tokens: 311.65M\ntotal number of sentence fragments: 26.51M\n", "citation": "J. Tiedemann, 2012, Parallel Data, Tools and Interfaces in OPUS. In Proceedings of the 8th International Conference on Language Resources and Evaluation (LREC 2012)\n", "homepage": "http://opus.nlpl.eu/EMEA.php", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "translation": {"languages": ["bg", "el"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": null, "builder_name": "emea", "config_name": "bg-el", "version": {"version_str": "3.0.0", "description": "", "major": 3, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 296160562, "num_examples": 1044065, "dataset_name": "emea"}}, "download_checksums": {"https://object.pouta.csc.fi/OPUS-EMEA/v3/moses/bg-el.txt.zip": {"num_bytes": 54531690, "checksum": "c2491d7fd2a04131ba4079aa74464907fdf37958cb1610e504e9dc4708d27f4f"}}, "download_size": 54531690, "post_processing_size": null, "dataset_size": 296160562, "size_in_bytes": 350692252}, "cs-et": {"description": "This is a parallel corpus made out of PDF documents from the European Medicines Agency. All files are automatically converted from PDF to plain text using pdftotext with the command line arguments -layout -nopgbrk -eol unix. There are some known problems with tables and multi-column layouts - some of them are fixed in the current version.\n\nsource: http://www.emea.europa.eu/\n\n22 languages, 231 bitexts\ntotal number of files: 41,957\ntotal number of tokens: 311.65M\ntotal number of sentence fragments: 26.51M\n", "citation": "J. Tiedemann, 2012, Parallel Data, Tools and Interfaces in OPUS. In Proceedings of the 8th International Conference on Language Resources and Evaluation (LREC 2012)\n", "homepage": "http://opus.nlpl.eu/EMEA.php", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "translation": {"languages": ["cs", "et"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": null, "builder_name": "emea", "config_name": "cs-et", "version": {"version_str": "3.0.0", "description": "", "major": 3, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 180261167, "num_examples": 1053164, "dataset_name": "emea"}}, "download_checksums": {"https://object.pouta.csc.fi/OPUS-EMEA/v3/moses/cs-et.txt.zip": {"num_bytes": 36065651, "checksum": "8d0389456e40a77df0ccb2602b60a99bdce7d175f4cb2cb56be91b8f466a10b4"}}, "download_size": 36065651, "post_processing_size": null, "dataset_size": 180261167, "size_in_bytes": 216326818}, "de-mt": {"description": "This is a parallel corpus made out of PDF documents from the European Medicines Agency. All files are automatically converted from PDF to plain text using pdftotext with the command line arguments -layout -nopgbrk -eol unix. There are some known problems with tables and multi-column layouts - some of them are fixed in the current version.\n\nsource: http://www.emea.europa.eu/\n\n22 languages, 231 bitexts\ntotal number of files: 41,957\ntotal number of tokens: 311.65M\ntotal number of sentence fragments: 26.51M\n", "citation": "J. Tiedemann, 2012, Parallel Data, Tools and Interfaces in OPUS. In Proceedings of the 8th International Conference on Language Resources and Evaluation (LREC 2012)\n", "homepage": "http://opus.nlpl.eu/EMEA.php", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "translation": {"languages": ["de", "mt"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": null, "builder_name": "emea", "config_name": "de-mt", "version": {"version_str": "3.0.0", "description": "", "major": 3, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 182976918, "num_examples": 1000532, "dataset_name": "emea"}}, "download_checksums": {"https://object.pouta.csc.fi/OPUS-EMEA/v3/moses/de-mt.txt.zip": {"num_bytes": 36665427, "checksum": "da2ebcbdc6028717b7dc23450e3d3b10a029da1a2aa9544920982d6dc7971d6b"}}, "download_size": 36665427, "post_processing_size": null, "dataset_size": 182976918, "size_in_bytes": 219642345}, "fr-sk": {"description": "This is a parallel corpus made out of PDF documents from the European Medicines Agency. All files are automatically converted from PDF to plain text using pdftotext with the command line arguments -layout -nopgbrk -eol unix. There are some known problems with tables and multi-column layouts - some of them are fixed in the current version.\n\nsource: http://www.emea.europa.eu/\n\n22 languages, 231 bitexts\ntotal number of files: 41,957\ntotal number of tokens: 311.65M\ntotal number of sentence fragments: 26.51M\n", "citation": "J. Tiedemann, 2012, Parallel Data, Tools and Interfaces in OPUS. In Proceedings of the 8th International Conference on Language Resources and Evaluation (LREC 2012)\n", "homepage": "http://opus.nlpl.eu/EMEA.php", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "translation": {"languages": ["fr", "sk"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": null, "builder_name": "emea", "config_name": "fr-sk", "version": {"version_str": "3.0.0", "description": "", "major": 3, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 193605247, "num_examples": 1062753, "dataset_name": "emea"}}, "download_checksums": {"https://object.pouta.csc.fi/OPUS-EMEA/v3/moses/fr-sk.txt.zip": {"num_bytes": 38916074, "checksum": "3da070454acc7ab70b32898adb733b2351f604d2b32c5f4357f5950eab926a3a"}}, "download_size": 38916074, "post_processing_size": null, "dataset_size": 193605247, "size_in_bytes": 232521321}, "es-lt": {"description": "This is a parallel corpus made out of PDF documents from the European Medicines Agency. All files are automatically converted from PDF to plain text using pdftotext with the command line arguments -layout -nopgbrk -eol unix. There are some known problems with tables and multi-column layouts - some of them are fixed in the current version.\n\nsource: http://www.emea.europa.eu/\n\n22 languages, 231 bitexts\ntotal number of files: 41,957\ntotal number of tokens: 311.65M\ntotal number of sentence fragments: 26.51M\n", "citation": "J. Tiedemann, 2012, Parallel Data, Tools and Interfaces in OPUS. In Proceedings of the 8th International Conference on Language Resources and Evaluation (LREC 2012)\n", "homepage": "http://opus.nlpl.eu/EMEA.php", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "translation": {"languages": ["es", "lt"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": null, "builder_name": "emea", "config_name": "es-lt", "version": {"version_str": "3.0.0", "description": "", "major": 3, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 182623676, "num_examples": 1051370, "dataset_name": "emea"}}, "download_checksums": {"https://object.pouta.csc.fi/OPUS-EMEA/v3/moses/es-lt.txt.zip": {"num_bytes": 35329033, "checksum": "02fe4b58829bdf3915dd18f1cde646f3d2a518f1d858acff7bc543362c897151"}}, "download_size": 35329033, "post_processing_size": null, "dataset_size": 182623676, "size_in_bytes": 217952709}}
|
dummy/bg-el/3.0.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:813296caed6a26371b86822e76654e751b9d4539d80b7dc4094d3800105c4752
|
3 |
+
size 893
|
dummy/cs-et/3.0.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e98289efc71e1f1bf651dcb4ac8da2c21f84624df0eab783a839ff107cfc47ae
|
3 |
+
size 795
|
dummy/de-mt/3.0.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:83a9f02cd28aa5275c8acca1889db83f74088b5ce81d0c56c98009e18896afbd
|
3 |
+
size 827
|
dummy/es-lt/3.0.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d586091feaf67b8f6b3fd1d782e2ef4154283838f8804267fec7a0c87f41dfc9
|
3 |
+
size 811
|
dummy/fr-sk/3.0.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e7b72c5056e0046d39c56dbc7ac7fbd1fd10fc3048a6ddf008ba2ff83731a8ee
|
3 |
+
size 819
|
emea.py
ADDED
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 parallel corpus made out of PDF documents from the European Medicines Agency. All files are automatically converted from PDF to plain text using pdftotext with the command line arguments -layout -nopgbrk -eol unix. There are some known problems with tables and multi-column layouts - some of them are fixed in the current version.
|
24 |
+
|
25 |
+
source: http://www.emea.europa.eu/
|
26 |
+
|
27 |
+
22 languages, 231 bitexts
|
28 |
+
total number of files: 41,957
|
29 |
+
total number of tokens: 311.65M
|
30 |
+
total number of sentence fragments: 26.51M
|
31 |
+
"""
|
32 |
+
_HOMEPAGE_URL = "http://opus.nlpl.eu/EMEA.php"
|
33 |
+
_CITATION = """\
|
34 |
+
J. Tiedemann, 2012, Parallel Data, Tools and Interfaces in OPUS. In Proceedings of the 8th International Conference on Language Resources and Evaluation (LREC 2012)
|
35 |
+
"""
|
36 |
+
|
37 |
+
_VERSION = "3.0.0"
|
38 |
+
_BASE_NAME = "EMEA.{}.{}"
|
39 |
+
_BASE_URL = "https://object.pouta.csc.fi/OPUS-EMEA/v3/moses/{}-{}.txt.zip"
|
40 |
+
|
41 |
+
# Please note that only few pairs are shown here. You can use config to generate data for all language pairs
|
42 |
+
_LANGUAGE_PAIRS = [
|
43 |
+
("bg", "el"),
|
44 |
+
("cs", "et"),
|
45 |
+
("de", "mt"),
|
46 |
+
("fr", "sk"),
|
47 |
+
("es", "lt"),
|
48 |
+
]
|
49 |
+
|
50 |
+
|
51 |
+
class EmeaConfig(datasets.BuilderConfig):
|
52 |
+
def __init__(self, *args, lang1=None, lang2=None, **kwargs):
|
53 |
+
super().__init__(
|
54 |
+
*args,
|
55 |
+
name=f"{lang1}-{lang2}",
|
56 |
+
**kwargs,
|
57 |
+
)
|
58 |
+
self.lang1 = lang1
|
59 |
+
self.lang2 = lang2
|
60 |
+
|
61 |
+
|
62 |
+
class Emea(datasets.GeneratorBasedBuilder):
|
63 |
+
BUILDER_CONFIGS = [
|
64 |
+
EmeaConfig(
|
65 |
+
lang1=lang1,
|
66 |
+
lang2=lang2,
|
67 |
+
description=f"Translating {lang1} to {lang2} or vice versa",
|
68 |
+
version=datasets.Version(_VERSION),
|
69 |
+
)
|
70 |
+
for lang1, lang2 in _LANGUAGE_PAIRS
|
71 |
+
]
|
72 |
+
BUILDER_CONFIG_CLASS = EmeaConfig
|
73 |
+
|
74 |
+
def _info(self):
|
75 |
+
return datasets.DatasetInfo(
|
76 |
+
description=_DESCRIPTION,
|
77 |
+
features=datasets.Features(
|
78 |
+
{
|
79 |
+
"id": datasets.Value("string"),
|
80 |
+
"translation": datasets.Translation(languages=(self.config.lang1, self.config.lang2)),
|
81 |
+
},
|
82 |
+
),
|
83 |
+
supervised_keys=None,
|
84 |
+
homepage=_HOMEPAGE_URL,
|
85 |
+
citation=_CITATION,
|
86 |
+
)
|
87 |
+
|
88 |
+
def _split_generators(self, dl_manager):
|
89 |
+
def _base_url(lang1, lang2):
|
90 |
+
return _BASE_URL.format(lang1, lang2)
|
91 |
+
|
92 |
+
download_url = _base_url(self.config.lang1, self.config.lang2)
|
93 |
+
path = dl_manager.download_and_extract(download_url)
|
94 |
+
return [
|
95 |
+
datasets.SplitGenerator(
|
96 |
+
name=datasets.Split.TRAIN,
|
97 |
+
gen_kwargs={"datapath": path},
|
98 |
+
)
|
99 |
+
]
|
100 |
+
|
101 |
+
def _generate_examples(self, datapath):
|
102 |
+
l1, l2 = self.config.lang1, self.config.lang2
|
103 |
+
folder = l1 + "-" + l2
|
104 |
+
l1_file = _BASE_NAME.format(folder, l1)
|
105 |
+
l2_file = _BASE_NAME.format(folder, l2)
|
106 |
+
l1_path = os.path.join(datapath, l1_file)
|
107 |
+
l2_path = os.path.join(datapath, l2_file)
|
108 |
+
with open(l1_path, encoding="utf-8") as f1, open(l2_path, encoding="utf-8") as f2:
|
109 |
+
for sentence_counter, (x, y) in enumerate(zip(f1, f2)):
|
110 |
+
x = x.strip()
|
111 |
+
y = y.strip()
|
112 |
+
result = (
|
113 |
+
sentence_counter,
|
114 |
+
{
|
115 |
+
"id": str(sentence_counter),
|
116 |
+
"translation": {l1: x, l2: y},
|
117 |
+
},
|
118 |
+
)
|
119 |
+
yield result
|