Datasets:
Tasks:
Question Answering
Modalities:
Text
Formats:
parquet
Sub-tasks:
extractive-qa
Languages:
English
Size:
10K - 100K
ArXiv:
License:
Commit
·
c917420
1
Parent(s):
33c0018
Update parquet files
Browse files- .gitattributes +0 -27
- README.md +0 -240
- dataset_infos.json +0 -1
- plain_text/squad-train.parquet +3 -0
- plain_text/squad-validation.parquet +3 -0
- squad.py +0 -142
.gitattributes
DELETED
@@ -1,27 +0,0 @@
|
|
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
DELETED
@@ -1,240 +0,0 @@
|
|
1 |
-
---
|
2 |
-
pretty_name: SQuAD
|
3 |
-
annotations_creators:
|
4 |
-
- crowdsourced
|
5 |
-
language_creators:
|
6 |
-
- crowdsourced
|
7 |
-
- found
|
8 |
-
language:
|
9 |
-
- en
|
10 |
-
license:
|
11 |
-
- cc-by-4.0
|
12 |
-
multilinguality:
|
13 |
-
- monolingual
|
14 |
-
size_categories:
|
15 |
-
- 10K<n<100K
|
16 |
-
source_datasets:
|
17 |
-
- extended|wikipedia
|
18 |
-
task_categories:
|
19 |
-
- question-answering
|
20 |
-
task_ids:
|
21 |
-
- extractive-qa
|
22 |
-
paperswithcode_id: squad
|
23 |
-
train-eval-index:
|
24 |
-
- config: plain_text
|
25 |
-
task: question-answering
|
26 |
-
task_id: extractive_question_answering
|
27 |
-
splits:
|
28 |
-
train_split: train
|
29 |
-
eval_split: validation
|
30 |
-
col_mapping:
|
31 |
-
question: question
|
32 |
-
context: context
|
33 |
-
answers:
|
34 |
-
text: text
|
35 |
-
answer_start: answer_start
|
36 |
-
metrics:
|
37 |
-
- type: squad
|
38 |
-
name: SQuAD
|
39 |
-
dataset_info:
|
40 |
-
features:
|
41 |
-
- name: id
|
42 |
-
dtype: string
|
43 |
-
- name: title
|
44 |
-
dtype: string
|
45 |
-
- name: context
|
46 |
-
dtype: string
|
47 |
-
- name: question
|
48 |
-
dtype: string
|
49 |
-
- name: answers
|
50 |
-
sequence:
|
51 |
-
- name: text
|
52 |
-
dtype: string
|
53 |
-
- name: answer_start
|
54 |
-
dtype: int32
|
55 |
-
config_name: plain_text
|
56 |
-
splits:
|
57 |
-
- name: train
|
58 |
-
num_bytes: 79317110
|
59 |
-
num_examples: 87599
|
60 |
-
- name: validation
|
61 |
-
num_bytes: 10472653
|
62 |
-
num_examples: 10570
|
63 |
-
download_size: 35142551
|
64 |
-
dataset_size: 89789763
|
65 |
-
---
|
66 |
-
|
67 |
-
# Dataset Card for "squad"
|
68 |
-
|
69 |
-
## Table of Contents
|
70 |
-
- [Dataset Card for "squad"](#dataset-card-for-squad)
|
71 |
-
- [Table of Contents](#table-of-contents)
|
72 |
-
- [Dataset Description](#dataset-description)
|
73 |
-
- [Dataset Summary](#dataset-summary)
|
74 |
-
- [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
|
75 |
-
- [Languages](#languages)
|
76 |
-
- [Dataset Structure](#dataset-structure)
|
77 |
-
- [Data Instances](#data-instances)
|
78 |
-
- [plain_text](#plain_text)
|
79 |
-
- [Data Fields](#data-fields)
|
80 |
-
- [plain_text](#plain_text-1)
|
81 |
-
- [Data Splits](#data-splits)
|
82 |
-
- [Dataset Creation](#dataset-creation)
|
83 |
-
- [Curation Rationale](#curation-rationale)
|
84 |
-
- [Source Data](#source-data)
|
85 |
-
- [Initial Data Collection and Normalization](#initial-data-collection-and-normalization)
|
86 |
-
- [Who are the source language producers?](#who-are-the-source-language-producers)
|
87 |
-
- [Annotations](#annotations)
|
88 |
-
- [Annotation process](#annotation-process)
|
89 |
-
- [Who are the annotators?](#who-are-the-annotators)
|
90 |
-
- [Personal and Sensitive Information](#personal-and-sensitive-information)
|
91 |
-
- [Considerations for Using the Data](#considerations-for-using-the-data)
|
92 |
-
- [Social Impact of Dataset](#social-impact-of-dataset)
|
93 |
-
- [Discussion of Biases](#discussion-of-biases)
|
94 |
-
- [Other Known Limitations](#other-known-limitations)
|
95 |
-
- [Additional Information](#additional-information)
|
96 |
-
- [Dataset Curators](#dataset-curators)
|
97 |
-
- [Licensing Information](#licensing-information)
|
98 |
-
- [Citation Information](#citation-information)
|
99 |
-
- [Contributions](#contributions)
|
100 |
-
|
101 |
-
## Dataset Description
|
102 |
-
|
103 |
-
- **Homepage:** [https://rajpurkar.github.io/SQuAD-explorer/](https://rajpurkar.github.io/SQuAD-explorer/)
|
104 |
-
- **Repository:** [More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
105 |
-
- **Paper:** [More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
106 |
-
- **Point of Contact:** [More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
107 |
-
- **Size of downloaded dataset files:** 33.51 MB
|
108 |
-
- **Size of the generated dataset:** 85.75 MB
|
109 |
-
- **Total amount of disk used:** 119.27 MB
|
110 |
-
|
111 |
-
### Dataset Summary
|
112 |
-
|
113 |
-
Stanford Question Answering Dataset (SQuAD) is a reading comprehension dataset, consisting of questions posed by crowdworkers on a set of Wikipedia articles, where the answer to every question is a segment of text, or span, from the corresponding reading passage, or the question might be unanswerable.
|
114 |
-
|
115 |
-
### Supported Tasks and Leaderboards
|
116 |
-
|
117 |
-
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
118 |
-
|
119 |
-
### Languages
|
120 |
-
|
121 |
-
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
122 |
-
|
123 |
-
## Dataset Structure
|
124 |
-
|
125 |
-
### Data Instances
|
126 |
-
|
127 |
-
#### plain_text
|
128 |
-
|
129 |
-
- **Size of downloaded dataset files:** 33.51 MB
|
130 |
-
- **Size of the generated dataset:** 85.75 MB
|
131 |
-
- **Total amount of disk used:** 119.27 MB
|
132 |
-
|
133 |
-
An example of 'train' looks as follows.
|
134 |
-
```
|
135 |
-
{
|
136 |
-
"answers": {
|
137 |
-
"answer_start": [1],
|
138 |
-
"text": ["This is a test text"]
|
139 |
-
},
|
140 |
-
"context": "This is a test context.",
|
141 |
-
"id": "1",
|
142 |
-
"question": "Is this a test?",
|
143 |
-
"title": "train test"
|
144 |
-
}
|
145 |
-
```
|
146 |
-
|
147 |
-
### Data Fields
|
148 |
-
|
149 |
-
The data fields are the same among all splits.
|
150 |
-
|
151 |
-
#### plain_text
|
152 |
-
- `id`: a `string` feature.
|
153 |
-
- `title`: a `string` feature.
|
154 |
-
- `context`: a `string` feature.
|
155 |
-
- `question`: a `string` feature.
|
156 |
-
- `answers`: a dictionary feature containing:
|
157 |
-
- `text`: a `string` feature.
|
158 |
-
- `answer_start`: a `int32` feature.
|
159 |
-
|
160 |
-
### Data Splits
|
161 |
-
|
162 |
-
| name |train|validation|
|
163 |
-
|----------|----:|---------:|
|
164 |
-
|plain_text|87599| 10570|
|
165 |
-
|
166 |
-
## Dataset Creation
|
167 |
-
|
168 |
-
### Curation Rationale
|
169 |
-
|
170 |
-
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
171 |
-
|
172 |
-
### Source Data
|
173 |
-
|
174 |
-
#### Initial Data Collection and Normalization
|
175 |
-
|
176 |
-
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
177 |
-
|
178 |
-
#### Who are the source language producers?
|
179 |
-
|
180 |
-
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
181 |
-
|
182 |
-
### Annotations
|
183 |
-
|
184 |
-
#### Annotation process
|
185 |
-
|
186 |
-
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
187 |
-
|
188 |
-
#### Who are the annotators?
|
189 |
-
|
190 |
-
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
191 |
-
|
192 |
-
### Personal and Sensitive Information
|
193 |
-
|
194 |
-
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
195 |
-
|
196 |
-
## Considerations for Using the Data
|
197 |
-
|
198 |
-
### Social Impact of Dataset
|
199 |
-
|
200 |
-
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
201 |
-
|
202 |
-
### Discussion of Biases
|
203 |
-
|
204 |
-
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
205 |
-
|
206 |
-
### Other Known Limitations
|
207 |
-
|
208 |
-
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
209 |
-
|
210 |
-
## Additional Information
|
211 |
-
|
212 |
-
### Dataset Curators
|
213 |
-
|
214 |
-
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
215 |
-
|
216 |
-
### Licensing Information
|
217 |
-
|
218 |
-
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
219 |
-
|
220 |
-
### Citation Information
|
221 |
-
|
222 |
-
```
|
223 |
-
@article{2016arXiv160605250R,
|
224 |
-
author = {{Rajpurkar}, Pranav and {Zhang}, Jian and {Lopyrev},
|
225 |
-
Konstantin and {Liang}, Percy},
|
226 |
-
title = "{SQuAD: 100,000+ Questions for Machine Comprehension of Text}",
|
227 |
-
journal = {arXiv e-prints},
|
228 |
-
year = 2016,
|
229 |
-
eid = {arXiv:1606.05250},
|
230 |
-
pages = {arXiv:1606.05250},
|
231 |
-
archivePrefix = {arXiv},
|
232 |
-
eprint = {1606.05250},
|
233 |
-
}
|
234 |
-
|
235 |
-
```
|
236 |
-
|
237 |
-
|
238 |
-
### Contributions
|
239 |
-
|
240 |
-
Thanks to [@lewtun](https://github.com/lewtun), [@albertvillanova](https://github.com/albertvillanova), [@patrickvonplaten](https://github.com/patrickvonplaten), [@thomwolf](https://github.com/thomwolf) for adding this dataset.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dataset_infos.json
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
{"plain_text": {"description": "Stanford Question Answering Dataset (SQuAD) is a reading comprehension dataset, consisting of questions posed by crowdworkers on a set of Wikipedia articles, where the answer to every question is a segment of text, or span, from the corresponding reading passage, or the question might be unanswerable.\n", "citation": "@article{2016arXiv160605250R,\n author = {{Rajpurkar}, Pranav and {Zhang}, Jian and {Lopyrev},\n Konstantin and {Liang}, Percy},\n title = \"{SQuAD: 100,000+ Questions for Machine Comprehension of Text}\",\n journal = {arXiv e-prints},\n year = 2016,\n eid = {arXiv:1606.05250},\n pages = {arXiv:1606.05250},\narchivePrefix = {arXiv},\n eprint = {1606.05250},\n}\n", "homepage": "https://rajpurkar.github.io/SQuAD-explorer/", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "title": {"dtype": "string", "id": null, "_type": "Value"}, "context": {"dtype": "string", "id": null, "_type": "Value"}, "question": {"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": "question", "context_column": "context", "answers_column": "answers"}], "builder_name": "squad", "config_name": "plain_text", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 79317110, "num_examples": 87599, "dataset_name": "squad"}, "validation": {"name": "validation", "num_bytes": 10472653, "num_examples": 10570, "dataset_name": "squad"}}, "download_checksums": {"https://rajpurkar.github.io/SQuAD-explorer/dataset/train-v1.1.json": {"num_bytes": 30288272, "checksum": "3527663986b8295af4f7fcdff1ba1ff3f72d07d61a20f487cb238a6ef92fd955"}, "https://rajpurkar.github.io/SQuAD-explorer/dataset/dev-v1.1.json": {"num_bytes": 4854279, "checksum": "95aa6a52d5d6a735563366753ca50492a658031da74f301ac5238b03966972c9"}}, "download_size": 35142551, "post_processing_size": null, "dataset_size": 89789763, "size_in_bytes": 124932314}}
|
|
|
|
plain_text/squad-train.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:bb6654f5645e3a2916dd0a8d7831a68a6ddcaa7bd3c1838b6d13879a3b973ac4
|
3 |
+
size 14458313
|
plain_text/squad-validation.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1e32fb4a7ad1a8056ddad85b48cc922bf98b260387c7966af0da9d0e5579aed1
|
3 |
+
size 1819888
|
squad.py
DELETED
@@ -1,142 +0,0 @@
|
|
1 |
-
# coding=utf-8
|
2 |
-
# Copyright 2020 The TensorFlow Datasets Authors and 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 |
-
|
16 |
-
# Lint as: python3
|
17 |
-
"""SQUAD: The Stanford Question Answering Dataset."""
|
18 |
-
|
19 |
-
|
20 |
-
import json
|
21 |
-
|
22 |
-
import datasets
|
23 |
-
from datasets.tasks import QuestionAnsweringExtractive
|
24 |
-
|
25 |
-
|
26 |
-
logger = datasets.logging.get_logger(__name__)
|
27 |
-
|
28 |
-
|
29 |
-
_CITATION = """\
|
30 |
-
@article{2016arXiv160605250R,
|
31 |
-
author = {{Rajpurkar}, Pranav and {Zhang}, Jian and {Lopyrev},
|
32 |
-
Konstantin and {Liang}, Percy},
|
33 |
-
title = "{SQuAD: 100,000+ Questions for Machine Comprehension of Text}",
|
34 |
-
journal = {arXiv e-prints},
|
35 |
-
year = 2016,
|
36 |
-
eid = {arXiv:1606.05250},
|
37 |
-
pages = {arXiv:1606.05250},
|
38 |
-
archivePrefix = {arXiv},
|
39 |
-
eprint = {1606.05250},
|
40 |
-
}
|
41 |
-
"""
|
42 |
-
|
43 |
-
_DESCRIPTION = """\
|
44 |
-
Stanford Question Answering Dataset (SQuAD) is a reading comprehension \
|
45 |
-
dataset, consisting of questions posed by crowdworkers on a set of Wikipedia \
|
46 |
-
articles, where the answer to every question is a segment of text, or span, \
|
47 |
-
from the corresponding reading passage, or the question might be unanswerable.
|
48 |
-
"""
|
49 |
-
|
50 |
-
_URL = "https://rajpurkar.github.io/SQuAD-explorer/dataset/"
|
51 |
-
_URLS = {
|
52 |
-
"train": _URL + "train-v1.1.json",
|
53 |
-
"dev": _URL + "dev-v1.1.json",
|
54 |
-
}
|
55 |
-
|
56 |
-
|
57 |
-
class SquadConfig(datasets.BuilderConfig):
|
58 |
-
"""BuilderConfig for SQUAD."""
|
59 |
-
|
60 |
-
def __init__(self, **kwargs):
|
61 |
-
"""BuilderConfig for SQUAD.
|
62 |
-
|
63 |
-
Args:
|
64 |
-
**kwargs: keyword arguments forwarded to super.
|
65 |
-
"""
|
66 |
-
super(SquadConfig, self).__init__(**kwargs)
|
67 |
-
|
68 |
-
|
69 |
-
class Squad(datasets.GeneratorBasedBuilder):
|
70 |
-
"""SQUAD: The Stanford Question Answering Dataset. Version 1.1."""
|
71 |
-
|
72 |
-
BUILDER_CONFIGS = [
|
73 |
-
SquadConfig(
|
74 |
-
name="plain_text",
|
75 |
-
version=datasets.Version("1.0.0", ""),
|
76 |
-
description="Plain text",
|
77 |
-
),
|
78 |
-
]
|
79 |
-
|
80 |
-
def _info(self):
|
81 |
-
return datasets.DatasetInfo(
|
82 |
-
description=_DESCRIPTION,
|
83 |
-
features=datasets.Features(
|
84 |
-
{
|
85 |
-
"id": datasets.Value("string"),
|
86 |
-
"title": datasets.Value("string"),
|
87 |
-
"context": datasets.Value("string"),
|
88 |
-
"question": datasets.Value("string"),
|
89 |
-
"answers": datasets.features.Sequence(
|
90 |
-
{
|
91 |
-
"text": datasets.Value("string"),
|
92 |
-
"answer_start": datasets.Value("int32"),
|
93 |
-
}
|
94 |
-
),
|
95 |
-
}
|
96 |
-
),
|
97 |
-
# No default supervised_keys (as we have to pass both question
|
98 |
-
# and context as input).
|
99 |
-
supervised_keys=None,
|
100 |
-
homepage="https://rajpurkar.github.io/SQuAD-explorer/",
|
101 |
-
citation=_CITATION,
|
102 |
-
task_templates=[
|
103 |
-
QuestionAnsweringExtractive(
|
104 |
-
question_column="question", context_column="context", answers_column="answers"
|
105 |
-
)
|
106 |
-
],
|
107 |
-
)
|
108 |
-
|
109 |
-
def _split_generators(self, dl_manager):
|
110 |
-
downloaded_files = dl_manager.download_and_extract(_URLS)
|
111 |
-
|
112 |
-
return [
|
113 |
-
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_files["train"]}),
|
114 |
-
datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": downloaded_files["dev"]}),
|
115 |
-
]
|
116 |
-
|
117 |
-
def _generate_examples(self, filepath):
|
118 |
-
"""This function returns the examples in the raw (text) form."""
|
119 |
-
logger.info("generating examples from = %s", filepath)
|
120 |
-
key = 0
|
121 |
-
with open(filepath, encoding="utf-8") as f:
|
122 |
-
squad = json.load(f)
|
123 |
-
for article in squad["data"]:
|
124 |
-
title = article.get("title", "")
|
125 |
-
for paragraph in article["paragraphs"]:
|
126 |
-
context = paragraph["context"] # do not strip leading blank spaces GH-2585
|
127 |
-
for qa in paragraph["qas"]:
|
128 |
-
answer_starts = [answer["answer_start"] for answer in qa["answers"]]
|
129 |
-
answers = [answer["text"] for answer in qa["answers"]]
|
130 |
-
# Features currently used are "context", "question", and "answers".
|
131 |
-
# Others are extracted here for the ease of future expansions.
|
132 |
-
yield key, {
|
133 |
-
"title": title,
|
134 |
-
"context": context,
|
135 |
-
"question": qa["question"],
|
136 |
-
"id": qa["id"],
|
137 |
-
"answers": {
|
138 |
-
"answer_start": answer_starts,
|
139 |
-
"text": answers,
|
140 |
-
},
|
141 |
-
}
|
142 |
-
key += 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|