Datasets:
Tasks:
Multiple Choice
Modalities:
Text
Formats:
parquet
Sub-tasks:
multiple-choice-qa
Languages:
English
Size:
10K - 100K
License:
Commit
·
e4b4305
0
Parent(s):
Update files from the datasets library (from 1.1.3)
Browse filesRelease notes: https://github.com/huggingface/datasets/releases/tag/1.1.3
- .gitattributes +27 -0
- dataset_infos.json +1 -0
- dummy/quail/1.3.0/dummy_data.zip +3 -0
- quail.py +140 -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 |
+
{"quail": {"description": "QuAIL is a reading comprehension dataset. QuAIL contains 15K multi-choice questions in texts 300-350 tokens long 4 domains (news, user stories, fiction, blogs).QuAIL is balanced and annotated for question types.", "citation": "@inproceedings{DBLP:conf/aaai/RogersKDR20,\n author = {Anna Rogers and\n Olga Kovaleva and\n Matthew Downey and\n Anna Rumshisky},\n title = {Getting Closer to {AI} Complete Question Answering: {A} Set of Prerequisite\n Real Tasks},\n booktitle = {The Thirty-Fourth {AAAI} Conference on Artificial Intelligence, {AAAI}\n 2020, The Thirty-Second Innovative Applications of Artificial Intelligence\n Conference, {IAAI} 2020, The Tenth {AAAI} Symposium on Educational\n Advances in Artificial Intelligence, {EAAI} 2020, New York, NY, USA,\n February 7-12, 2020},\n pages = {8722--8731},\n publisher = {{AAAI} Press},\n year = {2020},\n url = {https://aaai.org/ojs/index.php/AAAI/article/view/6398},\n timestamp = {Thu, 04 Jun 2020 13:18:48 +0200},\n biburl = {https://dblp.org/rec/conf/aaai/RogersKDR20.bib},\n bibsource = {dblp computer science bibliography, https://dblp.org}\n}\n", "homepage": "https://text-machine-lab.github.io/blog/2020/quail/", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "context_id": {"dtype": "string", "id": null, "_type": "Value"}, "question_id": {"dtype": "string", "id": null, "_type": "Value"}, "domain": {"dtype": "string", "id": null, "_type": "Value"}, "metadata": {"author": {"dtype": "string", "id": null, "_type": "Value"}, "title": {"dtype": "string", "id": null, "_type": "Value"}, "url": {"dtype": "string", "id": null, "_type": "Value"}}, "context": {"dtype": "string", "id": null, "_type": "Value"}, "question": {"dtype": "string", "id": null, "_type": "Value"}, "question_type": {"dtype": "string", "id": null, "_type": "Value"}, "answers": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "correct_answer_id": {"dtype": "int32", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "builder_name": "quail", "config_name": "quail", "version": {"version_str": "1.3.0", "description": "", "major": 1, "minor": 3, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 23432697, "num_examples": 10246, "dataset_name": "quail"}, "validation": {"name": "validation", "num_bytes": 4989579, "num_examples": 2164, "dataset_name": "quail"}, "challenge": {"name": "challenge", "num_bytes": 1199840, "num_examples": 556, "dataset_name": "quail"}}, "download_checksums": {"https://raw.githubusercontent.com/text-machine-lab/quail/master/quail_v1.3/xml/randomized/quail_1.3_train_randomized.xml": {"num_bytes": 5064067, "checksum": "faf7849a4397485fc6134919b9ce55e40ca623915be86bce16eccfb6c4186fac"}, "https://raw.githubusercontent.com/text-machine-lab/quail/master/quail_v1.3/xml/randomized/quail_1.3_dev_randomized.xml": {"num_bytes": 1075073, "checksum": "e39b848db1a13533ee264c9eaa21a309aebf3c0394967848acb89b83ae96b8c4"}, "https://raw.githubusercontent.com/text-machine-lab/quail/master/quail_v1.3/xml/randomized/quail_1.3_challenge_randomized.xml": {"num_bytes": 263793, "checksum": "1e140e6e6b9b820e70a75a79f8bc111db6472fd0027bbcfb760e6841045478ae"}}, "download_size": 6402933, "post_processing_size": null, "dataset_size": 29622116, "size_in_bytes": 36025049}}
|
dummy/quail/1.3.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2b26679db259bfe7c4b2fd9922fe898384934d5ac74720b16c58fdc70872f26c
|
3 |
+
size 13604
|
quail.py
ADDED
@@ -0,0 +1,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import logging
|
2 |
+
import xml.etree.ElementTree as ET
|
3 |
+
|
4 |
+
import datasets
|
5 |
+
|
6 |
+
|
7 |
+
_CITATION = """\
|
8 |
+
@inproceedings{DBLP:conf/aaai/RogersKDR20,
|
9 |
+
author = {Anna Rogers and
|
10 |
+
Olga Kovaleva and
|
11 |
+
Matthew Downey and
|
12 |
+
Anna Rumshisky},
|
13 |
+
title = {Getting Closer to {AI} Complete Question Answering: {A} Set of Prerequisite
|
14 |
+
Real Tasks},
|
15 |
+
booktitle = {The Thirty-Fourth {AAAI} Conference on Artificial Intelligence, {AAAI}
|
16 |
+
2020, The Thirty-Second Innovative Applications of Artificial Intelligence
|
17 |
+
Conference, {IAAI} 2020, The Tenth {AAAI} Symposium on Educational
|
18 |
+
Advances in Artificial Intelligence, {EAAI} 2020, New York, NY, USA,
|
19 |
+
February 7-12, 2020},
|
20 |
+
pages = {8722--8731},
|
21 |
+
publisher = {{AAAI} Press},
|
22 |
+
year = {2020},
|
23 |
+
url = {https://aaai.org/ojs/index.php/AAAI/article/view/6398},
|
24 |
+
timestamp = {Thu, 04 Jun 2020 13:18:48 +0200},
|
25 |
+
biburl = {https://dblp.org/rec/conf/aaai/RogersKDR20.bib},
|
26 |
+
bibsource = {dblp computer science bibliography, https://dblp.org}
|
27 |
+
}
|
28 |
+
"""
|
29 |
+
|
30 |
+
_DESCRIPTION = """\
|
31 |
+
QuAIL is a reading comprehension dataset. \
|
32 |
+
QuAIL contains 15K multi-choice questions in texts 300-350 tokens \
|
33 |
+
long 4 domains (news, user stories, fiction, blogs).\
|
34 |
+
QuAIL is balanced and annotated for question types.\
|
35 |
+
"""
|
36 |
+
|
37 |
+
|
38 |
+
class QuailConfig(datasets.BuilderConfig):
|
39 |
+
"""BuilderConfig for QuAIL."""
|
40 |
+
|
41 |
+
def __init__(self, **kwargs):
|
42 |
+
"""BuilderConfig for QuAIL.
|
43 |
+
Args:
|
44 |
+
**kwargs: keyword arguments forwarded to super.
|
45 |
+
"""
|
46 |
+
super(QuailConfig, self).__init__(**kwargs)
|
47 |
+
|
48 |
+
|
49 |
+
class Quail(datasets.GeneratorBasedBuilder):
|
50 |
+
"""QuAIL: The Stanford Question Answering Dataset. Version 1.1."""
|
51 |
+
|
52 |
+
_CHALLENGE_SET = "https://raw.githubusercontent.com/text-machine-lab/quail/master/quail_v1.3/xml/randomized/quail_1.3_challenge_randomized.xml"
|
53 |
+
_DEV_SET = "https://raw.githubusercontent.com/text-machine-lab/quail/master/quail_v1.3/xml/randomized/quail_1.3_dev_randomized.xml"
|
54 |
+
_TRAIN_SET = "https://raw.githubusercontent.com/text-machine-lab/quail/master/quail_v1.3/xml/randomized/quail_1.3_train_randomized.xml"
|
55 |
+
|
56 |
+
BUILDER_CONFIGS = [
|
57 |
+
QuailConfig(
|
58 |
+
name="quail",
|
59 |
+
version=datasets.Version("1.3.0", ""),
|
60 |
+
description="Quail dataset 1.3.0",
|
61 |
+
),
|
62 |
+
]
|
63 |
+
|
64 |
+
def _info(self):
|
65 |
+
return datasets.DatasetInfo(
|
66 |
+
description=_DESCRIPTION,
|
67 |
+
features=datasets.Features(
|
68 |
+
{
|
69 |
+
"id": datasets.Value("string"),
|
70 |
+
"context_id": datasets.Value("string"),
|
71 |
+
"question_id": datasets.Value("string"),
|
72 |
+
"domain": datasets.Value("string"),
|
73 |
+
"metadata": {
|
74 |
+
"author": datasets.Value("string"),
|
75 |
+
"title": datasets.Value("string"),
|
76 |
+
"url": datasets.Value("string"),
|
77 |
+
},
|
78 |
+
"context": datasets.Value("string"),
|
79 |
+
"question": datasets.Value("string"),
|
80 |
+
"question_type": datasets.Value("string"),
|
81 |
+
"answers": datasets.features.Sequence(
|
82 |
+
datasets.Value("string"),
|
83 |
+
),
|
84 |
+
"correct_answer_id": datasets.Value("int32"),
|
85 |
+
}
|
86 |
+
),
|
87 |
+
# No default supervised_keys (as we have to pass both question
|
88 |
+
# and context as input).
|
89 |
+
supervised_keys=None,
|
90 |
+
homepage="https://text-machine-lab.github.io/blog/2020/quail/",
|
91 |
+
citation=_CITATION,
|
92 |
+
)
|
93 |
+
|
94 |
+
def _split_generators(self, dl_manager):
|
95 |
+
urls_to_download = {"train": self._TRAIN_SET, "dev": self._DEV_SET, "challenge": self._CHALLENGE_SET}
|
96 |
+
downloaded_files = dl_manager.download_and_extract(urls_to_download)
|
97 |
+
|
98 |
+
return [
|
99 |
+
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_files["train"]}),
|
100 |
+
datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": downloaded_files["dev"]}),
|
101 |
+
datasets.SplitGenerator(name="challenge", gen_kwargs={"filepath": downloaded_files["challenge"]}),
|
102 |
+
]
|
103 |
+
|
104 |
+
def _generate_examples(self, filepath):
|
105 |
+
"""This function returns the examples in the raw (text) form."""
|
106 |
+
logging.info("generating examples from = %s", filepath)
|
107 |
+
root = ET.parse(filepath).getroot()
|
108 |
+
for text_tag in root.iterfind("text"):
|
109 |
+
text_id = text_tag.get("id")
|
110 |
+
domain = text_tag.get("domain")
|
111 |
+
metadata_tag = text_tag.find("metadata")
|
112 |
+
author = metadata_tag.find("author").text.strip()
|
113 |
+
title = metadata_tag.find("title").text.strip()
|
114 |
+
url = metadata_tag.find("url").text.strip()
|
115 |
+
text_body = text_tag.find("text_body").text.strip()
|
116 |
+
questions_tag = text_tag.find("questions")
|
117 |
+
for q_tag in questions_tag.iterfind("q"):
|
118 |
+
question_type = q_tag.get("type", None)
|
119 |
+
question_text = q_tag.text.strip()
|
120 |
+
question_id = q_tag.get("id")
|
121 |
+
answers = []
|
122 |
+
answer_id = None
|
123 |
+
for i, a_tag in enumerate(q_tag.iterfind("a")):
|
124 |
+
if a_tag.get("correct") == "True":
|
125 |
+
answer_id = i
|
126 |
+
answers.append(a_tag.text.strip())
|
127 |
+
|
128 |
+
id_ = f"{text_id}_{question_id}"
|
129 |
+
yield id_, {
|
130 |
+
"id": id_,
|
131 |
+
"context_id": text_id,
|
132 |
+
"question_id": question_id,
|
133 |
+
"question_type": question_type,
|
134 |
+
"domain": domain,
|
135 |
+
"metadata": {"author": author, "title": title, "url": url},
|
136 |
+
"context": text_body,
|
137 |
+
"question": question_text,
|
138 |
+
"answers": answers,
|
139 |
+
"correct_answer_id": answer_id,
|
140 |
+
}
|