Datasets:

Modalities:
Text
Formats:
parquet
Sub-tasks:
extractive-qa
Languages:
English
ArXiv:
Libraries:
Datasets
pandas
License:
system HF staff commited on
Commit
0b7cc9e
0 Parent(s):

Update files from the datasets library (from 1.0.0)

Browse files

Release notes: https://github.com/huggingface/datasets/releases/tag/1.0.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
dataset_infos.json ADDED
@@ -0,0 +1 @@
 
 
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"}}, "supervised_keys": null, "builder_name": "squad", "config_name": "plain_text", "version": {"version_str": "1.0.0", "description": "", "datasets_version_to_prepare": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 79426386, "num_examples": 87599, "dataset_name": "squad"}, "validation": {"name": "validation", "num_bytes": 10491883, "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, "dataset_size": 89918269, "size_in_bytes": 125060820}}
dummy/plain_text/1.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5248bc997c6de0a053ebd1f73cc2fc94900bd7ddcb0483ebfabf4785ab938ef1
3
+ size 1502
dummy/plain_text/1.0.0/dummy_data/dev ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "data": [
3
+ { "title": "dev test",
4
+ "paragraphs": [
5
+ { "context": "This is a test context.",
6
+ "qas": [
7
+ { "question": "Is this a test?",
8
+ "id": "2",
9
+ "answers": [
10
+ { "answer_start": 6,
11
+ "text": "This is a test text"
12
+ }
13
+ ]
14
+ }
15
+ ]
16
+ }
17
+ ]
18
+ }
19
+ ]
20
+ }
21
+
22
+
23
+
24
+
25
+
dummy/plain_text/1.0.0/dummy_data/train ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "data": [
3
+ { "title": "train test",
4
+ "paragraphs": [
5
+ { "context": "This is a test context.",
6
+ "qas": [
7
+ { "question": "Is this a test?",
8
+ "id": "1",
9
+ "answers": [
10
+ { "answer_start": 1,
11
+ "text": "This is a test text"
12
+ }
13
+ ]
14
+ }
15
+ ]
16
+ }
17
+ ]
18
+ }
19
+ ]
20
+ }
21
+
22
+
23
+
24
+
25
+
squad.py ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ from __future__ import absolute_import, division, print_function
20
+
21
+ import json
22
+ import logging
23
+ import os
24
+
25
+ import datasets
26
+
27
+
28
+ _CITATION = """\
29
+ @article{2016arXiv160605250R,
30
+ author = {{Rajpurkar}, Pranav and {Zhang}, Jian and {Lopyrev},
31
+ Konstantin and {Liang}, Percy},
32
+ title = "{SQuAD: 100,000+ Questions for Machine Comprehension of Text}",
33
+ journal = {arXiv e-prints},
34
+ year = 2016,
35
+ eid = {arXiv:1606.05250},
36
+ pages = {arXiv:1606.05250},
37
+ archivePrefix = {arXiv},
38
+ eprint = {1606.05250},
39
+ }
40
+ """
41
+
42
+ _DESCRIPTION = """\
43
+ Stanford Question Answering Dataset (SQuAD) is a reading comprehension \
44
+ dataset, consisting of questions posed by crowdworkers on a set of Wikipedia \
45
+ articles, where the answer to every question is a segment of text, or span, \
46
+ from the corresponding reading passage, or the question might be unanswerable.
47
+ """
48
+
49
+
50
+ class SquadConfig(datasets.BuilderConfig):
51
+ """BuilderConfig for SQUAD."""
52
+
53
+ def __init__(self, **kwargs):
54
+ """BuilderConfig for SQUAD.
55
+
56
+ Args:
57
+ **kwargs: keyword arguments forwarded to super.
58
+ """
59
+ super(SquadConfig, self).__init__(**kwargs)
60
+
61
+
62
+ class Squad(datasets.GeneratorBasedBuilder):
63
+ """SQUAD: The Stanford Question Answering Dataset. Version 1.1."""
64
+
65
+ _URL = "https://rajpurkar.github.io/SQuAD-explorer/dataset/"
66
+ _DEV_FILE = "dev-v1.1.json"
67
+ _TRAINING_FILE = "train-v1.1.json"
68
+
69
+ BUILDER_CONFIGS = [
70
+ SquadConfig(
71
+ name="plain_text",
72
+ version=datasets.Version("1.0.0", ""),
73
+ description="Plain text",
74
+ ),
75
+ ]
76
+
77
+ def _info(self):
78
+ return datasets.DatasetInfo(
79
+ description=_DESCRIPTION,
80
+ features=datasets.Features(
81
+ {
82
+ "id": datasets.Value("string"),
83
+ "title": datasets.Value("string"),
84
+ "context": datasets.Value("string"),
85
+ "question": datasets.Value("string"),
86
+ "answers": datasets.features.Sequence(
87
+ {
88
+ "text": datasets.Value("string"),
89
+ "answer_start": datasets.Value("int32"),
90
+ }
91
+ ),
92
+ }
93
+ ),
94
+ # No default supervised_keys (as we have to pass both question
95
+ # and context as input).
96
+ supervised_keys=None,
97
+ homepage="https://rajpurkar.github.io/SQuAD-explorer/",
98
+ citation=_CITATION,
99
+ )
100
+
101
+ def _split_generators(self, dl_manager):
102
+ urls_to_download = {
103
+ "train": os.path.join(self._URL, self._TRAINING_FILE),
104
+ "dev": os.path.join(self._URL, self._DEV_FILE),
105
+ }
106
+ downloaded_files = dl_manager.download_and_extract(urls_to_download)
107
+
108
+ return [
109
+ datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_files["train"]}),
110
+ datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": downloaded_files["dev"]}),
111
+ ]
112
+
113
+ def _generate_examples(self, filepath):
114
+ """This function returns the examples in the raw (text) form."""
115
+ logging.info("generating examples from = %s", filepath)
116
+ with open(filepath, encoding="utf-8") as f:
117
+ squad = json.load(f)
118
+ for article in squad["data"]:
119
+ title = article.get("title", "").strip()
120
+ for paragraph in article["paragraphs"]:
121
+ context = paragraph["context"].strip()
122
+ for qa in paragraph["qas"]:
123
+ question = qa["question"].strip()
124
+ id_ = qa["id"]
125
+
126
+ answer_starts = [answer["answer_start"] for answer in qa["answers"]]
127
+ answers = [answer["text"].strip() for answer in qa["answers"]]
128
+
129
+ # Features currently used are "context", "question", and "answers".
130
+ # Others are extracted here for the ease of future expansions.
131
+ yield id_, {
132
+ "title": title,
133
+ "context": context,
134
+ "question": question,
135
+ "id": id_,
136
+ "answers": {
137
+ "answer_start": answer_starts,
138
+ "text": answers,
139
+ },
140
+ }