Datasets:

Modalities:
Text
Formats:
parquet
Languages:
English
ArXiv:
Libraries:
Datasets
pandas
License:
albertvillanova HF staff commited on
Commit
1df9aea
1 Parent(s): 09ccbe0

Convert dataset to Parquet (#4)

Browse files

- Convert dataset to Parquet (14b7c9894d4841cdea2b75852c3aa62156dccb77)
- Delete loading script (5a76f3049b63dc5392c75e6cd49fc77926466f68)

Files changed (3) hide show
  1. README.md +8 -3
  2. data/train-00000-of-00001.parquet +3 -0
  3. onestop_qa.py +0 -166
README.md CHANGED
@@ -48,10 +48,15 @@ dataset_info:
48
  sequence: int32
49
  splits:
50
  - name: train
51
- num_bytes: 1423090
52
  num_examples: 1458
53
- download_size: 118173
54
- dataset_size: 1423090
 
 
 
 
 
55
  ---
56
 
57
  # Dataset Card for OneStopQA
 
48
  sequence: int32
49
  splits:
50
  - name: train
51
+ num_bytes: 1423066
52
  num_examples: 1458
53
+ download_size: 218736
54
+ dataset_size: 1423066
55
+ configs:
56
+ - config_name: default
57
+ data_files:
58
+ - split: train
59
+ path: data/train-*
60
  ---
61
 
62
  # Dataset Card for OneStopQA
data/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fe10e4a2bd7488614df3d2084436b2050e6b8bed8ff23aed53da1da785baa48e
3
+ size 218736
onestop_qa.py DELETED
@@ -1,166 +0,0 @@
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