system HF staff commited on
Commit
774e11b
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,162 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ annotations_creators:
3
+ - no-annotation
4
+ language_creators:
5
+ - expert-generated
6
+ - found
7
+ languages:
8
+ - en
9
+ - pl
10
+ - ru
11
+ licenses:
12
+ - unknown
13
+ multilinguality:
14
+ - translation
15
+ size_categories:
16
+ - 10K<n<100K
17
+ source_datasets:
18
+ - original
19
+ task_categories:
20
+ - conditional-text-generation
21
+ task_ids:
22
+ - machine-translation
23
+ ---
24
+
25
+ # Dataset Card for poleval2019_mt
26
+
27
+ ## Table of Contents
28
+ - [Dataset Description](#dataset-description)
29
+ - [Dataset Summary](#dataset-summary)
30
+ - [Supported Tasks](#supported-tasks-and-leaderboards)
31
+ - [Languages](#languages)
32
+ - [Dataset Structure](#dataset-structure)
33
+ - [Data Instances](#data-instances)
34
+ - [Data Fields](#data-fields)
35
+ - [Data Splits](#data-splits)
36
+ - [Dataset Creation](#dataset-creation)
37
+ - [Curation Rationale](#curation-rationale)
38
+ - [Source Data](#source-data)
39
+ - [Annotations](#annotations)
40
+ - [Personal and Sensitive Information](#personal-and-sensitive-information)
41
+ - [Considerations for Using the Data](#considerations-for-using-the-data)
42
+ - [Social Impact of Dataset](#social-impact-of-dataset)
43
+ - [Discussion of Biases](#discussion-of-biases)
44
+ - [Other Known Limitations](#other-known-limitations)
45
+ - [Additional Information](#additional-information)
46
+ - [Dataset Curators](#dataset-curators)
47
+ - [Licensing Information](#licensing-information)
48
+ - [Citation Information](#citation-information)
49
+
50
+ ## Dataset Description
51
+
52
+ - **Homepage:** PolEval-2019 competition. http://2019.poleval.pl/
53
+ - **Repository:** Links available [in this page](http://2019.poleval.pl/index.php/tasks/task4)
54
+ - **Paper:**
55
+ - **Leaderboard:**
56
+ - **Point of Contact:**
57
+
58
+ ### Dataset Summary
59
+
60
+ PolEval is a SemEval-inspired evaluation campaign for natural language processing tools for Polish.
61
+ Submitted solutions compete against one another within certain tasks selected by organizers, using available data and are evaluated according to
62
+ pre-established procedures. One of the tasks in PolEval-2019 was Machine Translation (Task-4).
63
+
64
+ The task is to train as good as possible machine translation system, using any technology,with limited textual resources.
65
+ The competition will be done for 2 language pairs, more popular English-Polish (into Polish direction) and pair that can be called low resourced
66
+ Russian-Polish (in both directions).
67
+
68
+ Here, Polish-English is also made available to allow for training in both directions. However, the test data is ONLY available for English-Polish
69
+
70
+ ### Supported Tasks and Leaderboards
71
+ Supports Machine Translation between Russian to Polish and English to Polish (and vice versa).
72
+
73
+ ### Languages
74
+ - Polish (pl)
75
+ - Russian (ru)
76
+ - English (en)
77
+
78
+ ## Dataset Structure
79
+
80
+ ### Data Instances
81
+ As the training data set, a set of bi-lingual corpora aligned at the sentence level has been prepared. The corpora are saved in UTF-8 encoding as plain text, one language per file.
82
+
83
+ ### Data Fields
84
+ One example of the translation is as below:
85
+ ```
86
+ {
87
+ 'translation': {'ru': 'не содержала в себе моделей. Модели это сравнительно новое явление. ',
88
+ 'pl': 'nie miała w sobie modeli. Modele to względnie nowa dziedzina. Tak więc, jeśli '}
89
+ }
90
+ ```
91
+
92
+ ### Data Splits
93
+
94
+ The dataset is divided into two splits. All the headlines are scraped from news websites on the internet.
95
+ | | Tain | Valid | Test |
96
+ | ----- | ------ | ----- | ----- |
97
+ | ru-pl | 20001 | 3001 | 2969 |
98
+ | pl-ru | 20001 | 3001 | 2969 |
99
+ | en-pl | 129255 | 1000 | 9845 |
100
+
101
+ ## Dataset Creation
102
+
103
+ ### Curation Rationale
104
+
105
+ This data was curated as a task for the PolEval-2019. The task is to train as good as possible machine translation system, using any technology, with limited textual resources. The competition will be done for 2 language pairs, more popular English-Polish (into Polish direction) and pair that can be called low resourced Russian-Polish (in both directions).
106
+
107
+ PolEval is a SemEval-inspired evaluation campaign for natural language processing tools for Polish. Submitted tools compete against one another within certain tasks selected by organizers, using available data and are evaluated according to pre-established procedures.
108
+
109
+ PolEval 2019-related papers were presented at AI & NLP Workshop Day (Warsaw, May 31, 2019).
110
+ The links for the top performing models on various tasks (including the Task-4: Machine Translation) is present in [this](http://2019.poleval.pl/index.php/publication) link
111
+
112
+ ### Source Data
113
+
114
+ #### Initial Data Collection and Normalization
115
+
116
+ [More Information Needed]
117
+
118
+ #### Who are the source language producers?
119
+
120
+ The organization details of PolEval is present in this [link](http://2019.poleval.pl/index.php/organizers)
121
+
122
+ ### Annotations
123
+
124
+ #### Annotation process
125
+
126
+ [More Information Needed]
127
+
128
+ #### Who are the annotators?
129
+
130
+ [More Information Needed]
131
+
132
+ ### Personal and Sensitive Information
133
+
134
+ [More Information Needed]
135
+
136
+ ## Considerations for Using the Data
137
+
138
+ ### Social Impact of Dataset
139
+
140
+ [More Information Needed]
141
+
142
+ ### Discussion of Biases
143
+
144
+ [More Information Needed]
145
+
146
+ ### Other Known Limitations
147
+
148
+ [More Information Needed]
149
+
150
+ ## Additional Information
151
+
152
+ ### Dataset Curators
153
+
154
+ [More Information Needed]
155
+
156
+ ### Licensing Information
157
+
158
+ [More Information Needed]
159
+
160
+ ### Citation Information
161
+
162
+ [More Information Needed]
dataset_infos.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"ru-pl": {"description": "PolEval is a SemEval-inspired evaluation campaign for natural language processing tools for Polish.Submitted solutions compete against one another within certain tasks selected by organizers, using available data and are evaluated according topre-established procedures. One of the tasks in PolEval-2019 was Machine Translation (Task-4).\nThe task is to train as good as possible machine translation system, using any technology,with limited textual resources.The competition will be done for 2 language pairs, more popular English-Polish (into Polish direction) and pair that can be called low resourcedRussian-Polish (in both directions).\n\nHere, Polish-English is also made available to allow for training in both directions. However, the test data is ONLY available for English-Polish.\n", "citation": "", "homepage": "http://2019.poleval.pl/", "license": "", "features": {"translation": {"languages": ["ru", "pl"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": {"input": "ru", "output": "pl"}, "builder_name": "poleval2019_mt", "config_name": "ru-pl", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 2818015, "num_examples": 20001, "dataset_name": "poleval2019_mt"}, "validation": {"name": "validation", "num_bytes": 415735, "num_examples": 3001, "dataset_name": "poleval2019_mt"}, "test": {"name": "test", "num_bytes": 266462, "num_examples": 2969, "dataset_name": "poleval2019_mt"}}, "download_checksums": {"https://drive.google.com/u/0/uc?id=1H7FphKVVCYoH49sUXl79CuztEfJLaKoF&export=download": {"num_bytes": 1694494, "checksum": "3541f2fff61692d64ec696227ca80155b0a3b731f1586d470ae0f2138f91d90d"}, "https://drive.google.com/u/0/uc?id=11EBGHMAswT5JDO60xh7gnZfYjpMQs7h7&export=download": {"num_bytes": 1003489, "checksum": "e0277b2f5f29114343ffecfa38d80ec77e0f5af13196f513a8ba3714a1b41cd4"}, "https://drive.google.com/u/0/uc?id=1-z09ntfDYo6j3TBTpxqu6htE_a7IAWte&export=download": {"num_bytes": 248747, "checksum": "41f031d2241a80ee80142c6160811359300ab91e2747dcac78fef243a95d70e5"}, "https://drive.google.com/u/0/uc?id=1mwx_zyQeTZzkXEWMPoj4yghcbFq4ETWx&export=download": {"num_bytes": 148972, "checksum": "4c00dba31b91abb4f3c6f349c252a71d23deac2756c4f5a1a549fb81c1363cbd"}, "http://2019.poleval.pl/task4/task4_test.zip": {"num_bytes": 260099, "checksum": "f39fb82abff6f00098c21f7a2890fbc4af27c7f51d509434140893ffce683523"}}, "download_size": 3355801, "post_processing_size": null, "dataset_size": 3500212, "size_in_bytes": 6856013}, "en-pl": {"description": "PolEval is a SemEval-inspired evaluation campaign for natural language processing tools for Polish.Submitted solutions compete against one another within certain tasks selected by organizers, using available data and are evaluated according topre-established procedures. One of the tasks in PolEval-2019 was Machine Translation (Task-4).\nThe task is to train as good as possible machine translation system, using any technology,with limited textual resources.The competition will be done for 2 language pairs, more popular English-Polish (into Polish direction) and pair that can be called low resourcedRussian-Polish (in both directions).\n\nHere, Polish-English is also made available to allow for training in both directions. However, the test data is ONLY available for English-Polish.\n", "citation": "", "homepage": "http://2019.poleval.pl/", "license": "", "features": {"translation": {"languages": ["en", "pl"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": {"input": "en", "output": "pl"}, "builder_name": "poleval2019_mt", "config_name": "en-pl", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 13217798, "num_examples": 129255, "dataset_name": "poleval2019_mt"}, "validation": {"name": "validation", "num_bytes": 1209168, "num_examples": 10001, "dataset_name": "poleval2019_mt"}, "test": {"name": "test", "num_bytes": 562482, "num_examples": 9845, "dataset_name": "poleval2019_mt"}}, "download_checksums": {"https://drive.google.com/u/0/uc?id=1NAeuWLgYBzLwU5jCdkrtj4_PRUocuvlb&export=download": {"num_bytes": 6162555, "checksum": "ac588018e011d6b0460267e6fcff2fc5410bbf2e1a17d17f397a0ecfea529fad"}, "https://drive.google.com/u/0/uc?id=13ZyFc2qepAYSg9WIFaeJ9y402gblsl2e&export=download": {"num_bytes": 6279607, "checksum": "61413e42c48bf553b5f5e6a67410098844252e07f04629044ce143354f737ca0"}, "https://drive.google.com/u/0/uc?id=1L6qQiO6kPLFj8BUK9XFNUH7bNyJVA7FC&export=download": {"num_bytes": 563687, "checksum": "cac86645e00ed8fc5b770f808f4fa14038c19d7cd8690e52d976125b9319da97"}, "https://drive.google.com/u/0/uc?id=1CP3oHL04qE1nfu3h_zmaxz5fmEtlwzLs&export=download": {"num_bytes": 585457, "checksum": "b5d95b7ef0f9b27d74100a4e97cab29f6fd7fd0758ab8871b5d54f6cdee71b50"}, "http://2019.poleval.pl/task4/task4_test.zip": {"num_bytes": 260099, "checksum": "f39fb82abff6f00098c21f7a2890fbc4af27c7f51d509434140893ffce683523"}}, "download_size": 13851405, "post_processing_size": null, "dataset_size": 14989448, "size_in_bytes": 28840853}, "pl-ru": {"description": "PolEval is a SemEval-inspired evaluation campaign for natural language processing tools for Polish.Submitted solutions compete against one another within certain tasks selected by organizers, using available data and are evaluated according topre-established procedures. One of the tasks in PolEval-2019 was Machine Translation (Task-4).\nThe task is to train as good as possible machine translation system, using any technology,with limited textual resources.The competition will be done for 2 language pairs, more popular English-Polish (into Polish direction) and pair that can be called low resourcedRussian-Polish (in both directions).\n\nHere, Polish-English is also made available to allow for training in both directions. However, the test data is ONLY available for English-Polish.\n", "citation": "", "homepage": "http://2019.poleval.pl/", "license": "", "features": {"translation": {"languages": ["pl", "ru"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": {"input": "pl", "output": "ru"}, "builder_name": "poleval2019_mt", "config_name": "pl-ru", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 2818015, "num_examples": 20001, "dataset_name": "poleval2019_mt"}, "validation": {"name": "validation", "num_bytes": 415735, "num_examples": 3001, "dataset_name": "poleval2019_mt"}, "test": {"name": "test", "num_bytes": 149423, "num_examples": 2967, "dataset_name": "poleval2019_mt"}}, "download_checksums": {"https://drive.google.com/u/0/uc?id=11EBGHMAswT5JDO60xh7gnZfYjpMQs7h7&export=download": {"num_bytes": 1003489, "checksum": "e0277b2f5f29114343ffecfa38d80ec77e0f5af13196f513a8ba3714a1b41cd4"}, "https://drive.google.com/u/0/uc?id=1H7FphKVVCYoH49sUXl79CuztEfJLaKoF&export=download": {"num_bytes": 1694494, "checksum": "3541f2fff61692d64ec696227ca80155b0a3b731f1586d470ae0f2138f91d90d"}, "https://drive.google.com/u/0/uc?id=1mwx_zyQeTZzkXEWMPoj4yghcbFq4ETWx&export=download": {"num_bytes": 148972, "checksum": "4c00dba31b91abb4f3c6f349c252a71d23deac2756c4f5a1a549fb81c1363cbd"}, "https://drive.google.com/u/0/uc?id=1-z09ntfDYo6j3TBTpxqu6htE_a7IAWte&export=download": {"num_bytes": 248747, "checksum": "41f031d2241a80ee80142c6160811359300ab91e2747dcac78fef243a95d70e5"}, "http://2019.poleval.pl/task4/task4_test.zip": {"num_bytes": 260099, "checksum": "f39fb82abff6f00098c21f7a2890fbc4af27c7f51d509434140893ffce683523"}}, "download_size": 3355801, "post_processing_size": null, "dataset_size": 3383173, "size_in_bytes": 6738974}, "pl-en": {"description": "PolEval is a SemEval-inspired evaluation campaign for natural language processing tools for Polish.Submitted solutions compete against one another within certain tasks selected by organizers, using available data and are evaluated according topre-established procedures. One of the tasks in PolEval-2019 was Machine Translation (Task-4).\nThe task is to train as good as possible machine translation system, using any technology,with limited textual resources.The competition will be done for 2 language pairs, more popular English-Polish (into Polish direction) and pair that can be called low resourcedRussian-Polish (in both directions).\n\nHere, Polish-English is also made available to allow for training in both directions. However, the test data is ONLY available for English-Polish.\n", "citation": "", "homepage": "http://2019.poleval.pl/", "license": "", "features": {"translation": {"languages": ["pl", "en"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": {"input": "pl", "output": "en"}, "builder_name": "poleval2019_mt", "config_name": "pl-en", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 13217798, "num_examples": 129255, "dataset_name": "poleval2019_mt"}, "validation": {"name": "validation", "num_bytes": 1209168, "num_examples": 10001, "dataset_name": "poleval2019_mt"}, "test": {"name": "test", "num_bytes": 16, "num_examples": 1, "dataset_name": "poleval2019_mt"}}, "download_checksums": {"https://drive.google.com/u/0/uc?id=13ZyFc2qepAYSg9WIFaeJ9y402gblsl2e&export=download": {"num_bytes": 6279607, "checksum": "61413e42c48bf553b5f5e6a67410098844252e07f04629044ce143354f737ca0"}, "https://drive.google.com/u/0/uc?id=1NAeuWLgYBzLwU5jCdkrtj4_PRUocuvlb&export=download": {"num_bytes": 6162555, "checksum": "ac588018e011d6b0460267e6fcff2fc5410bbf2e1a17d17f397a0ecfea529fad"}, "https://drive.google.com/u/0/uc?id=1CP3oHL04qE1nfu3h_zmaxz5fmEtlwzLs&export=download": {"num_bytes": 585457, "checksum": "b5d95b7ef0f9b27d74100a4e97cab29f6fd7fd0758ab8871b5d54f6cdee71b50"}, "https://drive.google.com/u/0/uc?id=1L6qQiO6kPLFj8BUK9XFNUH7bNyJVA7FC&export=download": {"num_bytes": 563687, "checksum": "cac86645e00ed8fc5b770f808f4fa14038c19d7cd8690e52d976125b9319da97"}}, "download_size": 13591306, "post_processing_size": null, "dataset_size": 14426982, "size_in_bytes": 28018288}}
dummy/en-pl/1.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:812cdbd5a510d58df3111c4287976406d66f8ac88c23440b1f7efce9207449db
3
+ size 2968
dummy/pl-en/1.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f739f9876d5b66d35972336ad4a8baed90c758cc7af92f9eea1fd645a2176fce
3
+ size 1510
dummy/pl-ru/1.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2bc509984867c02081fdb687dddaf5b6f19941c5e19ea944a1397c857f7a4475
3
+ size 3411
dummy/ru-pl/1.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:00975bf1eae885e3d9baf49d97836f2ca16e15848798e63280b989af29d102d6
3
+ size 3411
poleval2019_mt.py ADDED
@@ -0,0 +1,198 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
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
+ """Poleval 2019 dataset for Polish Translation"""
16
+
17
+ from __future__ import absolute_import, division, print_function
18
+
19
+ import os
20
+
21
+ import datasets
22
+
23
+
24
+ # Find for instance the citation on arxiv or on the dataset repo/website
25
+ _CITATION = ""
26
+
27
+
28
+ _DESCRIPTION = """\
29
+ PolEval is a SemEval-inspired evaluation campaign for natural language processing tools for Polish.\
30
+ Submitted solutions compete against one another within certain tasks selected by organizers, using available data and are evaluated according to\
31
+ pre-established procedures. One of the tasks in PolEval-2019 was Machine Translation (Task-4).\
32
+
33
+ The task is to train as good as possible machine translation system, using any technology,with limited textual resources.\
34
+ The competition will be done for 2 language pairs, more popular English-Polish (into Polish direction) and pair that can be called low resourced\
35
+ Russian-Polish (in both directions).
36
+
37
+ Here, Polish-English is also made available to allow for training in both directions. However, the test data is ONLY available for English-Polish.
38
+ """
39
+
40
+ # Official homepage for the dataset
41
+ _HOMEPAGE = "http://2019.poleval.pl/"
42
+
43
+ # Licence
44
+ _LICENSE = ""
45
+
46
+ # All the urls for train data download
47
+ _TRAIN_URL = {
48
+ "ru-pl": {
49
+ "dev.pl": "https://drive.google.com/u/0/uc?id=1mwx_zyQeTZzkXEWMPoj4yghcbFq4ETWx&export=download",
50
+ "dev.ru": "https://drive.google.com/u/0/uc?id=1-z09ntfDYo6j3TBTpxqu6htE_a7IAWte&export=download",
51
+ "train.pl": "https://drive.google.com/u/0/uc?id=11EBGHMAswT5JDO60xh7gnZfYjpMQs7h7&export=download",
52
+ "train.ru": "https://drive.google.com/u/0/uc?id=1H7FphKVVCYoH49sUXl79CuztEfJLaKoF&export=download",
53
+ },
54
+ "en-pl": {
55
+ "dev.en": "https://drive.google.com/u/0/uc?id=1L6qQiO6kPLFj8BUK9XFNUH7bNyJVA7FC&export=download",
56
+ "dev.pl": "https://drive.google.com/u/0/uc?id=1CP3oHL04qE1nfu3h_zmaxz5fmEtlwzLs&export=download",
57
+ "train.en": "https://drive.google.com/u/0/uc?id=1NAeuWLgYBzLwU5jCdkrtj4_PRUocuvlb&export=download",
58
+ "train.pl": "https://drive.google.com/u/0/uc?id=13ZyFc2qepAYSg9WIFaeJ9y402gblsl2e&export=download",
59
+ },
60
+ }
61
+
62
+
63
+ # All the tsv files are present in the below link.
64
+ _TEST_URL = "http://2019.poleval.pl/task4/task4_test.zip"
65
+
66
+ # These are the supported languages in the parallel corpora in the PolEval-2019 MT task
67
+ _SUPPORTED_LANGUAGES = {
68
+ "ru": "Russian",
69
+ "en": "English",
70
+ }
71
+
72
+
73
+ class PolevalMTConfig(datasets.BuilderConfig):
74
+ """BuilderConfig for PolEval-2019 MT corpus."""
75
+
76
+ def __init__(self, language_pair=(None, None), **kwargs):
77
+ """BuilderConfig for PolEval-2019.
78
+ Args:
79
+ for the `datasets.features.text.TextEncoder` used for the features feature.
80
+ language_pair: pair of languages that will be used for translation. Should
81
+ contain 2-letter coded strings. First will be used at source and second
82
+ as target in supervised mode. For example: ("pl", "en").
83
+ **kwargs: keyword arguments forwarded to super.
84
+ """
85
+ # Validate language pair.
86
+ name = "%s-%s" % (language_pair[0], language_pair[1])
87
+ assert "pl" in language_pair, ("Config language pair must contain `pl` (Polish), got: %s", language_pair)
88
+ source, target = language_pair
89
+ non_pl = source if target == "pl" else target
90
+ assert non_pl in _SUPPORTED_LANGUAGES.keys(), ("Invalid non-polish language in pair: %s", non_pl)
91
+
92
+ description = ("Translation dataset between Polish and %s") % (_SUPPORTED_LANGUAGES[non_pl])
93
+ super(PolevalMTConfig, self).__init__(
94
+ name=name,
95
+ description=description,
96
+ version=datasets.Version("1.0.0", ""),
97
+ **kwargs,
98
+ )
99
+
100
+ self.language_pair = language_pair
101
+
102
+
103
+ class Poleval2019Mt(datasets.GeneratorBasedBuilder):
104
+ """Polish Translation Dataset"""
105
+
106
+ BUILDER_CONFIGS = [PolevalMTConfig(language_pair=(key, "pl")) for key, val in _SUPPORTED_LANGUAGES.items()] + [
107
+ PolevalMTConfig(language_pair=("pl", key)) for key, val in _SUPPORTED_LANGUAGES.items()
108
+ ]
109
+
110
+ def _info(self):
111
+ source, target = self.config.language_pair
112
+ return datasets.DatasetInfo(
113
+ description=_DESCRIPTION,
114
+ features=datasets.Features(
115
+ {"translation": datasets.features.Translation(languages=self.config.language_pair)}
116
+ ),
117
+ supervised_keys=(source, target),
118
+ homepage=_HOMEPAGE,
119
+ citation=_CITATION,
120
+ )
121
+
122
+ def _split_generators(self, dl_manager):
123
+ source, target = self.config.language_pair
124
+
125
+ if "en" in self.config.language_pair:
126
+ urls = _TRAIN_URL["en-pl"]
127
+ else:
128
+ urls = _TRAIN_URL["ru-pl"]
129
+
130
+ # Test path templates
131
+ test_tmpl = "tst_to_{target}.{source}" # Hardcode alert
132
+
133
+ files = {}
134
+ for split in ("train", "dev"):
135
+ dl_file_src = dl_manager.download_and_extract(urls[split + "." + source])
136
+ dl_file_dst = dl_manager.download_and_extract(urls[split + "." + target])
137
+
138
+ files[split] = {
139
+ "source_file": dl_file_src,
140
+ "target_file": dl_file_dst,
141
+ "split": split,
142
+ }
143
+
144
+ # To handle test split when english is the target language.
145
+ # This is because there is no Polish to English test file that is available in the default set
146
+ if "en" == source:
147
+ dl_dir_test = dl_manager.download_and_extract(_TEST_URL)
148
+ test_file = os.path.join(dl_dir_test, "task4_test", "tst.en")
149
+ elif "en" == target:
150
+ test_file = ""
151
+ else:
152
+ dl_dir_test = dl_manager.download_and_extract(_TEST_URL)
153
+ test_file = os.path.join(dl_dir_test, "task4_test", test_tmpl.format(target=target.upper(), source=source))
154
+
155
+ files["test"] = {"source_file": test_file, "target_file": "", "split": "test"}
156
+
157
+ return [
158
+ datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs=files["train"]),
159
+ datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs=files["dev"]),
160
+ datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs=files["test"]),
161
+ ]
162
+
163
+ def _generate_examples(self, source_file, target_file, split):
164
+ """This function returns the examples in the raw (text) form."""
165
+ source, target = self.config.language_pair
166
+
167
+ # Returning an empty source and target just to handle the test file absence when English is the target
168
+ if split == "test":
169
+ if target == "en":
170
+ # Returning dummy info
171
+ result = {"translation": {source: "", target: ""}}
172
+ yield 0, result
173
+ else: # Handling cases for Polish and Russian languages
174
+ with open(source_file, encoding="utf-8") as f:
175
+ source_sentences = f.read().split("\n")
176
+
177
+ for idx, sent in enumerate(source_sentences):
178
+ if sent.strip() != "":
179
+ result = {"translation": {source: sent, target: ""}}
180
+ yield idx, result
181
+ else:
182
+ # Training and Dev sets examples
183
+ with open(source_file, encoding="utf-8") as f:
184
+ source_sentences = f.read().split("\n")
185
+ with open(target_file, encoding="utf-8") as f:
186
+ target_sentences = f.read().split("\n")
187
+
188
+ assert len(target_sentences) == len(source_sentences), "Sizes do not match: %d vs %d for %s vs %s." % (
189
+ len(source_sentences),
190
+ len(target_sentences),
191
+ source_file,
192
+ target_file,
193
+ )
194
+
195
+ for idx, (l1, l2) in enumerate(zip(source_sentences, target_sentences)):
196
+ result = {"translation": {source: l1, target: l2}}
197
+ # Make sure that both translations are non-empty.
198
+ yield idx, result