Datasets:

Modalities:
Text
Formats:
parquet
Languages:
English
ArXiv:
Libraries:
Datasets
pandas
License:
albertvillanova HF staff commited on
Commit
928e0b1
1 Parent(s): 3e20ab6

Convert dataset to Parquet (#4)

Browse files

- Convert dataset to Parquet (a2932a276591968a22c0e80c36008ce5fa123b0e)
- Add 'answer_selection_experiments' config data files (6b7c025019d023da040ef384a3ca4d8c64623527)
- Add 'answer_triggering_analysis' config data files (864541c6eaf5d382612f2de9fe0cb73fc29b9172)
- Add 'answer_triggering_experiments' config data files (79a946d183935921910ab64b1a13541351654424)
- Delete loading script (f4e51d554b2ffffa9e36db5daa0d6a4b0d14e22e)

README.md CHANGED
@@ -61,16 +61,16 @@ dataset_info:
61
  '6': ''
62
  splits:
63
  - name: train
64
- num_bytes: 9676758
65
  num_examples: 5529
66
  - name: test
67
- num_bytes: 2798537
68
  num_examples: 1590
69
  - name: validation
70
- num_bytes: 1378407
71
  num_examples: 785
72
- download_size: 14773444
73
- dataset_size: 13853702
74
  - config_name: answer_selection_experiments
75
  features:
76
  - name: question
@@ -85,16 +85,16 @@ dataset_info:
85
  '1': '1'
86
  splits:
87
  - name: train
88
- num_bytes: 13782826
89
  num_examples: 66438
90
  - name: test
91
- num_bytes: 4008077
92
  num_examples: 19435
93
  - name: validation
94
- num_bytes: 1954877
95
  num_examples: 9377
96
- download_size: 18602700
97
- dataset_size: 19745780
98
  - config_name: answer_triggering_analysis
99
  features:
100
  - name: section
@@ -142,16 +142,16 @@ dataset_info:
142
  sequence: int32
143
  splits:
144
  - name: train
145
- num_bytes: 30176650
146
  num_examples: 5529
147
  - name: test
148
- num_bytes: 8766787
149
  num_examples: 1590
150
  - name: validation
151
- num_bytes: 4270904
152
  num_examples: 785
153
- download_size: 46149676
154
- dataset_size: 43214341
155
  - config_name: answer_triggering_experiments
156
  features:
157
  - name: question
@@ -166,16 +166,50 @@ dataset_info:
166
  '1': '1'
167
  splits:
168
  - name: train
169
- num_bytes: 42956518
170
  num_examples: 205075
171
  - name: test
172
- num_bytes: 12504961
173
  num_examples: 59845
174
  - name: validation
175
- num_bytes: 6055616
176
  num_examples: 28798
177
- download_size: 57992239
178
- dataset_size: 61517095
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
179
  ---
180
 
181
  # Dataset Card for SelQA
 
61
  '6': ''
62
  splits:
63
  - name: train
64
+ num_bytes: 9676730
65
  num_examples: 5529
66
  - name: test
67
+ num_bytes: 2798509
68
  num_examples: 1590
69
  - name: validation
70
+ num_bytes: 1378379
71
  num_examples: 785
72
+ download_size: 7982495
73
+ dataset_size: 13853618
74
  - config_name: answer_selection_experiments
75
  features:
76
  - name: question
 
85
  '1': '1'
86
  splits:
87
  - name: train
88
+ num_bytes: 13782770
89
  num_examples: 66438
90
  - name: test
91
+ num_bytes: 4008061
92
  num_examples: 19435
93
  - name: validation
94
+ num_bytes: 1954869
95
  num_examples: 9377
96
+ download_size: 8889974
97
+ dataset_size: 19745700
98
  - config_name: answer_triggering_analysis
99
  features:
100
  - name: section
 
142
  sequence: int32
143
  splits:
144
  - name: train
145
+ num_bytes: 30176598
146
  num_examples: 5529
147
  - name: test
148
+ num_bytes: 8766735
149
  num_examples: 1590
150
  - name: validation
151
+ num_bytes: 4270852
152
  num_examples: 785
153
+ download_size: 26050344
154
+ dataset_size: 43214185
155
  - config_name: answer_triggering_experiments
156
  features:
157
  - name: question
 
166
  '1': '1'
167
  splits:
168
  - name: train
169
+ num_bytes: 42956350
170
  num_examples: 205075
171
  - name: test
172
+ num_bytes: 12504913
173
  num_examples: 59845
174
  - name: validation
175
+ num_bytes: 6055592
176
  num_examples: 28798
177
+ download_size: 25368418
178
+ dataset_size: 61516855
179
+ configs:
180
+ - config_name: answer_selection_analysis
181
+ data_files:
182
+ - split: train
183
+ path: answer_selection_analysis/train-*
184
+ - split: test
185
+ path: answer_selection_analysis/test-*
186
+ - split: validation
187
+ path: answer_selection_analysis/validation-*
188
+ default: true
189
+ - config_name: answer_selection_experiments
190
+ data_files:
191
+ - split: train
192
+ path: answer_selection_experiments/train-*
193
+ - split: test
194
+ path: answer_selection_experiments/test-*
195
+ - split: validation
196
+ path: answer_selection_experiments/validation-*
197
+ - config_name: answer_triggering_analysis
198
+ data_files:
199
+ - split: train
200
+ path: answer_triggering_analysis/train-*
201
+ - split: test
202
+ path: answer_triggering_analysis/test-*
203
+ - split: validation
204
+ path: answer_triggering_analysis/validation-*
205
+ - config_name: answer_triggering_experiments
206
+ data_files:
207
+ - split: train
208
+ path: answer_triggering_experiments/train-*
209
+ - split: test
210
+ path: answer_triggering_experiments/test-*
211
+ - split: validation
212
+ path: answer_triggering_experiments/validation-*
213
  ---
214
 
215
  # Dataset Card for SelQA
answer_selection_analysis/test-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:52426ea3d3d21e177a0f5125cb77b8677fff0d863f0ec3eae5bfd2eb25ff379d
3
+ size 1625079
answer_selection_analysis/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f21c366aab6d6d4d0275904412f801ee499d3f71f7d4d6d088a536edcefbe87f
3
+ size 5575877
answer_selection_analysis/validation-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7c7b0e9a834d470b713dc51e11d25b5532595b4f9b0a9b5d5c2310faf5fd7c2e
3
+ size 781539
answer_selection_experiments/test-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b01c16845da3c95106c11fbd2c028e7701ddbf05d134a12b2ee1ee4fbad954f9
3
+ size 1803903
answer_selection_experiments/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:03dfd0d1cff010b90dbee7308d99cbebfe93781cb81fb97958f3e9b68e05678d
3
+ size 6198251
answer_selection_experiments/validation-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3a4dc5cf99c7709820e3b28c097feb17379a4df79b3bf18b13d84738f69d746d
3
+ size 887820
answer_triggering_analysis/test-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2841324cc4e15771d7d2cf1bbdfbaa12e9179d733957d3b7e419dff1f83ab489
3
+ size 5311495
answer_triggering_analysis/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7ddbbf326430dd229203b3c2c172c4b6721c2ef97bc1a64c32f061543e9b52b7
3
+ size 18176732
answer_triggering_analysis/validation-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7cc31cb5e936e24312cb66e86dad679778f450946410b7d3204454a4d023c554
3
+ size 2562117
answer_triggering_experiments/test-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:71ebcfc8992855bbe85e16569f089754762af10ddfcb5d9028e24abea3eb3585
3
+ size 5165743
answer_triggering_experiments/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6f26211b59ff90de5eb32cf8a0fe40a9056b6afdd0470bdb62ed9e2c72c0a401
3
+ size 17708408
answer_triggering_experiments/validation-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:96d6d9cc92b0532fde3e0b548f38d1d8cfa5ebdee3bde1922105f7128129cac5
3
+ size 2494267
selqa.py DELETED
@@ -1,300 +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
- """SelQA: A New Benchmark for Selection-Based Question Answering"""
16
-
17
-
18
- import csv
19
- import json
20
-
21
- import datasets
22
-
23
-
24
- # TODO: Add BibTeX citation
25
- # Find for instance the citation on arxiv or on the dataset repo/website
26
- _CITATION = """\
27
- @InProceedings{7814688,
28
- author={T. {Jurczyk} and M. {Zhai} and J. D. {Choi}},
29
- booktitle={2016 IEEE 28th International Conference on Tools with Artificial Intelligence (ICTAI)},
30
- title={SelQA: A New Benchmark for Selection-Based Question Answering},
31
- year={2016},
32
- volume={},
33
- number={},
34
- pages={820-827},
35
- doi={10.1109/ICTAI.2016.0128}
36
- }
37
- """
38
-
39
- # TODO: Add description of the dataset here
40
- # You can copy an official description
41
- _DESCRIPTION = """\
42
- The SelQA dataset provides crowdsourced annotation for two selection-based question answer tasks,
43
- answer sentence selection and answer triggering.
44
- """
45
-
46
- # TODO: Add a link to an official homepage for the dataset here
47
- _HOMEPAGE = ""
48
-
49
- # TODO: Add the licence for the dataset here if you can find it
50
- _LICENSE = ""
51
-
52
- # TODO: Add link to the official dataset URLs here
53
- # The HuggingFace dataset library don't host the datasets but only point to the original files
54
- # This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
55
- types = {
56
- "answer_selection": "ass",
57
- "answer_triggering": "at",
58
- }
59
-
60
- modes = {"analysis": "json", "experiments": "tsv"}
61
-
62
-
63
- class SelqaConfig(datasets.BuilderConfig):
64
- """ "BuilderConfig for SelQA Dataset"""
65
-
66
- def __init__(self, mode, type_, **kwargs):
67
- super(SelqaConfig, self).__init__(**kwargs)
68
- self.mode = mode
69
- self.type_ = type_
70
-
71
-
72
- # TODO: Name of the dataset usually match the script name with CamelCase instead of snake_case
73
- class Selqa(datasets.GeneratorBasedBuilder):
74
- """A New Benchmark for Selection-based Question Answering."""
75
-
76
- VERSION = datasets.Version("1.1.0")
77
-
78
- # This is an example of a dataset with multiple configurations.
79
- # If you don't want/need to define several sub-sets in your dataset,
80
- # just remove the BUILDER_CONFIG_CLASS and the BUILDER_CONFIGS attributes.
81
-
82
- # If you need to make complex sub-parts in the datasets with configurable options
83
- # You can create your own builder configuration class to store attribute, inheriting from datasets.BuilderConfig
84
- BUILDER_CONFIG_CLASS = SelqaConfig
85
-
86
- # You will be able to load one or the other configurations in the following list with
87
- # data = datasets.load_dataset('my_dataset', 'first_domain')
88
- # data = datasets.load_dataset('my_dataset', 'second_domain')
89
- BUILDER_CONFIGS = [
90
- SelqaConfig(
91
- name="answer_selection_analysis",
92
- mode="analysis",
93
- type_="answer_selection",
94
- version=VERSION,
95
- description="This part covers answer selection analysis",
96
- ),
97
- SelqaConfig(
98
- name="answer_selection_experiments",
99
- mode="experiments",
100
- type_="answer_selection",
101
- version=VERSION,
102
- description="This part covers answer selection experiments",
103
- ),
104
- SelqaConfig(
105
- name="answer_triggering_analysis",
106
- mode="analysis",
107
- type_="answer_triggering",
108
- version=VERSION,
109
- description="This part covers answer triggering analysis",
110
- ),
111
- SelqaConfig(
112
- name="answer_triggering_experiments",
113
- mode="experiments",
114
- type_="answer_triggering",
115
- version=VERSION,
116
- description="This part covers answer triggering experiments",
117
- ),
118
- ]
119
-
120
- DEFAULT_CONFIG_NAME = "answer_selection_analysis" # It's not mandatory to have a default configuration. Just use one if it make sense.
121
-
122
- def _info(self):
123
- if (
124
- self.config.mode == "experiments"
125
- ): # This is the name of the configuration selected in BUILDER_CONFIGS above
126
- features = datasets.Features(
127
- {
128
- "question": datasets.Value("string"),
129
- "candidate": datasets.Value("string"),
130
- "label": datasets.ClassLabel(names=["0", "1"]),
131
- }
132
- )
133
- else:
134
- if self.config.type_ == "answer_selection":
135
- features = datasets.Features(
136
- {
137
- "section": datasets.Value("string"),
138
- "question": datasets.Value("string"),
139
- "article": datasets.Value("string"),
140
- "is_paraphrase": datasets.Value("bool"),
141
- "topic": datasets.ClassLabel(
142
- names=[
143
- "MUSIC",
144
- "TV",
145
- "TRAVEL",
146
- "ART",
147
- "SPORT",
148
- "COUNTRY",
149
- "MOVIES",
150
- "HISTORICAL EVENTS",
151
- "SCIENCE",
152
- "FOOD",
153
- ]
154
- ),
155
- "answers": datasets.Sequence(datasets.Value("int32")),
156
- "candidates": datasets.Sequence(datasets.Value("string")),
157
- "q_types": datasets.Sequence(
158
- datasets.ClassLabel(names=["what", "why", "when", "who", "where", "how", ""])
159
- ),
160
- }
161
- )
162
- else:
163
- features = datasets.Features(
164
- {
165
- "section": datasets.Value("string"),
166
- "question": datasets.Value("string"),
167
- "article": datasets.Value("string"),
168
- "is_paraphrase": datasets.Value("bool"),
169
- "topic": datasets.ClassLabel(
170
- names=[
171
- "MUSIC",
172
- "TV",
173
- "TRAVEL",
174
- "ART",
175
- "SPORT",
176
- "COUNTRY",
177
- "MOVIES",
178
- "HISTORICAL EVENTS",
179
- "SCIENCE",
180
- "FOOD",
181
- ]
182
- ),
183
- "q_types": datasets.Sequence(
184
- datasets.ClassLabel(names=["what", "why", "when", "who", "where", "how", ""])
185
- ),
186
- "candidate_list": datasets.Sequence(
187
- {
188
- "article": datasets.Value("string"),
189
- "section": datasets.Value("string"),
190
- "candidates": datasets.Sequence(datasets.Value("string")),
191
- "answers": datasets.Sequence(datasets.Value("int32")),
192
- }
193
- ),
194
- }
195
- )
196
- return datasets.DatasetInfo(
197
- # This is the description that will appear on the datasets page.
198
- description=_DESCRIPTION,
199
- # This defines the different columns of the dataset and their types
200
- features=features, # Here we define them above because they are different between the two configurations
201
- # If there's a common (input, target) tuple from the features,
202
- # specify them here. They'll be used if as_supervised=True in
203
- # builder.as_dataset.
204
- supervised_keys=None,
205
- # Homepage of the dataset for documentation
206
- homepage=_HOMEPAGE,
207
- # License for the dataset if available
208
- license=_LICENSE,
209
- # Citation for the dataset
210
- citation=_CITATION,
211
- )
212
-
213
- def _split_generators(self, dl_manager):
214
- """Returns SplitGenerators."""
215
- # TODO: This method is tasked with downloading/extracting the data and defining the splits depending on the configuration
216
- # If several configurations are possible (listed in BUILDER_CONFIGS), the configuration selected by the user is in self.config.name
217
-
218
- # dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLs
219
- # 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.
220
- # By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
221
- urls = {
222
- "train": f"https://raw.githubusercontent.com/emorynlp/selqa/master/{types[self.config.type_]}/selqa-{types[self.config.type_]}-train.{modes[self.config.mode]}",
223
- "dev": f"https://raw.githubusercontent.com/emorynlp/selqa/master/{types[self.config.type_]}/selqa-{types[self.config.type_]}-dev.{modes[self.config.mode]}",
224
- "test": f"https://raw.githubusercontent.com/emorynlp/selqa/master/{types[self.config.type_]}/selqa-{types[self.config.type_]}-test.{modes[self.config.mode]}",
225
- }
226
- data_dir = dl_manager.download_and_extract(urls)
227
- return [
228
- datasets.SplitGenerator(
229
- name=datasets.Split.TRAIN,
230
- # These kwargs will be passed to _generate_examples
231
- gen_kwargs={
232
- "filepath": data_dir["train"],
233
- "split": "train",
234
- },
235
- ),
236
- datasets.SplitGenerator(
237
- name=datasets.Split.TEST,
238
- # These kwargs will be passed to _generate_examples
239
- gen_kwargs={"filepath": data_dir["test"], "split": "test"},
240
- ),
241
- datasets.SplitGenerator(
242
- name=datasets.Split.VALIDATION,
243
- # These kwargs will be passed to _generate_examples
244
- gen_kwargs={
245
- "filepath": data_dir["dev"],
246
- "split": "dev",
247
- },
248
- ),
249
- ]
250
-
251
- def _generate_examples(self, filepath, split):
252
- """Yields examples."""
253
- # TODO: This method will receive as arguments the `gen_kwargs` defined in the previous `_split_generators` method.
254
- # It is in charge of opening the given file and yielding (key, example) tuples from the dataset
255
- # The key is not important, it's more here for legacy reason (legacy from tfds)
256
- with open(filepath, encoding="utf-8") as f:
257
- if self.config.mode == "experiments":
258
- csv_reader = csv.DictReader(
259
- f, delimiter="\t", quoting=csv.QUOTE_NONE, fieldnames=["question", "candidate", "label"]
260
- )
261
- for id_, row in enumerate(csv_reader):
262
- yield id_, row
263
- else:
264
- if self.config.type_ == "answer_selection":
265
- for row in f:
266
- data = json.loads(row)
267
- for id_, item in enumerate(data):
268
- yield id_, {
269
- "section": item["section"],
270
- "question": item["question"],
271
- "article": item["article"],
272
- "is_paraphrase": item["is_paraphrase"],
273
- "topic": item["topic"],
274
- "answers": item["answers"],
275
- "candidates": item["candidates"],
276
- "q_types": item["q_types"],
277
- }
278
- else:
279
- for row in f:
280
- data = json.loads(row)
281
- for id_, item in enumerate(data):
282
- candidate_list = []
283
- for entity in item["candidate_list"]:
284
- candidate_list.append(
285
- {
286
- "article": entity["article"],
287
- "section": entity["section"],
288
- "answers": entity["answers"],
289
- "candidates": entity["candidates"],
290
- }
291
- )
292
- yield id_, {
293
- "section": item["section"],
294
- "question": item["question"],
295
- "article": item["article"],
296
- "is_paraphrase": item["is_paraphrase"],
297
- "topic": item["topic"],
298
- "q_types": item["q_types"],
299
- "candidate_list": candidate_list,
300
- }