Datasets:
Commit
•
45d2403
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 +251 -0
- dataset_infos.json +1 -0
- dummy/plain_text/1.1.0/dummy_data.zip +3 -0
- wmt20_mlqe_task3.py +248 -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,251 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
annotations_creators:
|
3 |
+
- expert-generated
|
4 |
+
- machine-generated
|
5 |
+
language_creators:
|
6 |
+
- found
|
7 |
+
languages:
|
8 |
+
- en
|
9 |
+
- fr
|
10 |
+
licenses:
|
11 |
+
- unknown
|
12 |
+
multilinguality:
|
13 |
+
- translation
|
14 |
+
size_categories:
|
15 |
+
- 1K<n<10K
|
16 |
+
source_datasets:
|
17 |
+
- extended|amazon_us_reviews
|
18 |
+
task_categories:
|
19 |
+
- conditional-text-generation
|
20 |
+
task_ids:
|
21 |
+
- machine-translation
|
22 |
+
---
|
23 |
+
|
24 |
+
# Dataset Card Creation Guide
|
25 |
+
|
26 |
+
## Table of Contents
|
27 |
+
- [Dataset Description](#dataset-description)
|
28 |
+
- [Dataset Summary](#dataset-summary)
|
29 |
+
- [Supported Tasks](#supported-tasks-and-leaderboards)
|
30 |
+
- [Languages](#languages)
|
31 |
+
- [Dataset Structure](#dataset-structure)
|
32 |
+
- [Data Instances](#data-instances)
|
33 |
+
- [Data Fields](#data-instances)
|
34 |
+
- [Data Splits](#data-instances)
|
35 |
+
- [Dataset Creation](#dataset-creation)
|
36 |
+
- [Curation Rationale](#curation-rationale)
|
37 |
+
- [Source Data](#source-data)
|
38 |
+
- [Annotations](#annotations)
|
39 |
+
- [Personal and Sensitive Information](#personal-and-sensitive-information)
|
40 |
+
- [Considerations for Using the Data](#considerations-for-using-the-data)
|
41 |
+
- [Social Impact of Dataset](#social-impact-of-dataset)
|
42 |
+
- [Discussion of Biases](#discussion-of-biases)
|
43 |
+
- [Other Known Limitations](#other-known-limitations)
|
44 |
+
- [Additional Information](#additional-information)
|
45 |
+
- [Dataset Curators](#dataset-curators)
|
46 |
+
- [Licensing Information](#licensing-information)
|
47 |
+
- [Citation Information](#citation-information)
|
48 |
+
|
49 |
+
## Dataset Description
|
50 |
+
|
51 |
+
- **Homepage:** [WMT20 Quality Estimation Shared Task](http://www.statmt.org/wmt20/quality-estimation-task.html)
|
52 |
+
- **Repository**: [Github repository](https://github.com/deep-spin/deep-spin.github.io/tree/master/docs/data/wmt2020_qe)
|
53 |
+
- **Paper:** *Not available*
|
54 |
+
|
55 |
+
### Dataset Summary
|
56 |
+
|
57 |
+
From the homepage:
|
58 |
+
|
59 |
+
*This shared task (part of WMT20) will build on its previous editions to further examine automatic methods for estimating the quality of neural machine translation output at run-time, without relying on reference translations. As in previous years, we cover estimation at various levels. Important elements introduced this year include: a new task where sentences are annotated with Direct Assessment (DA) scores instead of labels based on post-editing; a new multilingual sentence-level dataset mainly from Wikipedia articles, where the source articles can be retrieved for document-wide context; the availability of NMT models to explore system-internal information for the task.*
|
60 |
+
|
61 |
+
*The goal of this task 3 is to predict document-level quality scores as well as fine-grained annotations.*
|
62 |
+
|
63 |
+
*Each document has a product title and its description, and is annotated for translation errors according to the MQM framework. Each error annotation has:*
|
64 |
+
- ***Word span(s).*** *Errors may consist of one or more words, not necessarily contiguous.*
|
65 |
+
- ***Severity.*** *An error can be minor (if it doesn't lead to a loss of meaning and it doesn't confuse or mislead the user), major (if it changes the meaning) or critical (if it changes the meaning and carry any type of implication, or could be seen as offensive).*
|
66 |
+
- ***Type.*** *A label specifying the error type, such as wrong word order, missing words, agreement, etc. They may provide additional information, but systems don't need to predict them.*
|
67 |
+
|
68 |
+
### Supported Tasks and Leaderboards
|
69 |
+
|
70 |
+
From the homepage:
|
71 |
+
|
72 |
+
*Submissions will be evaluated as in Task 1, in terms of Pearson's correlation between the true and predicted MQM document-level scores. Additionally, the predicted annotations will be evaluated in terms of their F1 scores with respect to the gold annotations. The [official evaluation scripts](https://github.com/sheffieldnlp/qe-eval-scripts) are available.*
|
73 |
+
|
74 |
+
### Languages
|
75 |
+
|
76 |
+
There is a single language pair in the dataset: English (`en`) - French (`fr`).
|
77 |
+
|
78 |
+
## Dataset Structure
|
79 |
+
|
80 |
+
### Data Instances
|
81 |
+
|
82 |
+
An example looks like this:
|
83 |
+
```
|
84 |
+
{
|
85 |
+
'document_id': 'B0000568SY',
|
86 |
+
'source_segments': ['Razor Scooter Replacement Wheels Set with Bearings', 'Scooter Wheels w/Bearings-Blue'],
|
87 |
+
'source_tokenized': ['Razor Scooter Replacement Wheels Set with Bearings', 'Scooter Wheels w / Bearings-Blue'],
|
88 |
+
'mt_segments': ['Roues de rechange Razor Scooter sertie de roulements', 'Roues de scooter w/roulements-bleu'],
|
89 |
+
'mt_tokenized': ['Roues de rechange Razor Scooter sertie de roulements', 'Roues de scooter w / roulements-bleu'],
|
90 |
+
'annotations': {
|
91 |
+
'segment_id': [[0], [1], [1], [0, 0], [0], [1], [1]],
|
92 |
+
'annotation_start': [[42], [19], [9], [0, 32], [9], [17], [30]],
|
93 |
+
'annotation_length': [[10], [10], [7], [5, 6], [8], [1], [4]],
|
94 |
+
'severity': [0, 0, 0, 0, 0, 1, 0],
|
95 |
+
'severity_weight': [1.0, 1.0, 1.0, 1.0, 1.0, 5.0, 1.0]
|
96 |
+
'category': [3, 3, 3, 1, 3, 36, 3],
|
97 |
+
},
|
98 |
+
'token_annotations': {
|
99 |
+
'category': [3, 3, 3, 1, 3, 36, 3],
|
100 |
+
'first_token': [[7], [5], [2], [0, 5], [2], [3], [5]],
|
101 |
+
'last_token': [[7], [5], [2], [0, 5], [2], [3], [5]],
|
102 |
+
'segment_id': [[0], [1], [1], [0, 0], [0], [1], [1]],
|
103 |
+
'severity': [0, 0, 0, 0, 0, 1, 0],
|
104 |
+
'token_after_gap': [[-1], [-1], [-1], [-1, -1], [-1], [-1], [-1]]
|
105 |
+
},
|
106 |
+
'token_index': [[[0, 5], [6, 2], [9, 8], [18, 5], [24, 7], [32, 6], [39, 2], [42, 10]], [[0, 5], [6, 2], [9, 7], [17, 1], [18, 1], [19, 15]]],
|
107 |
+
'total_words': 16
|
108 |
+
}
|
109 |
+
```
|
110 |
+
|
111 |
+
### Data Fields
|
112 |
+
|
113 |
+
- `document_id`: the document id (name of the folder).
|
114 |
+
- `source_segments`: the original source text, one sentence per line (i.e. per element of the list).
|
115 |
+
- `source_tokenized`: a tokenized version of `source_segments`.
|
116 |
+
- `mt_segments`: the original machine-translated text, one sentence per line (i.e. per element of the list).
|
117 |
+
- `mt_tokenized`: a tokenized version of `mt_segments`. Default value is `[]` when this information is not available (it happens 3 times in the train set: `B0001BW0PQ`, `B0001GS19U` and `B000A6SMJ0`).
|
118 |
+
- `annotations`: error annotations for the document. Each item of the list corresponds to an error annotation, which in turn may contain one or more error spans. Error fields are encoded in a dictionary. In the case of a multi-span error, multiple starting positions and lengths are encoded in the list. Note that these positions points to `mt.segments`, not `mt_tokenized`.
|
119 |
+
- `segment_id`: List of list of integers. Id of each error.
|
120 |
+
- `annotation_start`: List of list of integers. Start of each error.
|
121 |
+
- `annotation_length`: List of list of intergers. Length of each error.
|
122 |
+
- `severity`: List of one hot. Severity category of each error.
|
123 |
+
- `severity_weight`: List of floats. Severity weight of each error.
|
124 |
+
- `category`: List of one hot. Category of each error. See the 45 categories in `_ANNOTATION_CATEGORIES_MAPPING`.
|
125 |
+
- `token_annotations`: tokenized version of `annotations`. Each error span that contains one or more tokens has a "first token" and "last token". Again, multi-span errors have their first and last tokens encoded in a list. When a span is over a gap between two tokens, the "first" and "last" positions are `-1` (encoded as `-` in the original data), and instead the `token_after_gap` column points to the token immediately after the gap. In case of a gap occurring at the end of the sentence, this value will be equal to the number of tokens.
|
126 |
+
- `segment_id`: List of list of integers. Id of each error.
|
127 |
+
- `first_token`: List of list of integers. Start of each error.
|
128 |
+
- `last_token`: List of list of intergers. End of each error.
|
129 |
+
- `token_after_gap`: List of list of integers. Token after gap of each error.
|
130 |
+
- `severity`: List of one hot. Severity category of each error.
|
131 |
+
- `category`: List of one hot. Category of each error. See the 45 categories in `_ANNOTATION_CATEGORIES_MAPPING`.
|
132 |
+
- `token_index`: a mapping of tokens to their start and ending positions in `mt_segments`. For each token, a start and end value are encoded in a list of length 2, and all tokens represent one item in the list.
|
133 |
+
- `total_words`: total number of words in the document
|
134 |
+
|
135 |
+
```
|
136 |
+
_ANNOTATION_CATEGORIES_MAPPING = {
|
137 |
+
0: 'Addition',
|
138 |
+
1: 'Agreement',
|
139 |
+
2: 'Ambiguous Translation',
|
140 |
+
3: 'Capitalization',
|
141 |
+
4: 'Character Encoding',
|
142 |
+
5: 'Company Terminology',
|
143 |
+
6: 'Date/Time',
|
144 |
+
7: 'Diacritics',
|
145 |
+
8: 'Duplication',
|
146 |
+
9: 'False Friend',
|
147 |
+
10: 'Grammatical Register',
|
148 |
+
11: 'Hyphenation',
|
149 |
+
12: 'Inconsistency',
|
150 |
+
13: 'Lexical Register',
|
151 |
+
14: 'Lexical Selection',
|
152 |
+
15: 'Named Entity',
|
153 |
+
16: 'Number',
|
154 |
+
17: 'Omitted Auxiliary Verb',
|
155 |
+
18: 'Omitted Conjunction',
|
156 |
+
19: 'Omitted Determiner',
|
157 |
+
20: 'Omitted Preposition',
|
158 |
+
21: 'Omitted Pronoun',
|
159 |
+
22: 'Orthography',
|
160 |
+
23: 'Other POS Omitted',
|
161 |
+
24: 'Over-translation',
|
162 |
+
25: 'Overly Literal',
|
163 |
+
26: 'POS',
|
164 |
+
27: 'Punctuation',
|
165 |
+
28: "Shouldn't Have Been Translated",
|
166 |
+
29: "Shouldn't have been translated",
|
167 |
+
30: 'Spelling',
|
168 |
+
31: 'Tense/Mood/Aspect',
|
169 |
+
32: 'Under-translation',
|
170 |
+
33: 'Unidiomatic',
|
171 |
+
34: 'Unintelligible',
|
172 |
+
35: 'Unit Conversion',
|
173 |
+
36: 'Untranslated',
|
174 |
+
37: 'Whitespace',
|
175 |
+
38: 'Word Order',
|
176 |
+
39: 'Wrong Auxiliary Verb',
|
177 |
+
40: 'Wrong Conjunction',
|
178 |
+
41: 'Wrong Determiner',
|
179 |
+
42: 'Wrong Language Variety',
|
180 |
+
43: 'Wrong Preposition',
|
181 |
+
44: 'Wrong Pronoun'
|
182 |
+
}
|
183 |
+
```
|
184 |
+
|
185 |
+
### Data Splits
|
186 |
+
|
187 |
+
The dataset contains 1,448 documents for training, 200 documents for validation and 180 for (blind) test (all English-French).
|
188 |
+
|
189 |
+
## Dataset Creation
|
190 |
+
|
191 |
+
### Curation Rationale
|
192 |
+
|
193 |
+
The data is dervied from the [Amazon Product Reviews dataset](http://jmcauley.ucsd.edu/data/amazon/).
|
194 |
+
|
195 |
+
### Source Data
|
196 |
+
|
197 |
+
[More Information Needed]
|
198 |
+
|
199 |
+
#### Initial Data Collection and Normalization
|
200 |
+
|
201 |
+
[More Information Needed]
|
202 |
+
|
203 |
+
#### Who are the source language producers?
|
204 |
+
|
205 |
+
[More Information Needed]
|
206 |
+
|
207 |
+
### Annotations
|
208 |
+
|
209 |
+
[More Information Needed]
|
210 |
+
|
211 |
+
#### Annotation process
|
212 |
+
|
213 |
+
[More Information Needed]
|
214 |
+
|
215 |
+
#### Who are the annotators?
|
216 |
+
|
217 |
+
[More Information Needed]
|
218 |
+
|
219 |
+
### Personal and Sensitive Information
|
220 |
+
|
221 |
+
[More Information Needed]
|
222 |
+
|
223 |
+
## Considerations for Using the Data
|
224 |
+
|
225 |
+
### Social Impact of Dataset
|
226 |
+
|
227 |
+
[More Information Needed]
|
228 |
+
|
229 |
+
### Discussion of Biases
|
230 |
+
|
231 |
+
[More Information Needed]
|
232 |
+
|
233 |
+
### Other Known Limitations
|
234 |
+
|
235 |
+
[More Information Needed]
|
236 |
+
|
237 |
+
## Additional Information
|
238 |
+
|
239 |
+
### Dataset Curators
|
240 |
+
|
241 |
+
[More Information Needed]
|
242 |
+
|
243 |
+
### Licensing Information
|
244 |
+
|
245 |
+
Unknown
|
246 |
+
|
247 |
+
### Citation Information
|
248 |
+
|
249 |
+
```
|
250 |
+
Not available.
|
251 |
+
```
|
dataset_infos.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"plain_text": {"description": "This shared task (part of WMT20) will build on its previous editions\nto further examine automatic methods for estimating the quality\nof neural machine translation output at run-time, without relying\non reference translations. As in previous years, we cover estimation\nat various levels. Important elements introduced this year include: a new\ntask where sentences are annotated with Direct Assessment (DA)\nscores instead of labels based on post-editing; a new multilingual\nsentence-level dataset mainly from Wikipedia articles, where the\nsource articles can be retrieved for document-wide context; the\navailability of NMT models to explore system-internal information for the task.\n\nThe goal of this task 3 is to predict document-level quality scores as well as fine-grained annotations.\n", "citation": "\nNot available.\n", "homepage": "http://www.statmt.org/wmt20/quality-estimation-task.html", "license": "Unknown", "features": {"document_id": {"dtype": "string", "id": null, "_type": "Value"}, "source_segments": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "source_tokenized": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "mt_segments": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "mt_tokenized": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "annotations": {"feature": {"segment_id": {"feature": {"dtype": "int32", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "annotation_start": {"feature": {"dtype": "int32", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "annotation_length": {"feature": {"dtype": "int32", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "severity": {"num_classes": 3, "names": ["minor", "major", "critical"], "names_file": null, "id": null, "_type": "ClassLabel"}, "severity_weight": {"dtype": "float32", "id": null, "_type": "Value"}, "category": {"num_classes": 45, "names": ["Addition", "Agreement", "Ambiguous Translation", "Capitalization", "Character Encoding", "Company Terminology", "Date/Time", "Diacritics", "Duplication", "False Friend", "Grammatical Register", "Hyphenation", "Inconsistency", "Lexical Register", "Lexical Selection", "Named Entity", "Number", "Omitted Auxiliary Verb", "Omitted Conjunction", "Omitted Determiner", "Omitted Preposition", "Omitted Pronoun", "Orthography", "Other POS Omitted", "Over-translation", "Overly Literal", "POS", "Punctuation", "Shouldn't Have Been Translated", "Shouldn't have been translated", "Spelling", "Tense/Mood/Aspect", "Under-translation", "Unidiomatic", "Unintelligible", "Unit Conversion", "Untranslated", "Whitespace", "Word Order", "Wrong Auxiliary Verb", "Wrong Conjunction", "Wrong Determiner", "Wrong Language Variety", "Wrong Preposition", "Wrong Pronoun"], "names_file": null, "id": null, "_type": "ClassLabel"}}, "length": -1, "id": null, "_type": "Sequence"}, "token_annotations": {"feature": {"segment_id": {"feature": {"dtype": "int32", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "first_token": {"feature": {"dtype": "int32", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "last_token": {"feature": {"dtype": "int32", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "token_after_gap": {"feature": {"dtype": "int32", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "severity": {"num_classes": 3, "names": ["minor", "major", "critical"], "names_file": null, "id": null, "_type": "ClassLabel"}, "category": {"num_classes": 45, "names": ["Addition", "Agreement", "Ambiguous Translation", "Capitalization", "Character Encoding", "Company Terminology", "Date/Time", "Diacritics", "Duplication", "False Friend", "Grammatical Register", "Hyphenation", "Inconsistency", "Lexical Register", "Lexical Selection", "Named Entity", "Number", "Omitted Auxiliary Verb", "Omitted Conjunction", "Omitted Determiner", "Omitted Preposition", "Omitted Pronoun", "Orthography", "Other POS Omitted", "Over-translation", "Overly Literal", "POS", "Punctuation", "Shouldn't Have Been Translated", "Shouldn't have been translated", "Spelling", "Tense/Mood/Aspect", "Under-translation", "Unidiomatic", "Unintelligible", "Unit Conversion", "Untranslated", "Whitespace", "Word Order", "Wrong Auxiliary Verb", "Wrong Conjunction", "Wrong Determiner", "Wrong Language Variety", "Wrong Preposition", "Wrong Pronoun"], "names_file": null, "id": null, "_type": "ClassLabel"}}, "length": -1, "id": null, "_type": "Sequence"}, "token_index": {"feature": {"feature": {"feature": {"dtype": "int32", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "length": -1, "id": null, "_type": "Sequence"}, "length": -1, "id": null, "_type": "Sequence"}, "total_words": {"dtype": "int32", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "builder_name": "wmt20_mlqe_task3", "config_name": "plain_text", "version": {"version_str": "1.1.0", "description": null, "major": 1, "minor": 1, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 10762355, "num_examples": 1448, "dataset_name": "wmt20_mlqe_task3"}, "test": {"name": "test", "num_bytes": 745260, "num_examples": 180, "dataset_name": "wmt20_mlqe_task3"}, "validation": {"name": "validation", "num_bytes": 1646596, "num_examples": 200, "dataset_name": "wmt20_mlqe_task3"}}, "download_checksums": {"https://github.com/deep-spin/deep-spin.github.io/raw/master/docs/data/wmt2020_qe/qe-task3-enfr-traindev.tar.gz": {"num_bytes": 3301244, "checksum": "1511bfa2293ef307c0ef78f26b5161c85c8b842e4d21b8ed846c668ada515d26"}, "https://github.com/deep-spin/deep-spin.github.io/raw/master/docs/data/wmt2020_qe/qe-enfr-blindtest.tar.gz": {"num_bytes": 233390, "checksum": "9a95c04cd510437b4155ad621e39ff735bf63ebc526e904a563c7c267a88de72"}}, "download_size": 3534634, "post_processing_size": null, "dataset_size": 13154211, "size_in_bytes": 16688845}}
|
dummy/plain_text/1.1.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:06becf9fe009ab1ce5ac0fad56ab66faea30af0731f3004e65398260e73599e2
|
3 |
+
size 31279
|
wmt20_mlqe_task3.py
ADDED
@@ -0,0 +1,248 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
"""WMT MLQE Shared task 3."""
|
16 |
+
|
17 |
+
from __future__ import absolute_import, division, print_function
|
18 |
+
|
19 |
+
import csv
|
20 |
+
import glob
|
21 |
+
import os
|
22 |
+
|
23 |
+
import datasets
|
24 |
+
|
25 |
+
|
26 |
+
_CITATION = """
|
27 |
+
Not available.
|
28 |
+
"""
|
29 |
+
|
30 |
+
_DESCRIPTION = """\
|
31 |
+
This shared task (part of WMT20) will build on its previous editions
|
32 |
+
to further examine automatic methods for estimating the quality
|
33 |
+
of neural machine translation output at run-time, without relying
|
34 |
+
on reference translations. As in previous years, we cover estimation
|
35 |
+
at various levels. Important elements introduced this year include: a new
|
36 |
+
task where sentences are annotated with Direct Assessment (DA)
|
37 |
+
scores instead of labels based on post-editing; a new multilingual
|
38 |
+
sentence-level dataset mainly from Wikipedia articles, where the
|
39 |
+
source articles can be retrieved for document-wide context; the
|
40 |
+
availability of NMT models to explore system-internal information for the task.
|
41 |
+
|
42 |
+
The goal of this task 3 is to predict document-level quality scores as well as fine-grained annotations.
|
43 |
+
"""
|
44 |
+
|
45 |
+
_HOMEPAGE = "http://www.statmt.org/wmt20/quality-estimation-task.html"
|
46 |
+
|
47 |
+
_LICENSE = "Unknown"
|
48 |
+
|
49 |
+
_URLs = {
|
50 |
+
"train+dev": "https://github.com/deep-spin/deep-spin.github.io/raw/master/docs/data/wmt2020_qe/qe-task3-enfr-traindev.tar.gz",
|
51 |
+
"test": "https://github.com/deep-spin/deep-spin.github.io/raw/master/docs/data/wmt2020_qe/qe-enfr-blindtest.tar.gz",
|
52 |
+
}
|
53 |
+
|
54 |
+
|
55 |
+
_ANNOTATION_CATEGORIES = [
|
56 |
+
"Addition",
|
57 |
+
"Agreement",
|
58 |
+
"Ambiguous Translation",
|
59 |
+
"Capitalization",
|
60 |
+
"Character Encoding",
|
61 |
+
"Company Terminology",
|
62 |
+
"Date/Time",
|
63 |
+
"Diacritics",
|
64 |
+
"Duplication",
|
65 |
+
"False Friend",
|
66 |
+
"Grammatical Register",
|
67 |
+
"Hyphenation",
|
68 |
+
"Inconsistency",
|
69 |
+
"Lexical Register",
|
70 |
+
"Lexical Selection",
|
71 |
+
"Named Entity",
|
72 |
+
"Number",
|
73 |
+
"Omitted Auxiliary Verb",
|
74 |
+
"Omitted Conjunction",
|
75 |
+
"Omitted Determiner",
|
76 |
+
"Omitted Preposition",
|
77 |
+
"Omitted Pronoun",
|
78 |
+
"Orthography",
|
79 |
+
"Other POS Omitted",
|
80 |
+
"Over-translation",
|
81 |
+
"Overly Literal",
|
82 |
+
"POS",
|
83 |
+
"Punctuation",
|
84 |
+
"Shouldn't Have Been Translated",
|
85 |
+
"Shouldn't have been translated",
|
86 |
+
"Spelling",
|
87 |
+
"Tense/Mood/Aspect",
|
88 |
+
"Under-translation",
|
89 |
+
"Unidiomatic",
|
90 |
+
"Unintelligible",
|
91 |
+
"Unit Conversion",
|
92 |
+
"Untranslated",
|
93 |
+
"Whitespace",
|
94 |
+
"Word Order",
|
95 |
+
"Wrong Auxiliary Verb",
|
96 |
+
"Wrong Conjunction",
|
97 |
+
"Wrong Determiner",
|
98 |
+
"Wrong Language Variety",
|
99 |
+
"Wrong Preposition",
|
100 |
+
"Wrong Pronoun",
|
101 |
+
]
|
102 |
+
|
103 |
+
|
104 |
+
class Wmt20MlqeTask3(datasets.GeneratorBasedBuilder):
|
105 |
+
"""WMT MLQE Shared task 3."""
|
106 |
+
|
107 |
+
BUILDER_CONFIGS = [
|
108 |
+
datasets.BuilderConfig(
|
109 |
+
name=f"plain_text",
|
110 |
+
version=datasets.Version("1.1.0"),
|
111 |
+
description=f"Plain text",
|
112 |
+
)
|
113 |
+
]
|
114 |
+
|
115 |
+
def _info(self):
|
116 |
+
features = datasets.Features(
|
117 |
+
{
|
118 |
+
"document_id": datasets.Value("string"),
|
119 |
+
"source_segments": datasets.Sequence(datasets.Value("string")),
|
120 |
+
"source_tokenized": datasets.Sequence(datasets.Value("string")),
|
121 |
+
"mt_segments": datasets.Sequence(datasets.Value("string")),
|
122 |
+
"mt_tokenized": datasets.Sequence(datasets.Value("string")),
|
123 |
+
"annotations": datasets.Sequence(
|
124 |
+
{
|
125 |
+
"segment_id": datasets.Sequence(datasets.Value("int32")),
|
126 |
+
"annotation_start": datasets.Sequence(datasets.Value("int32")),
|
127 |
+
"annotation_length": datasets.Sequence(datasets.Value("int32")),
|
128 |
+
"severity": datasets.ClassLabel(names=["minor", "major", "critical"]),
|
129 |
+
"severity_weight": datasets.Value("float32"),
|
130 |
+
"category": datasets.ClassLabel(names=_ANNOTATION_CATEGORIES),
|
131 |
+
}
|
132 |
+
),
|
133 |
+
"token_annotations": datasets.Sequence(
|
134 |
+
{
|
135 |
+
"segment_id": datasets.Sequence(datasets.Value("int32")),
|
136 |
+
"first_token": datasets.Sequence(datasets.Value("int32")),
|
137 |
+
"last_token": datasets.Sequence(datasets.Value("int32")),
|
138 |
+
"token_after_gap": datasets.Sequence(datasets.Value("int32")),
|
139 |
+
"severity": datasets.ClassLabel(names=["minor", "major", "critical"]),
|
140 |
+
"category": datasets.ClassLabel(names=_ANNOTATION_CATEGORIES),
|
141 |
+
}
|
142 |
+
),
|
143 |
+
"token_index": datasets.Sequence(datasets.Sequence(datasets.Sequence(datasets.Value("int32")))),
|
144 |
+
"total_words": datasets.Value("int32"),
|
145 |
+
}
|
146 |
+
)
|
147 |
+
|
148 |
+
return datasets.DatasetInfo(
|
149 |
+
description=_DESCRIPTION,
|
150 |
+
features=features,
|
151 |
+
supervised_keys=None,
|
152 |
+
homepage=_HOMEPAGE,
|
153 |
+
license=_LICENSE,
|
154 |
+
citation=_CITATION,
|
155 |
+
)
|
156 |
+
|
157 |
+
def _split_generators(self, dl_manager):
|
158 |
+
"""Returns SplitGenerators."""
|
159 |
+
data_dir = dl_manager.download_and_extract(_URLs)
|
160 |
+
return [
|
161 |
+
datasets.SplitGenerator(
|
162 |
+
name=datasets.Split.TRAIN,
|
163 |
+
gen_kwargs={
|
164 |
+
"filepath": os.path.join(data_dir["train+dev"], "task3", "train"),
|
165 |
+
"split": "train",
|
166 |
+
},
|
167 |
+
),
|
168 |
+
datasets.SplitGenerator(
|
169 |
+
name=datasets.Split.TEST,
|
170 |
+
gen_kwargs={
|
171 |
+
"filepath": os.path.join(data_dir["test"], "test-blind"),
|
172 |
+
"split": "test",
|
173 |
+
},
|
174 |
+
),
|
175 |
+
datasets.SplitGenerator(
|
176 |
+
name=datasets.Split.VALIDATION,
|
177 |
+
gen_kwargs={
|
178 |
+
"filepath": os.path.join(data_dir["train+dev"], "task3", "dev"),
|
179 |
+
"split": "dev",
|
180 |
+
},
|
181 |
+
),
|
182 |
+
]
|
183 |
+
|
184 |
+
def _generate_examples(self, filepath, split):
|
185 |
+
""" Yields examples. """
|
186 |
+
|
187 |
+
def open_and_read(fp):
|
188 |
+
with open(fp, encoding="utf-8") as f:
|
189 |
+
return f.read().splitlines()
|
190 |
+
|
191 |
+
for id_, folder in enumerate(sorted(glob.glob(os.path.join(filepath, "*")))):
|
192 |
+
source_segments = open_and_read(os.path.join(folder, "source.segments"))
|
193 |
+
source_tokenized = open_and_read(os.path.join(folder, "source.tokenized"))
|
194 |
+
mt_segments = open_and_read(os.path.join(folder, "mt.segments"))
|
195 |
+
mt_tokenized = open_and_read(os.path.join(folder, "mt.tokenized"))
|
196 |
+
|
197 |
+
if split in ["train", "dev"] and not os.path.exists(os.path.join(folder, "token_index")):
|
198 |
+
token_index = []
|
199 |
+
else:
|
200 |
+
token_index = [
|
201 |
+
[idx.split(" ") for idx in line.split("\t")]
|
202 |
+
for line in open_and_read(os.path.join(folder, "token_index"))
|
203 |
+
if line != ""
|
204 |
+
]
|
205 |
+
total_words = open_and_read(os.path.join(folder, "total_words"))[0]
|
206 |
+
|
207 |
+
if split in ["train", "dev"]:
|
208 |
+
with open(os.path.join(folder, "annotations.tsv"), encoding="utf-8") as f:
|
209 |
+
reader = csv.DictReader(f, delimiter="\t")
|
210 |
+
annotations = [
|
211 |
+
{
|
212 |
+
"segment_id": row["segment_id"].split(" "),
|
213 |
+
"annotation_start": row["annotation_start"].split(" "),
|
214 |
+
"annotation_length": row["annotation_length"].split(" "),
|
215 |
+
"severity": row["severity"],
|
216 |
+
"severity_weight": row["severity_weight"],
|
217 |
+
"category": row["category"],
|
218 |
+
}
|
219 |
+
for row in reader
|
220 |
+
]
|
221 |
+
with open(os.path.join(folder, "token_annotations.tsv"), encoding="utf-8") as f:
|
222 |
+
reader = csv.DictReader(f, delimiter="\t")
|
223 |
+
token_annotations = [
|
224 |
+
{
|
225 |
+
"segment_id": row["segment_id"].split(" "),
|
226 |
+
"first_token": row["first_token"].replace("-", "-1").split(" "),
|
227 |
+
"last_token": row["last_token"].replace("-", "-1").split(" "),
|
228 |
+
"token_after_gap": row["token_after_gap"].replace("-", "-1").split(" "),
|
229 |
+
"severity": row["severity"],
|
230 |
+
"category": row["category"],
|
231 |
+
}
|
232 |
+
for row in reader
|
233 |
+
]
|
234 |
+
else:
|
235 |
+
annotations = []
|
236 |
+
token_annotations = []
|
237 |
+
|
238 |
+
yield id_, {
|
239 |
+
"document_id": os.path.basename(folder),
|
240 |
+
"source_segments": source_segments,
|
241 |
+
"source_tokenized": source_tokenized,
|
242 |
+
"mt_segments": mt_segments,
|
243 |
+
"mt_tokenized": mt_tokenized,
|
244 |
+
"annotations": annotations,
|
245 |
+
"token_annotations": token_annotations,
|
246 |
+
"token_index": token_index,
|
247 |
+
"total_words": total_words,
|
248 |
+
}
|