Sagnik Ray Choudhury commited on
Commit
0183bcd
1 Parent(s): 20e097c

chore: mctest

Browse files
README.md CHANGED
@@ -1 +1,144 @@
1
- hello
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ annotations_creators:
3
+ - expert-generated
4
+ language_creators:
5
+ - found
6
+ languages:
7
+ - en-US
8
+ licenses:
9
+ - microsoft-research-license
10
+ multilinguality:
11
+ - monolingual
12
+ size_categories:
13
+ - 1K<n<10K
14
+ source_datasets:
15
+ - extended|natural_questions
16
+ task_categories:
17
+ - question-answering
18
+ task_ids:
19
+ - multiple-choice-qa
20
+ - question-answering-other-explanations-in-question-answering
21
+ paperswithcode_id: mctest
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 and Leaderboards](#supported-tasks-and-leaderboards)
30
+ - [Languages](#languages)
31
+ - [Dataset Structure](#dataset-structure)
32
+ - [Data Instances](#data-instances)
33
+ - [Data Fields](#data-fields)
34
+ - [Data Splits](#data-splits)
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
+ - [Contributions](#contributions)
49
+
50
+ ## Dataset Description
51
+
52
+ - **Homepage:** N/A
53
+ - **Repository:** [GitHub](https://github.com/mcobzarenco/mctest/)
54
+ - **Paper:** [MCTest: A Challenge Dataset for the Open-Domain Machine Comprehension of Text](https://www.aclweb.org/anthology/D13-1020.pdf)
55
+ - **Leaderboard:** N/A
56
+ - **Point of Contact:** -
57
+
58
+ ### Dataset Summary
59
+
60
+ [More Information Needed]
61
+
62
+ ### Supported Tasks and Leaderboards
63
+
64
+ [More Information Needed]
65
+
66
+ ### Languages
67
+
68
+ [More Information Needed]
69
+
70
+ ## Dataset Structure
71
+
72
+ ### Data Instances
73
+
74
+ [More Information Needed]
75
+
76
+ ### Data Fields
77
+
78
+ [More Information Needed]
79
+
80
+ ### Data Splits
81
+
82
+ [More Information Needed]
83
+ ## Dataset Creation
84
+
85
+ ### Curation Rationale
86
+
87
+ [More Information Needed]
88
+
89
+ ### Source Data
90
+
91
+ [More Information Needed]
92
+
93
+ #### Initial Data Collection and Normalization
94
+
95
+ [More Information Needed]
96
+
97
+ #### Who are the source language producers?
98
+
99
+ [More Information Needed]
100
+
101
+ ### Annotations
102
+
103
+ [More Information Needed]
104
+
105
+ #### Annotation process
106
+
107
+ [More Information Needed]
108
+
109
+ #### Who are the annotators?
110
+
111
+ [More Information Needed]
112
+
113
+ ### Personal and Sensitive Information
114
+
115
+ [More Information Needed]
116
+
117
+ ## Considerations for Using the Data
118
+
119
+ ### Social Impact of Dataset
120
+
121
+ [More Information Needed]
122
+
123
+ ### Discussion of Biases
124
+
125
+ [More Information Needed]
126
+
127
+ ### Other Known Limitations
128
+
129
+ [More Information Needed]
130
+
131
+ ## Additional Information
132
+
133
+ ### Dataset Curators
134
+
135
+ [More Information Needed]
136
+
137
+ ### Licensing Information
138
+
139
+ [More Information Needed]
140
+
141
+ ### Citation Information
142
+
143
+ [More Information Needed]
144
+ ### Contributions
dataset_infos.json ADDED
@@ -0,0 +1 @@
 
1
+ {"mc500": {"description": "MCTest requires machines to answer multiple-choice reading comprehension questions about fictional stories, directly tackling the high-level goal of open-domain machine comprehension.\n", "citation": "@inproceedings{richardson-etal-2013-mctest,\n title = \"{MCT}est: A Challenge Dataset for the Open-Domain Machine Comprehension of Text\",\n author = \"Richardson, Matthew and\n Burges, Christopher J.C. and\n Renshaw, Erin\",\n booktitle = \"Proceedings of the 2013 Conference on Empirical Methods in Natural Language Processing\",\n month = oct,\n year = \"2013\",\n address = \"Seattle, Washington, USA\",\n publisher = \"Association for Computational Linguistics\",\n url = \"https://www.aclweb.org/anthology/D13-1020\",\n pages = \"193--203\",\n}\n", "homepage": "https://www.aclweb.org/anthology/D13-1020/", "license": "", "features": {"idx": {"story": {"dtype": "string", "id": null, "_type": "Value"}, "question": {"dtype": "int32", "id": null, "_type": "Value"}}, "question": {"dtype": "string", "id": null, "_type": "Value"}, "story": {"dtype": "string", "id": null, "_type": "Value"}, "properties": {"author": {"dtype": "string", "id": null, "_type": "Value"}, "work_time": {"dtype": "int32", "id": null, "_type": "Value"}, "quality_score": {"dtype": "int32", "id": null, "_type": "Value"}, "creativity_words": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}}, "answer_options": {"A": {"dtype": "string", "id": null, "_type": "Value"}, "B": {"dtype": "string", "id": null, "_type": "Value"}, "C": {"dtype": "string", "id": null, "_type": "Value"}, "D": {"dtype": "string", "id": null, "_type": "Value"}}, "answer": {"dtype": "string", "id": null, "_type": "Value"}, "question_is_multiple": {"dtype": "bool", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "mc_test", "config_name": "mc500", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 1743546, "num_examples": 1200, "dataset_name": "mc_test"}, "validation": {"name": "validation", "num_bytes": 286746, "num_examples": 200, "dataset_name": "mc_test"}, "test": {"name": "test", "num_bytes": 840244, "num_examples": 600, "dataset_name": "mc_test"}}, "download_checksums": {"http://parl.ai/downloads/mctest/mctest.tar.gz": {"num_bytes": 1181387, "checksum": "c8160bf790c97cec8e272677600170d5e181649492bde7e2c0ea5fb23ab25af7"}}, "download_size": 1181387, "post_processing_size": null, "dataset_size": 2870536, "size_in_bytes": 4051923}, "mc160": {"description": "MCTest requires machines to answer multiple-choice reading comprehension questions about fictional stories, directly tackling the high-level goal of open-domain machine comprehension.\n", "citation": "@inproceedings{richardson-etal-2013-mctest,\n title = \"{MCT}est: A Challenge Dataset for the Open-Domain Machine Comprehension of Text\",\n author = \"Richardson, Matthew and\n Burges, Christopher J.C. and\n Renshaw, Erin\",\n booktitle = \"Proceedings of the 2013 Conference on Empirical Methods in Natural Language Processing\",\n month = oct,\n year = \"2013\",\n address = \"Seattle, Washington, USA\",\n publisher = \"Association for Computational Linguistics\",\n url = \"https://www.aclweb.org/anthology/D13-1020\",\n pages = \"193--203\",\n}\n", "homepage": "https://www.aclweb.org/anthology/D13-1020/", "license": "", "features": {"idx": {"story": {"dtype": "string", "id": null, "_type": "Value"}, "question": {"dtype": "int32", "id": null, "_type": "Value"}}, "question": {"dtype": "string", "id": null, "_type": "Value"}, "story": {"dtype": "string", "id": null, "_type": "Value"}, "properties": {"author": {"dtype": "string", "id": null, "_type": "Value"}, "work_time": {"dtype": "int32", "id": null, "_type": "Value"}}, "answer_options": {"A": {"dtype": "string", "id": null, "_type": "Value"}, "B": {"dtype": "string", "id": null, "_type": "Value"}, "C": {"dtype": "string", "id": null, "_type": "Value"}, "D": {"dtype": "string", "id": null, "_type": "Value"}}, "answer": {"dtype": "string", "id": null, "_type": "Value"}, "question_is_multiple": {"dtype": "bool", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "mc_test", "config_name": "mc160", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 371573, "num_examples": 280, "dataset_name": "mc_test"}, "validation": {"name": "validation", "num_bytes": 159916, "num_examples": 120, "dataset_name": "mc_test"}, "test": {"name": "test", "num_bytes": 302109, "num_examples": 240, "dataset_name": "mc_test"}}, "download_checksums": {"http://parl.ai/downloads/mctest/mctest.tar.gz": {"num_bytes": 1181387, "checksum": "c8160bf790c97cec8e272677600170d5e181649492bde7e2c0ea5fb23ab25af7"}}, "download_size": 1181387, "post_processing_size": null, "dataset_size": 833598, "size_in_bytes": 2014985}}
dummy/mc160/1.0.0/dummy_data.zip ADDED
Binary file (4.07 kB). View file
dummy/mc160/1.0.0/dummy_data.zip.lock ADDED
File without changes
dummy/mc500/1.0.0/dummy_data.zip ADDED
Binary file (4.46 kB). View file
dummy/mc500/1.0.0/dummy_data.zip.lock ADDED
File without changes
mctest.py ADDED
@@ -0,0 +1,214 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2020 The 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
+ """MCTest: Machine comprehension test: http://research.microsoft.com/mct"""
16
+
17
+
18
+ import os
19
+ import datasets
20
+
21
+
22
+ _CITATION = """\
23
+ @inproceedings{richardson-etal-2013-mctest,
24
+ title = "{MCT}est: A Challenge Dataset for the Open-Domain Machine Comprehension of Text",
25
+ author = "Richardson, Matthew and
26
+ Burges, Christopher J.C. and
27
+ Renshaw, Erin",
28
+ booktitle = "Proceedings of the 2013 Conference on Empirical Methods in Natural Language Processing",
29
+ month = oct,
30
+ year = "2013",
31
+ address = "Seattle, Washington, USA",
32
+ publisher = "Association for Computational Linguistics",
33
+ url = "https://www.aclweb.org/anthology/D13-1020",
34
+ pages = "193--203",
35
+ }
36
+ """
37
+
38
+ _DESCRIPTION = """\
39
+ MCTest requires machines to answer multiple-choice reading comprehension questions about fictional stories, directly tackling the high-level goal of open-domain machine comprehension.
40
+ """
41
+
42
+ _HOMEPAGE = "https://www.aclweb.org/anthology/D13-1020/"
43
+
44
+ _DATA_URL = "http://parl.ai/downloads/mctest/mctest.tar.gz"
45
+
46
+
47
+ class MCTest(datasets.GeneratorBasedBuilder):
48
+ """MCTest: Machine comprehension test: http://research.microsoft.com/mct"""
49
+
50
+ VERSION = datasets.Version("1.0.0")
51
+
52
+ BUILDER_CONFIGS = [
53
+ datasets.BuilderConfig(
54
+ name="mc500",
55
+ version=VERSION,
56
+ description="MC 500",
57
+ ),
58
+ datasets.BuilderConfig(
59
+ name="mc160",
60
+ version=VERSION,
61
+ description="MC 160",
62
+ ),
63
+ ]
64
+
65
+ DEFAULT_CONFIG_NAME = "mc500"
66
+
67
+ def _info(self):
68
+ if self.config.name == "mc500":
69
+ features = datasets.Features(
70
+ {
71
+ "idx": dict(
72
+ {"story": datasets.Value("string"),
73
+ "question": datasets.Value("int32")
74
+ }
75
+ ),
76
+ "question": datasets.Value("string"),
77
+ "story": datasets.Value("string"),
78
+ "properties": dict(
79
+ {
80
+ "author": datasets.Value("string"),
81
+ "work_time": datasets.Value("int32"),
82
+ "quality_score": datasets.Value("int32"),
83
+ "creativity_words": datasets.Sequence(datasets.Value("string")),
84
+ }
85
+ ),
86
+ "answer_options": dict(
87
+ {
88
+ "A": datasets.Value("string"),
89
+ "B": datasets.Value("string"),
90
+ "C": datasets.Value("string"),
91
+ "D": datasets.Value("string")
92
+ }
93
+ ),
94
+ "answer": datasets.Value("string"),
95
+ "question_is_multiple": datasets.Value("bool")
96
+ }
97
+ )
98
+ else:
99
+ features = datasets.Features(
100
+ {
101
+ "idx": dict(
102
+ {"story": datasets.Value("string"),
103
+ "question": datasets.Value("int32")
104
+ }
105
+ ),
106
+ "question": datasets.Value("string"),
107
+ "story": datasets.Value("string"),
108
+ "properties": dict(
109
+ {
110
+ "author": datasets.Value("string"),
111
+ "work_time": datasets.Value("int32"),
112
+ }
113
+ ),
114
+ "answer_options": dict(
115
+ {
116
+ "A": datasets.Value("string"),
117
+ "B": datasets.Value("string"),
118
+ "C": datasets.Value("string"),
119
+ "D": datasets.Value("string")
120
+ }
121
+ ),
122
+ "answer": datasets.Value("string"),
123
+ "question_is_multiple": datasets.Value("bool")
124
+ }
125
+ )
126
+ return datasets.DatasetInfo(
127
+ description=_DESCRIPTION,
128
+ features=features,
129
+ homepage=_HOMEPAGE,
130
+ citation=_CITATION,
131
+ )
132
+
133
+ def _split_generators(self, dl_manager):
134
+ data_dir = os.path.join(dl_manager.download_and_extract(_DATA_URL), 'mctest')
135
+ paths = {}
136
+ for phase in ["train", "dev", "test"]:
137
+ paths[phase] = {
138
+ "data": os.path.join(data_dir, "MCTest", f"{self.config.name}.{phase}.tsv"),
139
+ "answer": os.path.join(data_dir, "MCTest", f"{self.config.name}.{phase}.ans")
140
+ }
141
+ paths["test"]["answer"] = os.path.join(data_dir, "MCTestAnswers", f"{self.config.name}.test.ans")
142
+
143
+ return [
144
+ datasets.SplitGenerator(
145
+ name=datasets.Split.TRAIN,
146
+ gen_kwargs={"filepath": paths["train"]},
147
+ ),
148
+ datasets.SplitGenerator(
149
+ name=datasets.Split.VALIDATION,
150
+ gen_kwargs={"filepath": paths["dev"]},
151
+ ),
152
+ datasets.SplitGenerator(
153
+ name=datasets.Split.TEST,
154
+ gen_kwargs={"filepath": paths["test"]},
155
+ ),
156
+ ]
157
+
158
+ def _get_properties(self, property_str):
159
+ """
160
+ properties is a semicolon-delimited list of property:value pairs, including
161
+ Author (anonymized author id, consistent across all files)
162
+ Work Time(s): Seconds between author accepting and submitting the task
163
+ Qual. score: The author's grammar qualification test score (% correct)
164
+ Creativity Words: Words the author was given to encourage creativity
165
+ (there are no creativity words or qual score for mc160, see paper)
166
+ :param property_str:
167
+ :return:
168
+ """
169
+ properties = property_str.split(';')
170
+ property_data = {
171
+ "author": properties[0].split(':')[-1].strip(),
172
+ "work_time": int(properties[1].split(':')[-1].strip())
173
+ }
174
+ if self.config.name == "mc500":
175
+ property_data.update(
176
+ {
177
+ "quality_score": int(properties[2].split(':')[-1].strip()),
178
+ "creativity_words": properties[3].split(':')[-1].strip().split(',')
179
+ }
180
+ )
181
+ return property_data
182
+
183
+ def _generate_examples(self, filepath):
184
+ tab_char = '\t'
185
+ data_path = filepath['data']
186
+ ans_path = filepath['answer']
187
+ data_lines = open(data_path, encoding="utf-8").read().split('\n')[:-1]
188
+ answer_lines = open(ans_path, encoding="utf-8").read().split('\n')[:-1]
189
+ for data_line, answer_line in zip(data_lines, answer_lines):
190
+ data_line_split = data_line.split(tab_char)
191
+ story_id = data_line_split[0]
192
+ properties = self._get_properties(data_line_split[1])
193
+ story = data_line_split[2]
194
+ answers = answer_line.split('\t')
195
+ data_line_split = data_line_split[3:]
196
+ for i in range(4):
197
+ answer = answers[i]
198
+ index = i*5
199
+ multiple, question_text = [x.strip() for x in data_line_split[index].strip().split(':')]
200
+ question_is_multiple = True if multiple == "multiple" else False
201
+ answer_options = {x: y for x, y in zip(["A", "B", "C", "D"], data_line_split[index+1:index+5])}
202
+ yield f"{story_id}-{i}", {
203
+ "idx":
204
+ {"story": story_id,
205
+ "question": i
206
+ },
207
+ "question": question_text,
208
+ "story": story,
209
+ "properties": properties,
210
+ "answer_options": answer_options,
211
+ "answer": answer,
212
+ "question_is_multiple": question_is_multiple
213
+ }
214
+
mctest.py.lock ADDED
File without changes