system HF staff commited on
Commit
a20d66a
0 Parent(s):

Update files from the datasets library (from 1.17.0)

Browse files

Release notes: https://github.com/huggingface/datasets/releases/tag/1.17.0

Files changed (5) hide show
  1. .gitattributes +27 -0
  2. README.md +201 -0
  3. dataset_infos.json +1 -0
  4. dummy/1.1.0/dummy_data.zip +3 -0
  5. onestop_qa.py +166 -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,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ annotations_creators:
3
+ - expert-generated
4
+ language_creators:
5
+ - expert-generated
6
+ languages:
7
+ - en-US
8
+ licenses:
9
+ - cc-by-sa-4-0
10
+ multilinguality:
11
+ - monolingual
12
+ paperswithcode_id: onestopqa
13
+ pretty_name: OneStopQA
14
+ size_categories:
15
+ - 1K<n<10K
16
+ source_datasets:
17
+ - original
18
+ - extended|onestop_english
19
+ task_categories:
20
+ - question-answering
21
+ task_ids:
22
+ - multiple-choice-qa
23
+ ---
24
+
25
+ # Dataset Card for OneStopQA
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-instances)
35
+ - [Data Splits](#data-instances)
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
+ - [Contributions](#contributions)
50
+
51
+ ## Dataset Description
52
+
53
+ - **Homepage:** [OneStopQA repository](https://github.com/berzak/onestop-qa)
54
+ - **Repository:** [OneStopQA repository](https://github.com/berzak/onestop-qa)
55
+ - **Paper:** [STARC: Structured Annotations for Reading Comprehension](https://arxiv.org/abs/2004.14797)
56
+ - **Leaderboard:** [Needs More Information]
57
+ - **Point of Contact:** [Needs More Information]
58
+
59
+ ### Dataset Summary
60
+
61
+ OneStopQA is a multiple choice reading comprehension dataset annotated according to the STARC (Structured Annotations for Reading Comprehension) scheme. The reading materials are Guardian articles taken from the [OneStopEnglish corpus](https://github.com/nishkalavallabhi/OneStopEnglishCorpus). Each article comes in three difficulty levels, Elementary, Intermediate and Advanced. Each paragraph is annotated with three multiple choice reading comprehension questions. The reading comprehension questions can be answered based on any of the three paragraph levels.
62
+
63
+ ### Supported Tasks and Leaderboards
64
+
65
+ [Needs More Information]
66
+
67
+ ### Languages
68
+
69
+ English (`en-US`).
70
+
71
+ The original Guardian articles were manually converted from British to American English.
72
+
73
+ ## Dataset Structure
74
+
75
+ ### Data Instances
76
+
77
+ An example of instance looks as follows.
78
+
79
+ ```json
80
+ {
81
+ "title": "101-Year-Old Bottle Message",
82
+ "paragraph": "Angela Erdmann never knew her grandfather. He died in 1946, six years before she was born. But, on Tuesday 8th April, 2014, she described the extraordinary moment when she received a message in a bottle, 101 years after he had lobbed it into the Baltic Sea. Thought to be the world’s oldest message in a bottle, it was presented to Erdmann by the museum that is now exhibiting it in Germany.",
83
+ "paragraph_index": 1,
84
+ "level": "Adv",
85
+ "question": "How did Angela Erdmann find out about the bottle?",
86
+ "answers": ["A museum told her that they had it",
87
+ "She coincidentally saw it at the museum where it was held",
88
+ "She found it in her basement on April 28th, 2014",
89
+ "A friend told her about it"],
90
+ "a_span": [56, 70],
91
+ "d_span": [16, 34]
92
+ }
93
+ ```
94
+ Where,
95
+
96
+ | Answer | Description | Textual Span |
97
+ |--------|------------------------------------------------------------|-----------------|
98
+ | a | Correct answer. | Critical Span |
99
+ | b | Incorrect answer. A miscomprehension of the critical span. | Critical Span |
100
+ | c | Incorrect answer. Refers to an additional span. | Distractor Span |
101
+ | d | Incorrect answer. Has no textual support. | - |
102
+
103
+ The order of the answers in the `answers` list corresponds to the order of the answers in the table.
104
+
105
+ ### Data Fields
106
+
107
+ - `title`: A `string` feature. The article title.
108
+ - `paragraph`: A `string` feature. The paragraph from the article.
109
+ - `paragraph_index`: An `int` feature. Corresponds to the paragraph index in the article.
110
+ - `question`: A `string` feature. The given question.
111
+ - `answers`: A list of `string` feature containing the four possible answers.
112
+ - `a_span`: A list of start and end indices (inclusive) of the critical span.
113
+ - `d_span`: A list of start and end indices (inclusive) of the distractor span.
114
+
115
+ *Span indices are according to word positions after whitespace tokenization.
116
+
117
+ **In the rare case where a span is spread over multiple sections,
118
+ the span list will contain multiple instances of start and stop indices in the format:
119
+ [start_1, stop_1, start_2, stop_2,...].
120
+
121
+
122
+ ### Data Splits
123
+
124
+ Articles: 30
125
+ Paragraphs: 162
126
+ Questions: 486
127
+ Question-Paragraph Level pairs: 1,458
128
+
129
+ No preconfigured split is currently provided.
130
+
131
+
132
+ ## Dataset Creation
133
+
134
+ ### Curation Rationale
135
+
136
+ [Needs More Information]
137
+
138
+ ### Source Data
139
+
140
+ #### Initial Data Collection and Normalization
141
+
142
+ [Needs More Information]
143
+
144
+ #### Who are the source language producers?
145
+
146
+ [Needs More Information]
147
+
148
+ ### Annotations
149
+
150
+ #### Annotation process
151
+
152
+ The annotation and piloting process of the dataset is described in Appendix A in
153
+ [STARC: Structured Annotations for Reading Comprehension](https://aclanthology.org/2020.acl-main.507.pdf).
154
+
155
+ #### Who are the annotators?
156
+
157
+ [Needs More Information]
158
+
159
+ ### Personal and Sensitive Information
160
+
161
+ [Needs More Information]
162
+
163
+ ## Considerations for Using the Data
164
+
165
+ ### Social Impact of Dataset
166
+
167
+ [Needs More Information]
168
+
169
+ ### Discussion of Biases
170
+
171
+ [Needs More Information]
172
+
173
+ ### Other Known Limitations
174
+
175
+ [Needs More Information]
176
+
177
+ ## Additional Information
178
+
179
+ ### Dataset Curators
180
+
181
+ [Needs More Information]
182
+
183
+ ### Licensing Information
184
+
185
+ <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-sa/4.0/88x31.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International License</a>.
186
+
187
+ ### Citation Information
188
+
189
+ [STARC: Structured Annotations for Reading Comprehension](http://people.csail.mit.edu/berzak/papers/acl2020.pdf)
190
+ ```
191
+ @inproceedings{starc2020,
192
+ author = {Berzak, Yevgeni and Malmaud, Jonathan and Levy, Roger},
193
+ title = {STARC: Structured Annotations for Reading Comprehension},
194
+ booktitle = {ACL},
195
+ year = {2020},
196
+ publisher = {Association for Computational Linguistics}
197
+ }
198
+ ```
199
+ ### Contributions
200
+
201
+ Thanks to [@scaperex](https://github.com/scaperex) for adding this dataset.
dataset_infos.json ADDED
@@ -0,0 +1 @@
 
1
+ {"default": {"description": "OneStopQA is a multiple choice reading comprehension dataset annotated according to the STARC (Structured Annotations for Reading Comprehension) scheme. The reading materials are Guardian articles taken from the [OneStopEnglish corpus](https://github.com/nishkalavallabhi/OneStopEnglishCorpus). Each article comes in three difficulty levels, Elementary, Intermediate and Advanced. Each paragraph is annotated with three multiple choice reading comprehension questions. The reading comprehension questions can be answered based on any of the three paragraph levels.\n", "citation": "@inproceedings{starc2020,\n author = {Berzak, Yevgeni and Malmaud, Jonathan and Levy, Roger},\n title = {STARC: Structured Annotations for Reading Comprehension},\n booktitle = {ACL},\n year = {2020},\n publisher = {Association for Computational Linguistics}\n }\n", "homepage": "https://github.com/berzak/onestop-qa", "license": "Creative Commons Attribution-ShareAlike 4.0 International License", "features": {"title": {"dtype": "string", "id": null, "_type": "Value"}, "paragraph": {"dtype": "string", "id": null, "_type": "Value"}, "level": {"num_classes": 3, "names": ["Adv", "Int", "Ele"], "names_file": null, "id": null, "_type": "ClassLabel"}, "question": {"dtype": "string", "id": null, "_type": "Value"}, "paragraph_index": {"dtype": "int32", "id": null, "_type": "Value"}, "answers": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": 4, "id": null, "_type": "Sequence"}, "a_span": {"feature": {"dtype": "int32", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "d_span": {"feature": {"dtype": "int32", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "task_templates": [], "builder_name": "one_stop_qa", "config_name": "default", "version": {"version_str": "1.1.0", "description": null, "major": 1, "minor": 1, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 1423090, "num_examples": 1458, "dataset_name": "one_stop_qa"}}, "download_checksums": {"https://github.com/berzak/onestop-qa/raw/master/annotations/onestop_qa.zip": {"num_bytes": 118173, "checksum": "4e9baf4c09797505f7841466d06f521c3d675f7855a987b96c1b3d1fe9ada1ff"}}, "download_size": 118173, "post_processing_size": null, "dataset_size": 1423090, "size_in_bytes": 1541263}}
dummy/1.1.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5257657f0c7165dfe1852d70ece55270ddf6b2b1e0219a8fb4ad0a210a54e94f
3
+ size 20260
onestop_qa.py ADDED
@@ -0,0 +1,166 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ """OneStopQA - a multiple choice reading comprehension dataset annotated
16
+ according to the STARC (Structured Annotations for Reading Comprehension) scheme"""
17
+
18
+
19
+ import json
20
+ import os
21
+
22
+ import datasets
23
+
24
+
25
+ # from datasets.tasks import QuestionAnsweringExtractive
26
+
27
+
28
+ logger = datasets.logging.get_logger(__name__)
29
+
30
+
31
+ # Find for instance the citation on arxiv or on the dataset repo/website
32
+ _CITATION = """\
33
+ @inproceedings{starc2020,
34
+ author = {Berzak, Yevgeni and Malmaud, Jonathan and Levy, Roger},
35
+ title = {STARC: Structured Annotations for Reading Comprehension},
36
+ booktitle = {ACL},
37
+ year = {2020},
38
+ publisher = {Association for Computational Linguistics}
39
+ }
40
+ """
41
+
42
+ _DESCRIPTION = """\
43
+ OneStopQA is a multiple choice reading comprehension dataset annotated according to the STARC \
44
+ (Structured Annotations for Reading Comprehension) scheme. \
45
+ The reading materials are Guardian articles taken from the \
46
+ [OneStopEnglish corpus](https://github.com/nishkalavallabhi/OneStopEnglishCorpus). \
47
+ Each article comes in three difficulty levels, Elementary, Intermediate and Advanced. \
48
+ Each paragraph is annotated with three multiple choice reading comprehension questions. \
49
+ The reading comprehension questions can be answered based on any of the three paragraph levels.
50
+ """
51
+
52
+ _HOMEPAGE = "https://github.com/berzak/onestop-qa"
53
+
54
+ _LICENSE = "Creative Commons Attribution-ShareAlike 4.0 International License"
55
+
56
+ # The HuggingFace dataset library don't host the datasets but only point to the original files
57
+ # This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
58
+ _URL = "https://github.com/berzak/onestop-qa/raw/master/annotations/onestop_qa.zip"
59
+
60
+
61
+ class OneStopQA(datasets.GeneratorBasedBuilder):
62
+ """OneStopQA - a multiple choice reading comprehension dataset annotated
63
+ according to the STARC (Structured Annotations for Reading Comprehension) scheme"""
64
+
65
+ VERSION = datasets.Version("1.1.0")
66
+
67
+ # This is an example of a dataset with multiple configurations.
68
+ # If you don't want/need to define several sub-sets in your dataset,
69
+ # just remove the BUILDER_CONFIG_CLASS and the BUILDER_CONFIGS attributes.
70
+
71
+ # If you need to make complex sub-parts in the datasets with configurable options
72
+ # You can create your own builder configuration class to store attribute, inheriting from datasets.BuilderConfig
73
+ # BUILDER_CONFIG_CLASS = MyBuilderConfig
74
+
75
+ # You will be able to load one or the other configurations in the following list with
76
+ # data = datasets.load_dataset('my_dataset', 'first_domain')
77
+ # data = datasets.load_dataset('my_dataset', 'second_domain')
78
+
79
+ def _info(self):
80
+ features = datasets.Features(
81
+ {
82
+ "title": datasets.Value("string"),
83
+ "paragraph": datasets.Value("string"),
84
+ "level": datasets.ClassLabel(names=["Adv", "Int", "Ele"]),
85
+ "question": datasets.Value("string"),
86
+ "paragraph_index": datasets.Value("int32"),
87
+ "answers": datasets.features.Sequence(datasets.Value("string"), length=4),
88
+ "a_span": datasets.features.Sequence(datasets.Value("int32")),
89
+ "d_span": datasets.features.Sequence(datasets.Value("int32")),
90
+ }
91
+ )
92
+
93
+ return datasets.DatasetInfo(
94
+ # This is the description that will appear on the datasets page.
95
+ description=_DESCRIPTION,
96
+ # This defines the different columns of the dataset and their types
97
+ features=features, # Here we define them above because they are different between the two configurations
98
+ # If there's a common (input, target) tuple from the features,
99
+ # specify them here. They'll be used if as_supervised=True in
100
+ # builder.as_dataset.
101
+ supervised_keys=None,
102
+ # Homepage of the dataset for documentation
103
+ homepage=_HOMEPAGE,
104
+ # License for the dataset if available
105
+ license=_LICENSE,
106
+ # Citation for the dataset
107
+ citation=_CITATION,
108
+ task_templates=[]
109
+ # QuestionAnsweringExtractive(
110
+ # question_column="question", context_column="context", answers_column="answers"
111
+ # )
112
+ # ], # When issue #2434 is resolved uncomment task_templates and the QuestionAnsweringExtractive (or similar)
113
+ )
114
+
115
+ def _split_generators(self, dl_manager):
116
+ """Returns SplitGenerators."""
117
+ # If several configurations are possible (listed in BUILDER_CONFIGS), the configuration selected by the user is in self.config.name
118
+
119
+ # dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLs
120
+ # It can accept any type or nested list/dict and will give back the same structure with the url replaced with path to local files.
121
+ # By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
122
+ data_dir = dl_manager.download_and_extract(_URL)
123
+ return [
124
+ datasets.SplitGenerator(
125
+ name=datasets.Split.TRAIN,
126
+ # These kwargs will be passed to _generate_examples
127
+ gen_kwargs={
128
+ "filepath": os.path.join(data_dir, "onestop_qa.json"),
129
+ "split": "train",
130
+ },
131
+ ),
132
+ ]
133
+
134
+ def _generate_examples(
135
+ self, filepath, split # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
136
+ ):
137
+ """Yields examples as (key, example) tuples."""
138
+ # This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
139
+ # The `key` is here for legacy reason (tfds) and is not important in itself.
140
+ # Based on the squad dataset
141
+ logger.info("generating examples from = %s", filepath)
142
+ key = 0
143
+ with open(filepath, encoding="utf-8") as f:
144
+ onestop_qa = json.load(f)
145
+ for article in onestop_qa["data"]:
146
+ title = article.get("title", "")
147
+ for paragraph_index, paragraph in enumerate(article["paragraphs"]):
148
+ for level in ["Adv", "Int", "Ele"]:
149
+ paragraph_context_and_spans = paragraph[level]
150
+ paragraph_context = paragraph_context_and_spans["context"]
151
+ a_spans = paragraph_context_and_spans["a_spans"]
152
+ d_spans = paragraph_context_and_spans["d_spans"]
153
+ qas = paragraph["qas"]
154
+ for qa, a_span, d_span in zip(qas, a_spans, d_spans):
155
+ yield key, {
156
+ "title": title,
157
+ "paragraph": paragraph_context,
158
+ "question": qa["question"],
159
+ "paragraph_index": paragraph_index,
160
+ "answers": qa["answers"],
161
+ "level": level,
162
+ "a_span": a_span,
163
+ "d_span": d_span,
164
+ },
165
+
166
+ key += 1