demelin commited on
Commit
2e8d854
1 Parent(s): db7e395

First version of the wino_x dataset.

Browse files
Files changed (3) hide show
  1. README.md +148 -2
  2. dataset_infos.json +1 -0
  3. wino_x.py +168 -0
README.md CHANGED
@@ -1,3 +1,149 @@
1
  ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ annotations_creators:
3
+ - no-annotation
4
+ language:
5
+ - en
6
+ - de
7
+ - fr
8
+ - ru
9
+ language_creators:
10
+ - machine-generated
11
+ - expert-generated
12
+ license:
13
+ - mit
14
+ multilinguality:
15
+ - multilingual
16
+ - translation
17
+ pretty_name: Wino-X
18
+ size_categories:
19
+ - 1K<n<10K
20
+ source_datasets:
21
+ - original
22
+ task_categories:
23
+ - translation
24
+ - coreference resolution
25
+ - commonsense reasoning
26
+ - ---
27
+
28
+ # Dataset Card for Wino-X
29
+
30
+ ## Table of Contents
31
+ - [Table of Contents](#table-of-contents)
32
+ - [Dataset Description](#dataset-description)
33
+ - [Dataset Summary](#dataset-summary)
34
+ - [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
35
+ - [Languages](#languages)
36
+ - [Dataset Structure](#dataset-structure)
37
+ - [Data Instances](#data-instances)
38
+ - [Data Fields](#data-fields)
39
+ - [Data Splits](#data-splits)
40
+ - [Dataset Creation](#dataset-creation)
41
+ - [Curation Rationale](#curation-rationale)
42
+ - [Source Data](#source-data)
43
+ - [Annotations](#annotations)
44
+ - [Personal and Sensitive Information](#personal-and-sensitive-information)
45
+ - [Considerations for Using the Data](#considerations-for-using-the-data)
46
+ - [Social Impact of Dataset](#social-impact-of-dataset)
47
+ - [Discussion of Biases](#discussion-of-biases)
48
+ - [Other Known Limitations](#other-known-limitations)
49
+ - [Additional Information](#additional-information)
50
+ - [Dataset Curators](#dataset-curators)
51
+ - [Licensing Information](#licensing-information)
52
+ - [Citation Information](#citation-information)
53
+ - [Contributions](#contributions)
54
+
55
+ ## Dataset Description
56
+
57
+ - **Homepage:**
58
+ - **Repository:**
59
+ - **Paper:**
60
+ - **Leaderboard:**
61
+ - **Point of Contact:**
62
+
63
+ ### Dataset Summary
64
+
65
+ [More Information Needed]
66
+
67
+ ### Supported Tasks and Leaderboards
68
+
69
+ [More Information Needed]
70
+
71
+ ### Languages
72
+
73
+ [More Information Needed]
74
+
75
+ ## Dataset Structure
76
+
77
+ ### Data Instances
78
+
79
+ [More Information Needed]
80
+
81
+ ### Data Fields
82
+
83
+ [More Information Needed]
84
+
85
+ ### Data Splits
86
+
87
+ [More Information Needed]
88
+
89
+ ## Dataset Creation
90
+
91
+ ### Curation Rationale
92
+
93
+ [More Information Needed]
94
+
95
+ ### Source Data
96
+
97
+ #### Initial Data Collection and Normalization
98
+
99
+ [More Information Needed]
100
+
101
+ #### Who are the source language producers?
102
+
103
+ [More Information Needed]
104
+
105
+ ### Annotations
106
+
107
+ #### Annotation process
108
+
109
+ [More Information Needed]
110
+
111
+ #### Who are the annotators?
112
+
113
+ [More Information Needed]
114
+
115
+ ### Personal and Sensitive Information
116
+
117
+ [More Information Needed]
118
+
119
+ ## Considerations for Using the Data
120
+
121
+ ### Social Impact of Dataset
122
+
123
+ [More Information Needed]
124
+
125
+ ### Discussion of Biases
126
+
127
+ [More Information Needed]
128
+
129
+ ### Other Known Limitations
130
+
131
+ [More Information Needed]
132
+
133
+ ## Additional Information
134
+
135
+ ### Dataset Curators
136
+
137
+ [More Information Needed]
138
+
139
+ ### Licensing Information
140
+
141
+ [More Information Needed]
142
+
143
+ ### Citation Information
144
+
145
+ [More Information Needed]
146
+
147
+ ### Contributions
148
+
149
+ See the [associated GitHub repository](https://github.com/demelin/Wino-X).
dataset_infos.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"mt_en_de": {"description": "Wino-X is a parallel dataset of German, French, and Russian Winograd schemas, aligned with their English \ncounterparts, used to examine whether neural machine translation models can perform coreference resolution that \nrequires commonsense knowledge and whether multilingual language models are capable of commonsense reasoning across \nmultiple languages.\n", "citation": "@inproceedings{Emelin2021WinoXMW,\n title={Wino-X: Multilingual Winograd Schemas for Commonsense Reasoning and Coreference Resolution},\n author={Denis Emelin and Rico Sennrich},\n booktitle={EMNLP},\n year={2021}\n}\n", "homepage": "https://github.com/demelin/Wino-X", "license": "MIT", "features": {"qID": {"dtype": "string", "id": null, "_type": "Value"}, "sentence": {"dtype": "string", "id": null, "_type": "Value"}, "translation1": {"dtype": "string", "id": null, "_type": "Value"}, "translation2": {"dtype": "string", "id": null, "_type": "Value"}, "answer": {"dtype": "int64", "id": null, "_type": "Value"}, "pronoun1": {"dtype": "string", "id": null, "_type": "Value"}, "pronoun2": {"dtype": "string", "id": null, "_type": "Value"}, "referent1_en": {"dtype": "string", "id": null, "_type": "Value"}, "referent2_en": {"dtype": "string", "id": null, "_type": "Value"}, "true_translation_referent_of_pronoun1_de": {"dtype": "string", "id": null, "_type": "Value"}, "true_translation_referent_of_pronoun2_de": {"dtype": "string", "id": null, "_type": "Value"}, "false_translation_referent_of_pronoun1_de": {"dtype": "string", "id": null, "_type": "Value"}, "false_translation_referent_of_pronoun2_de": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "wino_x", "config_name": "mt_en_de", "version": {"version_str": "1.1.0", "description": null, "major": 1, "minor": 1, "patch": 0}, "splits": {"test": {"name": "test", "num_bytes": 1601793, "num_examples": 3774, "dataset_name": "wino_x"}}, "download_checksums": {"https://huggingface.co/datasets/demelin/wino_x/resolve/main/data/mt/en_de_test.jsonl": {"num_bytes": 2700026, "checksum": "1d18e0dcff2aae54b0ae28a43b61483e97225451d7286e4224657b2b3d93a03a"}}, "download_size": 2700026, "post_processing_size": null, "dataset_size": 1601793, "size_in_bytes": 4301819}, "mt_en_fr": {"description": "Wino-X is a parallel dataset of German, French, and Russian Winograd schemas, aligned with their English \ncounterparts, used to examine whether neural machine translation models can perform coreference resolution that \nrequires commonsense knowledge and whether multilingual language models are capable of commonsense reasoning across \nmultiple languages.\n", "citation": "@inproceedings{Emelin2021WinoXMW,\n title={Wino-X: Multilingual Winograd Schemas for Commonsense Reasoning and Coreference Resolution},\n author={Denis Emelin and Rico Sennrich},\n booktitle={EMNLP},\n year={2021}\n}\n", "homepage": "https://github.com/demelin/Wino-X", "license": "MIT", "features": {"qID": {"dtype": "string", "id": null, "_type": "Value"}, "sentence": {"dtype": "string", "id": null, "_type": "Value"}, "translation1": {"dtype": "string", "id": null, "_type": "Value"}, "translation2": {"dtype": "string", "id": null, "_type": "Value"}, "answer": {"dtype": "int64", "id": null, "_type": "Value"}, "pronoun1": {"dtype": "string", "id": null, "_type": "Value"}, "pronoun2": {"dtype": "string", "id": null, "_type": "Value"}, "referent1_en": {"dtype": "string", "id": null, "_type": "Value"}, "referent2_en": {"dtype": "string", "id": null, "_type": "Value"}, "true_translation_referent_of_pronoun1_fr": {"dtype": "string", "id": null, "_type": "Value"}, "true_translation_referent_of_pronoun2_fr": {"dtype": "string", "id": null, "_type": "Value"}, "false_translation_referent_of_pronoun1_fr": {"dtype": "string", "id": null, "_type": "Value"}, "false_translation_referent_of_pronoun2_fr": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "wino_x", "config_name": "mt_en_fr", "version": {"version_str": "1.1.0", "description": null, "major": 1, "minor": 1, "patch": 0}, "splits": {"test": {"name": "test", "num_bytes": 1320197, "num_examples": 2988, "dataset_name": "wino_x"}}, "download_checksums": {"https://huggingface.co/datasets/demelin/wino_x/resolve/main/data/mt/en_fr_test.jsonl": {"num_bytes": 2189704, "checksum": "b5b64309b596769e1faabdf2c302c5fe9a0869d972ce39000015f0d8d76c72bb"}}, "download_size": 2189704, "post_processing_size": null, "dataset_size": 1320197, "size_in_bytes": 3509901}, "mt_en_ru": {"description": "Wino-X is a parallel dataset of German, French, and Russian Winograd schemas, aligned with their English \ncounterparts, used to examine whether neural machine translation models can perform coreference resolution that \nrequires commonsense knowledge and whether multilingual language models are capable of commonsense reasoning across \nmultiple languages.\n", "citation": "@inproceedings{Emelin2021WinoXMW,\n title={Wino-X: Multilingual Winograd Schemas for Commonsense Reasoning and Coreference Resolution},\n author={Denis Emelin and Rico Sennrich},\n booktitle={EMNLP},\n year={2021}\n}\n", "homepage": "https://github.com/demelin/Wino-X", "license": "MIT", "features": {"qID": {"dtype": "string", "id": null, "_type": "Value"}, "sentence": {"dtype": "string", "id": null, "_type": "Value"}, "translation1": {"dtype": "string", "id": null, "_type": "Value"}, "translation2": {"dtype": "string", "id": null, "_type": "Value"}, "answer": {"dtype": "int64", "id": null, "_type": "Value"}, "pronoun1": {"dtype": "string", "id": null, "_type": "Value"}, "pronoun2": {"dtype": "string", "id": null, "_type": "Value"}, "referent1_en": {"dtype": "string", "id": null, "_type": "Value"}, "referent2_en": {"dtype": "string", "id": null, "_type": "Value"}, "true_translation_referent_of_pronoun1_ru": {"dtype": "string", "id": null, "_type": "Value"}, "true_translation_referent_of_pronoun2_ru": {"dtype": "string", "id": null, "_type": "Value"}, "false_translation_referent_of_pronoun1_ru": {"dtype": "string", "id": null, "_type": "Value"}, "false_translation_referent_of_pronoun2_ru": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "wino_x", "config_name": "mt_en_ru", "version": {"version_str": "1.1.0", "description": null, "major": 1, "minor": 1, "patch": 0}, "splits": {"test": {"name": "test", "num_bytes": 1314290, "num_examples": 2238, "dataset_name": "wino_x"}}, "download_checksums": {"https://huggingface.co/datasets/demelin/wino_x/resolve/main/data/mt/en_ru_test.jsonl": {"num_bytes": 1965547, "checksum": "94f232e299b1f27cb97cdae15e25f2e6157b974abfda0754fca91a6d5bea0d7d"}}, "download_size": 1965547, "post_processing_size": null, "dataset_size": 1314290, "size_in_bytes": 3279837}, "lm_en_de": {"description": "Wino-X is a parallel dataset of German, French, and Russian Winograd schemas, aligned with their English \ncounterparts, used to examine whether neural machine translation models can perform coreference resolution that \nrequires commonsense knowledge and whether multilingual language models are capable of commonsense reasoning across \nmultiple languages.\n", "citation": "@inproceedings{Emelin2021WinoXMW,\n title={Wino-X: Multilingual Winograd Schemas for Commonsense Reasoning and Coreference Resolution},\n author={Denis Emelin and Rico Sennrich},\n booktitle={EMNLP},\n year={2021}\n}\n", "homepage": "https://github.com/demelin/Wino-X", "license": "MIT", "features": {"qID": {"dtype": "string", "id": null, "_type": "Value"}, "sentence": {"dtype": "string", "id": null, "_type": "Value"}, "context_en": {"dtype": "string", "id": null, "_type": "Value"}, "context_de": {"dtype": "string", "id": null, "_type": "Value"}, "answer": {"dtype": "int64", "id": null, "_type": "Value"}, "option1_en": {"dtype": "string", "id": null, "_type": "Value"}, "option2_en": {"dtype": "string", "id": null, "_type": "Value"}, "option1_de": {"dtype": "string", "id": null, "_type": "Value"}, "option2_de": {"dtype": "string", "id": null, "_type": "Value"}, "context_referent_of_option1_de": {"dtype": "string", "id": null, "_type": "Value"}, "context_referent_of_option2_de": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "wino_x", "config_name": "lm_en_de", "version": {"version_str": "1.1.0", "description": null, "major": 1, "minor": 1, "patch": 0}, "splits": {"test": {"name": "test", "num_bytes": 2432303, "num_examples": 5835, "dataset_name": "wino_x"}}, "download_checksums": {"https://huggingface.co/datasets/demelin/wino_x/resolve/main/data/lm/en_de_test.jsonl": {"num_bytes": 3465097, "checksum": "aa91c114832c351c7c4a836041120efc9b5cca2c1620ffcdc5f7f4fa1a7af613"}}, "download_size": 3465097, "post_processing_size": null, "dataset_size": 2432303, "size_in_bytes": 5897400}, "lm_en_fr": {"description": "Wino-X is a parallel dataset of German, French, and Russian Winograd schemas, aligned with their English \ncounterparts, used to examine whether neural machine translation models can perform coreference resolution that \nrequires commonsense knowledge and whether multilingual language models are capable of commonsense reasoning across \nmultiple languages.\n", "citation": "@inproceedings{Emelin2021WinoXMW,\n title={Wino-X: Multilingual Winograd Schemas for Commonsense Reasoning and Coreference Resolution},\n author={Denis Emelin and Rico Sennrich},\n booktitle={EMNLP},\n year={2021}\n}\n", "homepage": "https://github.com/demelin/Wino-X", "license": "MIT", "features": {"qID": {"dtype": "string", "id": null, "_type": "Value"}, "sentence": {"dtype": "string", "id": null, "_type": "Value"}, "context_en": {"dtype": "string", "id": null, "_type": "Value"}, "context_fr": {"dtype": "string", "id": null, "_type": "Value"}, "answer": {"dtype": "int64", "id": null, "_type": "Value"}, "option1_en": {"dtype": "string", "id": null, "_type": "Value"}, "option2_en": {"dtype": "string", "id": null, "_type": "Value"}, "option1_fr": {"dtype": "string", "id": null, "_type": "Value"}, "option2_fr": {"dtype": "string", "id": null, "_type": "Value"}, "context_referent_of_option1_fr": {"dtype": "string", "id": null, "_type": "Value"}, "context_referent_of_option2_fr": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "wino_x", "config_name": "lm_en_fr", "version": {"version_str": "1.1.0", "description": null, "major": 1, "minor": 1, "patch": 0}, "splits": {"test": {"name": "test", "num_bytes": 1184932, "num_examples": 2793, "dataset_name": "wino_x"}}, "download_checksums": {"https://huggingface.co/datasets/demelin/wino_x/resolve/main/data/lm/en_fr_test.jsonl": {"num_bytes": 1679293, "checksum": "5eb5baeba31db9c20aafb5379e80d14b0a32d69d4d3a9925c4a1ee7e77eb11d1"}}, "download_size": 1679293, "post_processing_size": null, "dataset_size": 1184932, "size_in_bytes": 2864225}, "lm_en_ru": {"description": "Wino-X is a parallel dataset of German, French, and Russian Winograd schemas, aligned with their English \ncounterparts, used to examine whether neural machine translation models can perform coreference resolution that \nrequires commonsense knowledge and whether multilingual language models are capable of commonsense reasoning across \nmultiple languages.\n", "citation": "@inproceedings{Emelin2021WinoXMW,\n title={Wino-X: Multilingual Winograd Schemas for Commonsense Reasoning and Coreference Resolution},\n author={Denis Emelin and Rico Sennrich},\n booktitle={EMNLP},\n year={2021}\n}\n", "homepage": "https://github.com/demelin/Wino-X", "license": "MIT", "features": {"qID": {"dtype": "string", "id": null, "_type": "Value"}, "sentence": {"dtype": "string", "id": null, "_type": "Value"}, "context_en": {"dtype": "string", "id": null, "_type": "Value"}, "context_ru": {"dtype": "string", "id": null, "_type": "Value"}, "answer": {"dtype": "int64", "id": null, "_type": "Value"}, "option1_en": {"dtype": "string", "id": null, "_type": "Value"}, "option2_en": {"dtype": "string", "id": null, "_type": "Value"}, "option1_ru": {"dtype": "string", "id": null, "_type": "Value"}, "option2_ru": {"dtype": "string", "id": null, "_type": "Value"}, "context_referent_of_option1_ru": {"dtype": "string", "id": null, "_type": "Value"}, "context_referent_of_option2_ru": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "wino_x", "config_name": "lm_en_ru", "version": {"version_str": "1.1.0", "description": null, "major": 1, "minor": 1, "patch": 0}, "splits": {"test": {"name": "test", "num_bytes": 753838, "num_examples": 1487, "dataset_name": "wino_x"}}, "download_checksums": {"https://huggingface.co/datasets/demelin/wino_x/resolve/main/data/lm/en_ru_test.jsonl": {"num_bytes": 1017037, "checksum": "1bd110d3bc11e5f3034f7040fca56a818607182a52df42dcfa16d606528c2a25"}}, "download_size": 1017037, "post_processing_size": null, "dataset_size": 753838, "size_in_bytes": 1770875}}
wino_x.py ADDED
@@ -0,0 +1,168 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ """ Wino-X is a parallel dataset of German, French, and Russian Winograd schemas, aligned with their English
15
+ counterparts, used to examine whether neural machine translation models can perform coreference resolution that
16
+ requires commonsense knowledge and whether multilingual language models are capable of commonsense reasoning across
17
+ multiple languages. """
18
+
19
+ import csv
20
+ import json
21
+ import os
22
+
23
+ import datasets
24
+
25
+ _CITATION = """\
26
+ @inproceedings{Emelin2021WinoXMW,
27
+ title={Wino-X: Multilingual Winograd Schemas for Commonsense Reasoning and Coreference Resolution},
28
+ author={Denis Emelin and Rico Sennrich},
29
+ booktitle={EMNLP},
30
+ year={2021}
31
+ }
32
+ """
33
+
34
+ # You can copy an official description
35
+ _DESCRIPTION = """\
36
+ Wino-X is a parallel dataset of German, French, and Russian Winograd schemas, aligned with their English
37
+ counterparts, used to examine whether neural machine translation models can perform coreference resolution that
38
+ requires commonsense knowledge and whether multilingual language models are capable of commonsense reasoning across
39
+ multiple languages.
40
+ """
41
+
42
+ _HOMEPAGE = "https://github.com/demelin/Wino-X"
43
+
44
+ _LICENSE = "MIT"
45
+
46
+ # The HuggingFace Datasets library doesn't host the datasets but only points to the original files.
47
+ # This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
48
+ _URLS = {
49
+ "mt_en_de": "https://huggingface.co/datasets/demelin/wino_x/resolve/main/data/mt/en_de_test.jsonl",
50
+ "mt_en_fr": "https://huggingface.co/datasets/demelin/wino_x/resolve/main/data/mt/en_fr_test.jsonl",
51
+ "mt_en_ru": "https://huggingface.co/datasets/demelin/wino_x/resolve/main/data/mt/en_ru_test.jsonl",
52
+ "lm_en_de": "https://huggingface.co/datasets/demelin/wino_x/resolve/main/data/lm/en_de_test.jsonl",
53
+ "lm_en_fr": "https://huggingface.co/datasets/demelin/wino_x/resolve/main/data/lm/en_fr_test.jsonl",
54
+ "lm_en_ru": "https://huggingface.co/datasets/demelin/wino_x/resolve/main/data/lm/en_ru_test.jsonl"
55
+ }
56
+
57
+
58
+ class WinoX(datasets.GeneratorBasedBuilder):
59
+ """ Wino-X is a dataset of German, French, and Russian Winograd schemas, aligned with their English counterparts """
60
+
61
+ VERSION = datasets.Version("1.1.0")
62
+ BUILDER_CONFIGS = [
63
+ datasets.BuilderConfig(name="mt_en_de", version=VERSION,
64
+ description="This is the EN-DE part of the Wino-X translation data."),
65
+ datasets.BuilderConfig(name="mt_en_fr", version=VERSION,
66
+ description="This is the EN-FR part of the Wino-X translation data."),
67
+ datasets.BuilderConfig(name="mt_en_ru", version=VERSION,
68
+ description="This is the EN-RU part of the Wino-X translation data."),
69
+ datasets.BuilderConfig(name="lm_en_de", version=VERSION,
70
+ description="This is the EN-DE part of the Wino-X language modeling data."),
71
+ datasets.BuilderConfig(name="lm_en_fr", version=VERSION,
72
+ description="This is the EN-FR part of the Wino-X language modeling data."),
73
+ datasets.BuilderConfig(name="lm_en_ru", version=VERSION,
74
+ description="This is the EN-RU part of the Wino-X language modeling data."),
75
+ ]
76
+
77
+ def _info(self):
78
+
79
+ # MT example:
80
+ # {"qID": "3UDTAB6HH8D37OQL3O6F3GXEEOF09Z-1",
81
+ # "sentence": "The woman looked for a different vase for the bouquet because it was too small.",
82
+ # "translation1": "Die Frau suchte nach einer anderen Vase für den Blumenstrauß, weil sie zu klein war.",
83
+ # "translation2": "Die Frau suchte nach einer anderen Vase für den Blumenstrauß, weil er zu klein war.",
84
+ # "answer": 1,
85
+ # "pronoun1": "sie",
86
+ # "pronoun2": "er",
87
+ # "referent1_en": "vase",
88
+ # "referent2_en": "bouquet",
89
+ # "true_translation_referent_of_pronoun1_de": "Vase",
90
+ # "true_translation_referent_of_pronoun2_de": "Blumenstrauß",
91
+ # "false_translation_referent_of_pronoun1_de": "Vase",
92
+ # "false_translation_referent_of_pronoun2_de": "Blumenstrauß"}
93
+
94
+ tgt_lang = self.config.name.split('_')[-1]
95
+ if self.config.name.startswith('mt_'):
96
+ features = datasets.Features(
97
+ {
98
+ "qID": datasets.Value("string"),
99
+ "sentence": datasets.Value("string"),
100
+ "translation1": datasets.Value("string"),
101
+ "translation2": datasets.Value("string"),
102
+ "answer": datasets.Value("int64"),
103
+ "pronoun1": datasets.Value("string"),
104
+ "pronoun2": datasets.Value("string"),
105
+ "referent1_en": datasets.Value("string"),
106
+ "referent2_en": datasets.Value("string"),
107
+ "true_translation_referent_of_pronoun1_{}".format(tgt_lang): datasets.Value("string"),
108
+ "true_translation_referent_of_pronoun2_{}".format(tgt_lang): datasets.Value("string"),
109
+ "false_translation_referent_of_pronoun1_{}".format(tgt_lang): datasets.Value("string"),
110
+ "false_translation_referent_of_pronoun2_{}".format(tgt_lang): datasets.Value("string")
111
+ }
112
+ )
113
+
114
+ # LM example:
115
+ # {"qID": "3UDTAB6HH8D37OQL3O6F3GXEEOF09Z-1",
116
+ # "sentence": "The woman looked for a different vase for the bouquet because it was too small.",
117
+ # "context_en": "The woman looked for a different vase for the bouquet because _ was too small.",
118
+ # "context_de": "Die Frau suchte nach einer anderen Vase für den Blumenstrauß, weil _ zu klein war.",
119
+ # "option1_en": "the vase",
120
+ # "option2_en": "the bouquet",
121
+ # "option1_de": "die Vase",
122
+ # "option2_de": "der Blumenstrauß",
123
+ # "answer": 1,
124
+ # "context_referent_of_option1_de": "Vase",
125
+ # "context_referent_of_option2_de": "Blumenstrauß"}
126
+
127
+ else:
128
+ features = datasets.Features(
129
+ {
130
+ "qID": datasets.Value("string"),
131
+ "sentence": datasets.Value("string"),
132
+ "context_en": datasets.Value("string"),
133
+ "context_{}".format(tgt_lang): datasets.Value("string"),
134
+ "answer": datasets.Value("int64"),
135
+ "option1_en": datasets.Value("string"),
136
+ "option2_en": datasets.Value("string"),
137
+ "option1_{}".format(tgt_lang): datasets.Value("string"),
138
+ "option2_{}".format(tgt_lang): datasets.Value("string"),
139
+ "context_referent_of_option1_{}".format(tgt_lang): datasets.Value("string"),
140
+ "context_referent_of_option2_{}".format(tgt_lang): datasets.Value("string")
141
+ }
142
+ )
143
+
144
+ return datasets.DatasetInfo(
145
+ # This is the description that will appear on the datasets page.
146
+ description=_DESCRIPTION,
147
+ # This defines the different columns of the dataset and their types
148
+ features=features,
149
+ # Homepage of the dataset for documentation
150
+ homepage=_HOMEPAGE,
151
+ # License for the dataset if available
152
+ license=_LICENSE,
153
+ # Citation for the dataset
154
+ citation=_CITATION,
155
+ )
156
+
157
+ def _split_generators(self, dl_manager):
158
+ downloaded_files = dl_manager.download_and_extract(_URLS[self.config.name])
159
+ return [datasets.SplitGenerator(name=datasets.Split.TEST,
160
+ gen_kwargs={'filepath': downloaded_files, 'split': 'test'})]
161
+
162
+ # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
163
+ def _generate_examples(self, filepath, split):
164
+ # The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
165
+ with open(filepath, encoding="utf-8") as f:
166
+ for key, row in enumerate(f):
167
+ data = json.loads(row)
168
+ yield key, data