Datasets:
Tasks:
Question Answering
Modalities:
Text
Formats:
parquet
Languages:
English
Size:
10K - 100K
ArXiv:
License:
Commit
•
02e4e4e
0
Parent(s):
Update files from the datasets library (from 1.11.0)
Browse filesRelease notes: https://github.com/huggingface/datasets/releases/tag/1.11.0
- .gitattributes +27 -0
- README.md +179 -0
- dataset_infos.json +1 -0
- disfl_qa.py +199 -0
- dummy/1.1.0/dummy_data.zip +3 -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,179 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
annotations_creators:
|
3 |
+
- expert-generated
|
4 |
+
language_creators:
|
5 |
+
- found
|
6 |
+
languages:
|
7 |
+
- en
|
8 |
+
licenses:
|
9 |
+
- cc-by-4-0
|
10 |
+
multilinguality:
|
11 |
+
- monolingual
|
12 |
+
pretty_name: 'DISFL-QA: A Benchmark Dataset for Understanding Disfluencies in Question
|
13 |
+
Answering'
|
14 |
+
size_categories:
|
15 |
+
- 10K<n<100K
|
16 |
+
source_datasets:
|
17 |
+
- original
|
18 |
+
task_categories:
|
19 |
+
- question-answering
|
20 |
+
task_ids:
|
21 |
+
- extractive-qa
|
22 |
+
- open-domain-qa
|
23 |
+
---
|
24 |
+
|
25 |
+
# Dataset Card for DISFL-QA: A Benchmark Dataset for Understanding Disfluencies in Question Answering
|
26 |
+
|
27 |
+
## Table of Contents
|
28 |
+
- [Table of Contents](#table-of-contents)
|
29 |
+
- [Dataset Description](#dataset-description)
|
30 |
+
- [Dataset Summary](#dataset-summary)
|
31 |
+
- [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
|
32 |
+
- [Languages](#languages)
|
33 |
+
- [Dataset Structure](#dataset-structure)
|
34 |
+
- [Data Instances](#data-instances)
|
35 |
+
- [Data Fields](#data-fields)
|
36 |
+
- [Data Splits](#data-splits)
|
37 |
+
- [Dataset Creation](#dataset-creation)
|
38 |
+
- [Curation Rationale](#curation-rationale)
|
39 |
+
- [Source Data](#source-data)
|
40 |
+
- [Annotations](#annotations)
|
41 |
+
- [Personal and Sensitive Information](#personal-and-sensitive-information)
|
42 |
+
- [Considerations for Using the Data](#considerations-for-using-the-data)
|
43 |
+
- [Social Impact of Dataset](#social-impact-of-dataset)
|
44 |
+
- [Discussion of Biases](#discussion-of-biases)
|
45 |
+
- [Other Known Limitations](#other-known-limitations)
|
46 |
+
- [Additional Information](#additional-information)
|
47 |
+
- [Dataset Curators](#dataset-curators)
|
48 |
+
- [Licensing Information](#licensing-information)
|
49 |
+
- [Citation Information](#citation-information)
|
50 |
+
- [Contributions](#contributions)
|
51 |
+
|
52 |
+
## Dataset Description
|
53 |
+
|
54 |
+
- **Homepage:** [Disfl-QA](https://github.com/google-research-datasets/disfl-qa)
|
55 |
+
- **Paper:** [Disfl-QA: A Benchmark Dataset for Understanding Disfluencies in Question Answering](https://arxiv.org/pdf/2106.04016.pdf)
|
56 |
+
- **Point of Contact:** [disfl-qa team](disfl-qa@google.com)
|
57 |
+
|
58 |
+
### Dataset Summary
|
59 |
+
|
60 |
+
Disfl-QA is a targeted dataset for contextual disfluencies in an information seeking setting, namely question answering over Wikipedia passages. Disfl-QA builds upon the SQuAD-v2 ([Rajpurkar et al., 2018](https://www.aclweb.org/anthology/P18-2124/)) dataset, where each question in the dev set is annotated to add a contextual disfluency using the paragraph as a source of distractors.
|
61 |
+
|
62 |
+
The final dataset consists of ~12k (disfluent question, answer) pairs. Over 90\% of the disfluencies are corrections or restarts, making it a much harder test set for disfluency correction. Disfl-QA aims to fill a major gap between speech and NLP research community. The authors hope the dataset can serve as a benchmark dataset for testing robustness of models against disfluent inputs.
|
63 |
+
|
64 |
+
The expriments reveal that the state-of-the-art models are brittle when subjected to disfluent inputs from Disfl-QA. Detailed experiments and analyses can be found in the [paper](https://arxiv.org/pdf/2106.04016.pdf).
|
65 |
+
|
66 |
+
### Supported Tasks and Leaderboards
|
67 |
+
|
68 |
+
[More Information Needed]
|
69 |
+
|
70 |
+
### Languages
|
71 |
+
|
72 |
+
The dataset is in English only.
|
73 |
+
|
74 |
+
## Dataset Structure
|
75 |
+
|
76 |
+
### Data Instances
|
77 |
+
|
78 |
+
This example was too long and was cropped:
|
79 |
+
```
|
80 |
+
{
|
81 |
+
"answers": {
|
82 |
+
"answer_start": [94, 87, 94, 94],
|
83 |
+
"text": ["10th and 11th centuries", "in the 10th and 11th centuries", "10th and 11th centuries", "10th and 11th centuries"]
|
84 |
+
},
|
85 |
+
"context": "\"The Normans (Norman: Nourmands; French: Normands; Latin: Normanni) were the people who in the 10th and 11th centuries gave thei...",
|
86 |
+
"id": "56ddde6b9a695914005b9629",
|
87 |
+
"original question": "When were the Normans in Normandy?",
|
88 |
+
"disfluent question": "From which countries no tell me when were the Normans in Normandy?"
|
89 |
+
"title": "Normans"
|
90 |
+
}
|
91 |
+
```
|
92 |
+
### Data Fields
|
93 |
+
|
94 |
+
- `id`: a `string` feature.
|
95 |
+
- `title`: a `string` feature.
|
96 |
+
- `context`: a `string` feature.
|
97 |
+
- `original question`: Original question from SQuAD-v2 (a `string` feature)
|
98 |
+
- `disfluent question`: Disfluent question from Disfl-QA (a `string` feature)
|
99 |
+
- `answers`: a dictionary feature containing:
|
100 |
+
- `text`: a `string` feature.
|
101 |
+
- `answer_start`: a `int32` feature.
|
102 |
+
|
103 |
+
### Data Splits
|
104 |
+
|
105 |
+
Disfl-QA consists of ~12k disfluent questions with the following train/dev/test splits:
|
106 |
+
| File | Questions |
|
107 |
+
|-----|-----|
|
108 |
+
|train.json | 7182 |
|
109 |
+
|dev.json | 1000 |
|
110 |
+
|test.json | 3643 |
|
111 |
+
|
112 |
+
## Dataset Creation
|
113 |
+
|
114 |
+
### Curation Rationale
|
115 |
+
|
116 |
+
The research in NLP and speech community has been impeded by the lack of curated datasets containing such disfluencies. The datasets available today are mostly conversational in nature, and span a limited number of very specific domains (e.g., telephone conversations, court proceedings). Furthermore, only a small fraction of the utterances in these datasets contain disfluencies, with a limited and skewed distribution of disfluencies types. In the most popular dataset in the literature, the SWITCHBOARD corpus (Godfrey et al., 1992), only 5.9% of the words are disfluencies (Charniak and Johnson, 2001), of which > 50% are repetitions (Shriberg, 1996), which has been shown to be the relatively simpler form of disfluencies (Zayats et al., 2014; Jamshid Lou et al., 2018; Zayats et al., 2019). To fill this gap, the authors presented DISFL-QA, the first dataset containing contextual disfluencies in an information seeking setting, namely question answering over Wikipedia passages.
|
117 |
+
|
118 |
+
### Source Data
|
119 |
+
|
120 |
+
#### Initial Data Collection and Normalization
|
121 |
+
|
122 |
+
DISFL-QA is constructed by asking human raters to insert disfluencies in questions from SQUAD-v2, a popular question answering dataset, using the passage and remaining questions as context. These contextual disfluencies lend naturalness to DISFL-QA, and challenge models relying on shallow matching between question and context to predict an answer.
|
123 |
+
|
124 |
+
#### Who are the source language producers?
|
125 |
+
|
126 |
+
[More Information Needed]
|
127 |
+
|
128 |
+
### Annotations
|
129 |
+
|
130 |
+
#### Annotation process
|
131 |
+
|
132 |
+
Each question associated with the paragraph is sent for a human annotation task to add a contextual disfluency using the paragraph as a source of distractors. Finally, to ensure the quality of the dataset, a subsequent round of human evaluation with an option to re-annotate is conducted.
|
133 |
+
|
134 |
+
#### Who are the annotators?
|
135 |
+
|
136 |
+
[More Information Needed]
|
137 |
+
|
138 |
+
### Personal and Sensitive Information
|
139 |
+
|
140 |
+
[More Information Needed]
|
141 |
+
|
142 |
+
## Considerations for Using the Data
|
143 |
+
|
144 |
+
### Social Impact of Dataset
|
145 |
+
|
146 |
+
[More Information Needed]
|
147 |
+
|
148 |
+
### Discussion of Biases
|
149 |
+
|
150 |
+
[More Information Needed]
|
151 |
+
|
152 |
+
### Other Known Limitations
|
153 |
+
|
154 |
+
[More Information Needed]
|
155 |
+
|
156 |
+
## Additional Information
|
157 |
+
|
158 |
+
### Dataset Curators
|
159 |
+
|
160 |
+
[More Information Needed]
|
161 |
+
|
162 |
+
### Licensing Information
|
163 |
+
|
164 |
+
Disfl-QA dataset is licensed under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/).
|
165 |
+
|
166 |
+
### Citation Information
|
167 |
+
|
168 |
+
```
|
169 |
+
@inproceedings{gupta-etal-2021-disflqa,
|
170 |
+
title = "{Disfl-QA: A Benchmark Dataset for Understanding Disfluencies in Question Answering}",
|
171 |
+
author = "Gupta, Aditya and Xu, Jiacheng and Upadhyay, Shyam and Yang, Diyi and Faruqui, Manaal",
|
172 |
+
booktitle = "Findings of ACL",
|
173 |
+
year = "2021"
|
174 |
+
}
|
175 |
+
```
|
176 |
+
|
177 |
+
### Contributions
|
178 |
+
|
179 |
+
Thanks to [@bhavitvyamalik](https://github.com/bhavitvyamalik) for adding this dataset.
|
dataset_infos.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"default": {"description": "Disfl-QA is a targeted dataset for contextual disfluencies in an information seeking setting,\nnamely question answering over Wikipedia passages. Disfl-QA builds upon the SQuAD-v2 (Rajpurkar et al., 2018)\ndataset, where each question in the dev set is annotated to add a contextual disfluency using the paragraph as\na source of distractors.\n\nThe final dataset consists of ~12k (disfluent question, answer) pairs. Over 90% of the disfluencies are\ncorrections or restarts, making it a much harder test set for disfluency correction. Disfl-QA aims to fill a\nmajor gap between speech and NLP research community. We hope the dataset can serve as a benchmark dataset for\ntesting robustness of models against disfluent inputs.\n\nOur expriments reveal that the state-of-the-art models are brittle when subjected to disfluent inputs from\nDisfl-QA. Detailed experiments and analyses can be found in our paper.\n", "citation": "@inproceedings{gupta-etal-2021-disflqa,\n title = \"{Disfl-QA: A Benchmark Dataset for Understanding Disfluencies in Question Answering}\",\n author = \"Gupta, Aditya and Xu, Jiacheng and Upadhyay, Shyam and Yang, Diyi and Faruqui, Manaal\",\n booktitle = \"Findings of ACL\",\n year = \"2021\"\n}\n\n", "homepage": "https://github.com/google-research-datasets/disfl-qa", "license": "Disfl-QA dataset is licensed under CC BY 4.0", "features": {"squad_v2_id": {"dtype": "string", "id": null, "_type": "Value"}, "original question": {"dtype": "string", "id": null, "_type": "Value"}, "disfluent question": {"dtype": "string", "id": null, "_type": "Value"}, "title": {"dtype": "string", "id": null, "_type": "Value"}, "context": {"dtype": "string", "id": null, "_type": "Value"}, "answers": {"feature": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "answer_start": {"dtype": "int32", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "task_templates": [{"task": "question-answering-extractive", "question_column": "disfluent question", "context_column": "context", "answers_column": "answers"}], "builder_name": "disfl_qa", "config_name": "default", "version": {"version_str": "1.1.0", "description": null, "major": 1, "minor": 1, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 7712523, "num_examples": 7182, "dataset_name": "disfl_qa"}, "test": {"name": "test", "num_bytes": 3865097, "num_examples": 3643, "dataset_name": "disfl_qa"}, "validation": {"name": "validation", "num_bytes": 1072731, "num_examples": 1000, "dataset_name": "disfl_qa"}}, "download_checksums": {"https://rajpurkar.github.io/SQuAD-explorer/dataset/train-v2.0.json": {"num_bytes": 42123633, "checksum": "68dcfbb971bd3e96d5b46c7177b16c1a4e7d4bdef19fb204502738552dede002"}, "https://rajpurkar.github.io/SQuAD-explorer/dataset/dev-v2.0.json": {"num_bytes": 4370528, "checksum": "80a5225e94905956a6446d296ca1093975c4d3b3260f1d6c8f68bc2ab77182d8"}, "https://raw.githubusercontent.com/google-research-datasets/Disfl-QA/main/train.json": {"num_bytes": 1467771, "checksum": "5407199d0c039de5b50cfc16d1ed4a3299c9127cb549da4e4a650b30f4e000eb"}, "https://raw.githubusercontent.com/google-research-datasets/Disfl-QA/main/test.json": {"num_bytes": 771364, "checksum": "404801de916ebcb2caa82661dfd189c0520e2766db6838f6ff548088650e565e"}, "https://raw.githubusercontent.com/google-research-datasets/Disfl-QA/main/dev.json": {"num_bytes": 201742, "checksum": "b60e075b810b27a5130fd0aa2cfbc85753b71a0b30dcd2585f540f0a6afe6492"}}, "download_size": 48935038, "post_processing_size": null, "dataset_size": 12650351, "size_in_bytes": 61585389}}
|
disfl_qa.py
ADDED
@@ -0,0 +1,199 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
"""A Benchmark Dataset for Understanding Disfluencies in Question Answering"""
|
16 |
+
|
17 |
+
|
18 |
+
import json
|
19 |
+
|
20 |
+
import datasets
|
21 |
+
from datasets.tasks import QuestionAnsweringExtractive
|
22 |
+
|
23 |
+
|
24 |
+
_CITATION = """\
|
25 |
+
@inproceedings{gupta-etal-2021-disflqa,
|
26 |
+
title = "{Disfl-QA: A Benchmark Dataset for Understanding Disfluencies in Question Answering}",
|
27 |
+
author = "Gupta, Aditya and Xu, Jiacheng and Upadhyay, Shyam and Yang, Diyi and Faruqui, Manaal",
|
28 |
+
booktitle = "Findings of ACL",
|
29 |
+
year = "2021"
|
30 |
+
}
|
31 |
+
|
32 |
+
"""
|
33 |
+
|
34 |
+
_DESCRIPTION = """\
|
35 |
+
Disfl-QA is a targeted dataset for contextual disfluencies in an information seeking setting,
|
36 |
+
namely question answering over Wikipedia passages. Disfl-QA builds upon the SQuAD-v2 (Rajpurkar et al., 2018)
|
37 |
+
dataset, where each question in the dev set is annotated to add a contextual disfluency using the paragraph as
|
38 |
+
a source of distractors.
|
39 |
+
|
40 |
+
The final dataset consists of ~12k (disfluent question, answer) pairs. Over 90% of the disfluencies are
|
41 |
+
corrections or restarts, making it a much harder test set for disfluency correction. Disfl-QA aims to fill a
|
42 |
+
major gap between speech and NLP research community. We hope the dataset can serve as a benchmark dataset for
|
43 |
+
testing robustness of models against disfluent inputs.
|
44 |
+
|
45 |
+
Our expriments reveal that the state-of-the-art models are brittle when subjected to disfluent inputs from
|
46 |
+
Disfl-QA. Detailed experiments and analyses can be found in our paper.
|
47 |
+
"""
|
48 |
+
|
49 |
+
_HOMEPAGE = "https://github.com/google-research-datasets/disfl-qa"
|
50 |
+
|
51 |
+
_LICENSE = "Disfl-QA dataset is licensed under CC BY 4.0"
|
52 |
+
|
53 |
+
_URL = "https://raw.githubusercontent.com/google-research-datasets/Disfl-QA/main/"
|
54 |
+
|
55 |
+
_URLS_squad_v2 = {
|
56 |
+
"train": "https://rajpurkar.github.io/SQuAD-explorer/dataset/" + "train-v2.0.json",
|
57 |
+
"dev": "https://rajpurkar.github.io/SQuAD-explorer/dataset/" + "dev-v2.0.json",
|
58 |
+
}
|
59 |
+
|
60 |
+
|
61 |
+
class DisflQA(datasets.GeneratorBasedBuilder):
|
62 |
+
"""A Benchmark Dataset for Understanding Disfluencies in Question Answering"""
|
63 |
+
|
64 |
+
VERSION = datasets.Version("1.1.0")
|
65 |
+
|
66 |
+
def _info(self):
|
67 |
+
features = datasets.Features(
|
68 |
+
{
|
69 |
+
"squad_v2_id": datasets.Value("string"),
|
70 |
+
"original question": datasets.Value("string"),
|
71 |
+
"disfluent question": datasets.Value("string"),
|
72 |
+
"title": datasets.Value("string"),
|
73 |
+
"context": datasets.Value("string"),
|
74 |
+
"answers": datasets.features.Sequence(
|
75 |
+
{
|
76 |
+
"text": datasets.Value("string"),
|
77 |
+
"answer_start": datasets.Value("int32"),
|
78 |
+
}
|
79 |
+
),
|
80 |
+
}
|
81 |
+
)
|
82 |
+
return datasets.DatasetInfo(
|
83 |
+
# This is the description that will appear on the datasets page.
|
84 |
+
description=_DESCRIPTION,
|
85 |
+
# This defines the different columns of the dataset and their types
|
86 |
+
features=features, # Here we define them above because they are different between the two configurations
|
87 |
+
# If there's a common (input, target) tuple from the features,
|
88 |
+
# specify them here. They'll be used if as_supervised=True in
|
89 |
+
# builder.as_dataset.
|
90 |
+
supervised_keys=None,
|
91 |
+
# Homepage of the dataset for documentation
|
92 |
+
homepage=_HOMEPAGE,
|
93 |
+
# License for the dataset if available
|
94 |
+
license=_LICENSE,
|
95 |
+
# Citation for the dataset
|
96 |
+
citation=_CITATION,
|
97 |
+
task_templates=[
|
98 |
+
QuestionAnsweringExtractive(
|
99 |
+
question_column="disfluent question", context_column="context", answers_column="answers"
|
100 |
+
)
|
101 |
+
],
|
102 |
+
)
|
103 |
+
|
104 |
+
def _split_generators(self, dl_manager):
|
105 |
+
"""Returns SplitGenerators."""
|
106 |
+
|
107 |
+
squad_v2_downloaded_files = dl_manager.download_and_extract(_URLS_squad_v2)
|
108 |
+
|
109 |
+
return [
|
110 |
+
datasets.SplitGenerator(
|
111 |
+
name=datasets.Split.TRAIN,
|
112 |
+
# These kwargs will be passed to _generate_examples
|
113 |
+
gen_kwargs={
|
114 |
+
"filepath": dl_manager.download_and_extract(_URL + "train.json"),
|
115 |
+
"split": "train",
|
116 |
+
"squad_v2_data": squad_v2_downloaded_files,
|
117 |
+
},
|
118 |
+
),
|
119 |
+
datasets.SplitGenerator(
|
120 |
+
name=datasets.Split.TEST,
|
121 |
+
# These kwargs will be passed to _generate_examples
|
122 |
+
gen_kwargs={
|
123 |
+
"filepath": dl_manager.download_and_extract(_URL + "test.json"),
|
124 |
+
"split": "test",
|
125 |
+
"squad_v2_data": squad_v2_downloaded_files,
|
126 |
+
},
|
127 |
+
),
|
128 |
+
datasets.SplitGenerator(
|
129 |
+
name=datasets.Split.VALIDATION,
|
130 |
+
# These kwargs will be passed to _generate_examples
|
131 |
+
gen_kwargs={
|
132 |
+
"filepath": dl_manager.download_and_extract(_URL + "dev.json"),
|
133 |
+
"split": "dev",
|
134 |
+
"squad_v2_data": squad_v2_downloaded_files,
|
135 |
+
},
|
136 |
+
),
|
137 |
+
]
|
138 |
+
|
139 |
+
def _generate_examples(
|
140 |
+
self,
|
141 |
+
filepath,
|
142 |
+
split,
|
143 |
+
squad_v2_data, # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
144 |
+
):
|
145 |
+
"""Yields examples as (key, example) tuples."""
|
146 |
+
|
147 |
+
merge_squad_v2_json = {}
|
148 |
+
|
149 |
+
for file in squad_v2_data:
|
150 |
+
with open(squad_v2_data[file], encoding="utf-8") as f:
|
151 |
+
merge_squad_v2_json.update(json.load(f))
|
152 |
+
|
153 |
+
squad_v2_dict = _helper_dict(merge_squad_v2_json) # contains all squad_v2 data in a dict with id as key
|
154 |
+
|
155 |
+
with open(filepath, encoding="utf-8") as f:
|
156 |
+
glob_id = 0
|
157 |
+
for id_, row in enumerate(f):
|
158 |
+
data = json.loads(row)
|
159 |
+
for i in data:
|
160 |
+
yield glob_id, {
|
161 |
+
"squad_v2_id": i,
|
162 |
+
"disfluent question": data[i]["disfluent"],
|
163 |
+
"title": squad_v2_dict[i]["title"],
|
164 |
+
"context": squad_v2_dict[i]["context"],
|
165 |
+
"original question": squad_v2_dict[i]["question"],
|
166 |
+
"answers": {
|
167 |
+
"answer_start": squad_v2_dict[i]["answers"]["answer_start"],
|
168 |
+
"text": squad_v2_dict[i]["answers"]["text"],
|
169 |
+
},
|
170 |
+
}
|
171 |
+
glob_id += 1
|
172 |
+
|
173 |
+
|
174 |
+
def _helper_dict(row_squad_v2: dict): # creates dict with id as key for combined squad_v2
|
175 |
+
|
176 |
+
squad_v2_dict = {}
|
177 |
+
|
178 |
+
for example in row_squad_v2["data"]:
|
179 |
+
title = example.get("title", "").strip()
|
180 |
+
for paragraph in example["paragraphs"]:
|
181 |
+
context = paragraph["context"].strip()
|
182 |
+
for qa in paragraph["qas"]:
|
183 |
+
question = qa["question"].strip()
|
184 |
+
id_ = qa["id"]
|
185 |
+
|
186 |
+
answer_starts = [answer["answer_start"] for answer in qa["answers"]]
|
187 |
+
answers = [answer["text"].strip() for answer in qa["answers"]]
|
188 |
+
|
189 |
+
squad_v2_dict[id_] = {
|
190 |
+
"title": title,
|
191 |
+
"context": context,
|
192 |
+
"question": question,
|
193 |
+
"id": id_,
|
194 |
+
"answers": {
|
195 |
+
"answer_start": answer_starts,
|
196 |
+
"text": answers,
|
197 |
+
},
|
198 |
+
}
|
199 |
+
return squad_v2_dict
|
dummy/1.1.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:77dbcd571d08b1e4abe2267aec2712cd516703c3126124e6de940a669e6cd189
|
3 |
+
size 5707
|