Datasets:
Tasks:
Question Answering
Modalities:
Text
Formats:
parquet
Sub-tasks:
open-domain-qa
Languages:
English
Size:
10K - 100K
License:
Commit
•
d4635b4
1
Parent(s):
789f9d6
Fix typo in train split name (#3751)
Browse files* Fix typo in README guide
* Fix split naming and table alignment in README guide
* Fix split naming and table alignment in all datasets
* Fix previously malformed dataset cards
* Fix previously malformed dataset cards
Commit from https://github.com/huggingface/datasets/commit/af6e54febe3b822118dfed28ddb797d8350e5d27
- README.md +23 -6
- natural_questions.py +17 -13
README.md
CHANGED
@@ -1,11 +1,27 @@
|
|
1 |
---
|
|
|
|
|
|
|
|
|
2 |
languages:
|
3 |
- en
|
4 |
-
|
|
|
|
|
|
|
5 |
pretty_name: Natural Questions
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
---
|
7 |
|
8 |
-
# Dataset Card for
|
9 |
|
10 |
## Table of Contents
|
11 |
- [Dataset Description](#dataset-description)
|
@@ -104,9 +120,10 @@ The data fields are the same among all splits.
|
|
104 |
|
105 |
### Data Splits
|
106 |
|
107 |
-
| name
|
108 |
-
|
109 |
-
|default|307373|
|
|
|
110 |
|
111 |
## Dataset Creation
|
112 |
|
@@ -160,7 +177,7 @@ The data fields are the same among all splits.
|
|
160 |
|
161 |
### Licensing Information
|
162 |
|
163 |
-
[
|
164 |
|
165 |
### Citation Information
|
166 |
|
|
|
1 |
---
|
2 |
+
annotations_creators:
|
3 |
+
- no-annotation
|
4 |
+
language_creators:
|
5 |
+
- crowdsourced
|
6 |
languages:
|
7 |
- en
|
8 |
+
licenses:
|
9 |
+
- cc-by-sa-3-0
|
10 |
+
multilinguality:
|
11 |
+
- monolingual
|
12 |
pretty_name: Natural Questions
|
13 |
+
size_categories:
|
14 |
+
- 100K<n<1M
|
15 |
+
source_datasets:
|
16 |
+
- original
|
17 |
+
task_categories:
|
18 |
+
- question-answering
|
19 |
+
task_ids:
|
20 |
+
- open-domain-qa
|
21 |
+
paperswithcode_id: natural-questions
|
22 |
---
|
23 |
|
24 |
+
# Dataset Card for Natural Questions
|
25 |
|
26 |
## Table of Contents
|
27 |
- [Dataset Description](#dataset-description)
|
|
|
120 |
|
121 |
### Data Splits
|
122 |
|
123 |
+
| name | train | validation |
|
124 |
+
|---------|-------:|-----------:|
|
125 |
+
| default | 307373 | 7830 |
|
126 |
+
| dev | N/A | 7830 |
|
127 |
|
128 |
## Dataset Creation
|
129 |
|
|
|
177 |
|
178 |
### Licensing Information
|
179 |
|
180 |
+
[Creative Commons Attribution-ShareAlike 3.0 Unported](https://creativecommons.org/licenses/by-sa/3.0/).
|
181 |
|
182 |
### Citation Information
|
183 |
|
natural_questions.py
CHANGED
@@ -51,12 +51,17 @@ _DOWNLOAD_URLS = {
|
|
51 |
"validation": ["%s/dev/nq-dev-%02d.jsonl.gz" % (_BASE_DOWNLOAD_URL, i) for i in range(5)],
|
52 |
}
|
53 |
|
|
|
|
|
54 |
|
55 |
class NaturalQuestions(datasets.BeamBasedBuilder):
|
56 |
"""Natural Questions: A Benchmark for Question Answering Research."""
|
57 |
|
58 |
-
|
59 |
-
|
|
|
|
|
|
|
60 |
|
61 |
def _info(self):
|
62 |
return datasets.DatasetInfo(
|
@@ -108,20 +113,19 @@ class NaturalQuestions(datasets.BeamBasedBuilder):
|
|
108 |
|
109 |
def _split_generators(self, dl_manager, pipeline):
|
110 |
"""Returns SplitGenerators."""
|
111 |
-
|
112 |
-
|
|
|
|
|
113 |
if not pipeline.is_local():
|
114 |
files = dl_manager.ship_files_with_pipeline(files, pipeline)
|
115 |
-
|
116 |
return [
|
117 |
datasets.SplitGenerator(
|
118 |
-
name=
|
119 |
-
gen_kwargs={"filepaths": files[
|
120 |
-
)
|
121 |
-
datasets.
|
122 |
-
|
123 |
-
gen_kwargs={"filepaths": files["validation"]},
|
124 |
-
),
|
125 |
]
|
126 |
|
127 |
def _build_pcollection(self, pipeline, filepaths):
|
@@ -133,7 +137,7 @@ class NaturalQuestions(datasets.BeamBasedBuilder):
|
|
133 |
html_bytes = ex_json["document_html"].encode("utf-8")
|
134 |
|
135 |
def _parse_short_answer(short_ans):
|
136 |
-
"""
|
137 |
ans_bytes = html_bytes[short_ans["start_byte"] : short_ans["end_byte"]]
|
138 |
# Remove non-breaking spaces.
|
139 |
ans_bytes = ans_bytes.replace(b"\xc2\xa0", b" ")
|
|
|
51 |
"validation": ["%s/dev/nq-dev-%02d.jsonl.gz" % (_BASE_DOWNLOAD_URL, i) for i in range(5)],
|
52 |
}
|
53 |
|
54 |
+
_VERSION = datasets.Version("0.0.3")
|
55 |
+
|
56 |
|
57 |
class NaturalQuestions(datasets.BeamBasedBuilder):
|
58 |
"""Natural Questions: A Benchmark for Question Answering Research."""
|
59 |
|
60 |
+
BUILDER_CONFIGS = [
|
61 |
+
datasets.BuilderConfig(name="default", version=_VERSION),
|
62 |
+
datasets.BuilderConfig(name="dev", version=_VERSION, description="Only dev split"),
|
63 |
+
]
|
64 |
+
DEFAULT_CONFIG_NAME = "default"
|
65 |
|
66 |
def _info(self):
|
67 |
return datasets.DatasetInfo(
|
|
|
113 |
|
114 |
def _split_generators(self, dl_manager, pipeline):
|
115 |
"""Returns SplitGenerators."""
|
116 |
+
urls = _DOWNLOAD_URLS
|
117 |
+
if self.config.name == "dev":
|
118 |
+
urls = {"validation": urls["validation"]}
|
119 |
+
files = dl_manager.download(urls)
|
120 |
if not pipeline.is_local():
|
121 |
files = dl_manager.ship_files_with_pipeline(files, pipeline)
|
|
|
122 |
return [
|
123 |
datasets.SplitGenerator(
|
124 |
+
name=split,
|
125 |
+
gen_kwargs={"filepaths": files[split]},
|
126 |
+
)
|
127 |
+
for split in [datasets.Split.TRAIN, datasets.Split.VALIDATION]
|
128 |
+
if split in files
|
|
|
|
|
129 |
]
|
130 |
|
131 |
def _build_pcollection(self, pipeline, filepaths):
|
|
|
137 |
html_bytes = ex_json["document_html"].encode("utf-8")
|
138 |
|
139 |
def _parse_short_answer(short_ans):
|
140 |
+
"""Extract text of short answer."""
|
141 |
ans_bytes = html_bytes[short_ans["start_byte"] : short_ans["end_byte"]]
|
142 |
# Remove non-breaking spaces.
|
143 |
ans_bytes = ans_bytes.replace(b"\xc2\xa0", b" ")
|