seirasto commited on
Commit
efe2c92
1 Parent(s): 2122f7b

Add long answer candidates to natural questions dataset (#4368)

Browse files

* add long answer candidates to natural questions

* formatting add long answer candidates to natural questions

* update nq readme and json

* Update README.md

add extra space to long_answer_candidates features

* added additional missing fields

* fixes to field an instance

* Fix data instance in cataset card

Fix:
- Rename "example_id" to "id"
- Set value of "id" as str
- Move "question" below "document"
- Move "document">"title" above "document">"url"
- Set value of "document">"title" as str
- Rename "document">"document_tokens" to "document">"tokens"
- Rename "Token" to "token"
- Add missing closing `}` to value of "document"
- Add missing "id" inside each "annotations"
- Add missing "text" inside each "short_answer"
- Set value of "yes_no_answer" to corresponding int

* Update datasets/natural_questions/natural_questions.py

Co-authored-by: Albert Villanova del Moral <8515462+albertvillanova@users.noreply.github.com>

* Update datasets/natural_questions/natural_questions.py

Co-authored-by: Albert Villanova del Moral <8515462+albertvillanova@users.noreply.github.com>

* Update datasets/natural_questions/natural_questions.py

Co-authored-by: Albert Villanova del Moral <8515462+albertvillanova@users.noreply.github.com>

* Update datasets/natural_questions/natural_questions.py

Co-authored-by: Albert Villanova del Moral <8515462+albertvillanova@users.noreply.github.com>

Co-authored-by: Albert Villanova del Moral <8515462+albertvillanova@users.noreply.github.com>

Commit from https://github.com/huggingface/datasets/commit/f5847a304aa1b38b3a3c54a8318b4df60f1299bc

Files changed (3) hide show
  1. README.md +78 -18
  2. dataset_infos.json +1 -1
  3. natural_questions.py +26 -3
README.md CHANGED
@@ -50,8 +50,8 @@ paperswithcode_id: natural-questions
50
  ## Dataset Description
51
 
52
  - **Homepage:** [https://ai.google.com/research/NaturalQuestions/dataset](https://ai.google.com/research/NaturalQuestions/dataset)
53
- - **Repository:** [More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
54
- - **Paper:** [More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
55
  - **Point of Contact:** [More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
56
  - **Size of downloaded dataset files:** 42981.34 MB
57
  - **Size of the generated dataset:** 95175.86 MB
@@ -67,25 +67,73 @@ NQ to be a more realistic and challenging task than prior QA datasets.
67
 
68
  ### Supported Tasks and Leaderboards
69
 
70
- [More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
71
 
72
  ### Languages
73
 
74
- [More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
75
 
76
  ## Dataset Structure
77
 
78
  ### Data Instances
79
 
80
- #### default
81
-
82
  - **Size of downloaded dataset files:** 42981.34 MB
83
  - **Size of the generated dataset:** 95175.86 MB
84
  - **Total amount of disk used:** 138157.19 MB
85
 
86
- An example of 'train' looks as follows.
87
  ```
88
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
  ```
90
 
91
  ### Data Fields
@@ -94,20 +142,32 @@ The data fields are the same among all splits.
94
 
95
  #### default
96
  - `id`: a `string` feature.
97
- - `title`: a `string` feature.
98
- - `url`: a `string` feature.
99
- - `html`: a `string` feature.
100
- - `tokens`: a dictionary feature containing:
101
- - `token`: a `string` feature.
102
- - `is_html`: a `bool` feature.
103
- - `text`: a `string` feature.
104
- - `tokens`: a `list` of `string` features.
105
- - `annotations`: a dictionary feature containing:
106
- - `id`: a `string` feature.
 
 
 
107
  - `start_token`: a `int64` feature.
108
  - `end_token`: a `int64` feature.
109
  - `start_byte`: a `int64` feature.
110
  - `end_byte`: a `int64` feature.
 
 
 
 
 
 
 
 
 
111
  - `short_answers`: a dictionary feature containing:
112
  - `start_token`: a `int64` feature.
113
  - `end_token`: a `int64` feature.
50
  ## Dataset Description
51
 
52
  - **Homepage:** [https://ai.google.com/research/NaturalQuestions/dataset](https://ai.google.com/research/NaturalQuestions/dataset)
53
+ - **Repository:** [https://github.com/google-research-datasets/natural-questions](https://github.com/google-research-datasets/natural-questions)
54
+ - **Paper:** [https://research.google/pubs/pub47761/](https://research.google/pubs/pub47761/)
55
  - **Point of Contact:** [More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
56
  - **Size of downloaded dataset files:** 42981.34 MB
57
  - **Size of the generated dataset:** 95175.86 MB
67
 
68
  ### Supported Tasks and Leaderboards
69
 
70
+ [https://ai.google.com/research/NaturalQuestions](https://ai.google.com/research/NaturalQuestions)
71
 
72
  ### Languages
73
 
74
+ en
75
 
76
  ## Dataset Structure
77
 
78
  ### Data Instances
79
 
 
 
80
  - **Size of downloaded dataset files:** 42981.34 MB
81
  - **Size of the generated dataset:** 95175.86 MB
82
  - **Total amount of disk used:** 138157.19 MB
83
 
84
+ An example of 'train' looks as follows. This is a toy example.
85
  ```
86
+ {
87
+ "id": "797803103760793766",
88
+ "document": {
89
+ "title": "Google",
90
+ "url": "http://www.wikipedia.org/Google",
91
+ "html": "<html><body><h1>Google Inc.</h1><p>Google was founded in 1998 By:<ul><li>Larry</li><li>Sergey</li></ul></p></body></html>",
92
+ "tokens":[
93
+ {"token": "<h1>", "start_byte": 12, "end_byte": 16, "is_html": True},
94
+ {"token": "Google", "start_byte": 16, "end_byte": 22, "is_html": False},
95
+ {"token": "inc", "start_byte": 23, "end_byte": 26, "is_html": False},
96
+ {"token": ".", "start_byte": 26, "end_byte": 27, "is_html": False},
97
+ {"token": "</h1>", "start_byte": 27, "end_byte": 32, "is_html": True},
98
+ {"token": "<p>", "start_byte": 32, "end_byte": 35, "is_html": True},
99
+ {"token": "Google", "start_byte": 35, "end_byte": 41, "is_html": False},
100
+ {"token": "was", "start_byte": 42, "end_byte": 45, "is_html": False},
101
+ {"token": "founded", "start_byte": 46, "end_byte": 53, "is_html": False},
102
+ {"token": "in", "start_byte": 54, "end_byte": 56, "is_html": False},
103
+ {"token": "1998", "start_byte": 57, "end_byte": 61, "is_html": False},
104
+ {"token": "by", "start_byte": 62, "end_byte": 64, "is_html": False},
105
+ {"token": ":", "start_byte": 64, "end_byte": 65, "is_html": False},
106
+ {"token": "<ul>", "start_byte": 65, "end_byte": 69, "is_html": True},
107
+ {"token": "<li>", "start_byte": 69, "end_byte": 73, "is_html": True},
108
+ {"token": "Larry", "start_byte": 73, "end_byte": 78, "is_html": False},
109
+ {"token": "</li>", "start_byte": 78, "end_byte": 83, "is_html": True},
110
+ {"token": "<li>", "start_byte": 83, "end_byte": 87, "is_html": True},
111
+ {"token": "Sergey", "start_byte": 87, "end_byte": 92, "is_html": False},
112
+ {"token": "</li>", "start_byte": 92, "end_byte": 97, "is_html": True},
113
+ {"token": "</ul>", "start_byte": 97, "end_byte": 102, "is_html": True},
114
+ {"token": "</p>", "start_byte": 102, "end_byte": 106, "is_html": True}
115
+ ],
116
+ },
117
+ "question" :{
118
+ "text": "who founded google",
119
+ "tokens": ["who", "founded", "google"]
120
+ },
121
+ "long_answer_candidates": [
122
+ {"start_byte": 32, "end_byte": 106, "start_token": 5, "end_token": 22, "top_level": True},
123
+ {"start_byte": 65, "end_byte": 102, "start_token": 13, "end_token": 21, "top_level": False},
124
+ {"start_byte": 69, "end_byte": 83, "start_token": 14, "end_token": 17, "top_level": False},
125
+ {"start_byte": 83, "end_byte": 92, "start_token": 17, "end_token": 20 , "top_level": False}
126
+ ],
127
+ "annotations": [{
128
+ "id": "6782080525527814293",
129
+ "long_answer": {"start_byte": 32, "end_byte": 106, "start_token": 5, "end_token": 22, "candidate_index": 0},
130
+ "short_answers": [
131
+ {"start_byte": 73, "end_byte": 78, "start_token": 15, "end_token": 16, "text": "Larry"},
132
+ {"start_byte": 87, "end_byte": 92, "start_token": 18, "end_token": 19, "text": "Sergey"}
133
+ ],
134
+ "yes_no_answer": -1
135
+ }]
136
+ }
137
  ```
138
 
139
  ### Data Fields
142
 
143
  #### default
144
  - `id`: a `string` feature.
145
+ - `document` a dictionary feature containing:
146
+ - `title`: a `string` feature.
147
+ - `url`: a `string` feature.
148
+ - `html`: a `string` feature.
149
+ - `tokens`: a dictionary feature containing:
150
+ - `token`: a `string` feature.
151
+ - `is_html`: a `bool` feature.
152
+ - `start_byte`: a `int64` feature.
153
+ - `end_byte`: a `int64` feature.
154
+ - `question`: a dictionary feature containing:
155
+ - `text`: a `string` feature.
156
+ - `tokens`: a `list` of `string` features.
157
+ - `long_answer_candidates`: a dictionary feature containing:
158
  - `start_token`: a `int64` feature.
159
  - `end_token`: a `int64` feature.
160
  - `start_byte`: a `int64` feature.
161
  - `end_byte`: a `int64` feature.
162
+ - `top_level`: a `bool` feature.
163
+ - `annotations`: a dictionary feature containing:
164
+ - `id`: a `string` feature.
165
+ - `long_answers`: a dictionary feature containing:
166
+ - `start_token`: a `int64` feature.
167
+ - `end_token`: a `int64` feature.
168
+ - `start_byte`: a `int64` feature.
169
+ - `end_byte`: a `int64` feature.
170
+ - `candidate_index`: a `int64` feature.
171
  - `short_answers`: a dictionary feature containing:
172
  - `start_token`: a `int64` feature.
173
  - `end_token`: a `int64` feature.
dataset_infos.json CHANGED
@@ -1 +1 @@
1
- {"default": {"description": "\nThe NQ corpus contains questions from real users, and it requires QA systems to\nread and comprehend an entire Wikipedia article that may or may not contain the\nanswer to the question. The inclusion of real user questions, and the\nrequirement that solutions should read an entire page to find the answer, cause\nNQ to be a more realistic and challenging task than prior QA datasets.\n", "citation": "\n@article{47761,\ntitle\t= {Natural Questions: a Benchmark for Question Answering Research},\nauthor\t= {Tom Kwiatkowski and Jennimaria Palomaki and Olivia Redfield and Michael Collins and Ankur Parikh and Chris Alberti and Danielle Epstein and Illia Polosukhin and Matthew Kelcey and Jacob Devlin and Kenton Lee and Kristina N. Toutanova and Llion Jones and Ming-Wei Chang and Andrew Dai and Jakob Uszkoreit and Quoc Le and Slav Petrov},\nyear\t= {2019},\njournal\t= {Transactions of the Association of Computational Linguistics}\n}\n", "homepage": "https://ai.google.com/research/NaturalQuestions/dataset", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "document": {"title": {"dtype": "string", "id": null, "_type": "Value"}, "url": {"dtype": "string", "id": null, "_type": "Value"}, "html": {"dtype": "string", "id": null, "_type": "Value"}, "tokens": {"feature": {"token": {"dtype": "string", "id": null, "_type": "Value"}, "is_html": {"dtype": "bool", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}}, "question": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "tokens": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}}, "annotations": {"feature": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "long_answer": {"start_token": {"dtype": "int64", "id": null, "_type": "Value"}, "end_token": {"dtype": "int64", "id": null, "_type": "Value"}, "start_byte": {"dtype": "int64", "id": null, "_type": "Value"}, "end_byte": {"dtype": "int64", "id": null, "_type": "Value"}}, "short_answers": {"feature": {"start_token": {"dtype": "int64", "id": null, "_type": "Value"}, "end_token": {"dtype": "int64", "id": null, "_type": "Value"}, "start_byte": {"dtype": "int64", "id": null, "_type": "Value"}, "end_byte": {"dtype": "int64", "id": null, "_type": "Value"}, "text": {"dtype": "string", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}, "yes_no_answer": {"num_classes": 2, "names": ["NO", "YES"], "names_file": null, "id": null, "_type": "ClassLabel"}}, "length": -1, "id": null, "_type": "Sequence"}}, "supervised_keys": null, "builder_name": "natural_questions", "config_name": "default", "version": {"version_str": "0.0.2", "description": null, "datasets_version_to_prepare": null, "major": 0, "minor": 0, "patch": 2}, "splits": {"train": {"name": "train", "num_bytes": 97445142568, "num_examples": 307373, "dataset_name": "natural_questions"}, "validation": {"name": "validation", "num_bytes": 2353975312, "num_examples": 7830, "dataset_name": "natural_questions"}}, "download_checksums": {"https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-00.jsonl.gz": {"num_bytes": 858728609, "checksum": "fb63ed2a5af2921898d566a4e8e514ed17bd079735f5a37f9b0c5e83ce087106"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-01.jsonl.gz": {"num_bytes": 891498165, "checksum": "bbccdbc261ced6ee6351ede78c8be5af43d1024c72a60070ea658767d4c3023a"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-02.jsonl.gz": {"num_bytes": 885374316, "checksum": "923afd3c645b0bd887f7b6a43c03889936226708ec7a66d83e5e5fa9cee98f4e"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-03.jsonl.gz": {"num_bytes": 885313666, "checksum": "272b2fcdc37cf23ab4bcdf831a84e3b755da066ad4727cdded57a383a18f45de"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-04.jsonl.gz": {"num_bytes": 890873425, "checksum": "8a9eb2dcf818ab7a44c4fa4b73112547e7f250ec85bdf83d2a3f32542fc3e8c2"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-05.jsonl.gz": {"num_bytes": 873023109, "checksum": "2566560a3ad89300552385c3aba0cb51f9968083f01f04c494623542619cdaca"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-06.jsonl.gz": {"num_bytes": 866509301, "checksum": "8ae5491a1d86fea5025e9ec27fed574fe5886fb36a7b3567ab0dba498603728d"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-07.jsonl.gz": {"num_bytes": 838940867, "checksum": "7d1ee955d5a8dee1dc024e7b6a278314c85514f046d40d56ad5f1c2bb1fd794a"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-08.jsonl.gz": {"num_bytes": 902610214, "checksum": "233ab07737289b4122d0fd2d2278dd4d7de3ef44d5b7d7e2e5abb79dbae55541"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-09.jsonl.gz": {"num_bytes": 883494801, "checksum": "a1e546ee7db94117804c41c5fe80af91c78ee5b10878fc2714adb5322f56bb9b"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-10.jsonl.gz": {"num_bytes": 876311133, "checksum": "0d27b7682c4ebc655e18eb9f8dcbb800ae1d5b09ef1183e29faa10168a015724"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-11.jsonl.gz": {"num_bytes": 878127326, "checksum": "9b457cc0d4021da388c1322538b2b2140f0b2439c8eb056b5247c39ecb0de198"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-12.jsonl.gz": {"num_bytes": 889257016, "checksum": "e3078d51686869be12343e1d02ae656577b290355d540870a370c58baeb89bc6"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-13.jsonl.gz": {"num_bytes": 891769129, "checksum": "ff898b89d8423e4b5c9b35996fed80c8e1ddcc5f8a57c9af2a760d408bfa5df4"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-14.jsonl.gz": {"num_bytes": 892523839, "checksum": "7f28f63e565bfa3b9013a62000da6e070c2cdd2aa6f9fc5cfb14365a1a98ab0f"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-15.jsonl.gz": {"num_bytes": 910660095, "checksum": "64db3145b5021e52611f8aedf49bbd0b5f648fef43acc8b1a4481b3dfe96c248"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-16.jsonl.gz": {"num_bytes": 878177689, "checksum": "c12de70e57943288511596b5ebbf5c914a5f99e8fb50d74286274021e8a18fb7"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-17.jsonl.gz": {"num_bytes": 872805189, "checksum": "2beb6c9f24c650c60354b6b513634e1a209cba28c6f204df4e9e2efc8b7ca59e"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-18.jsonl.gz": {"num_bytes": 875275428, "checksum": "2420b73b47cfbb04bca2b1352371dc893879634956b98446bdbde3090556556c"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-19.jsonl.gz": {"num_bytes": 862034169, "checksum": "c514885fc1bff8f4e6291813debbc3a9568b538781eb17e273ac9e88b0b16f80"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-20.jsonl.gz": {"num_bytes": 887586358, "checksum": "59cd4abad74a38265d8e506afd29e3ea498e2f39fe0ee70e9b733810286b3959"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-21.jsonl.gz": {"num_bytes": 890472815, "checksum": "c8d0b1f4cdf78fd658185e92bf1ece16fd16cdde4d27da5221d1a37688ee935e"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-22.jsonl.gz": {"num_bytes": 888396337, "checksum": "6e1ca3851f138e75cc0bab36f5cad83db2e6ae126fac7c6fdc4ce71ad8f410ca"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-23.jsonl.gz": {"num_bytes": 900331594, "checksum": "d34bd25d0b7b8af8aa27b6b9fad8b7febdca6f0c4c1f5779dfc9b4ccbbec6ed2"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-24.jsonl.gz": {"num_bytes": 871216444, "checksum": "40972a44f50c460bcd8fa90a9a0794a2bc169504dc04dbee2a4896c88536f51d"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-25.jsonl.gz": {"num_bytes": 871166814, "checksum": "7028865d9a77d8f0b4b06a1291ff75a488578879ba87e9e679b2d68e8e1accd4"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-26.jsonl.gz": {"num_bytes": 903385811, "checksum": "e4fd4bdc5c63fa1d1310c0ab573601ca87b3809ce1346fc912b398a6bed7f205"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-27.jsonl.gz": {"num_bytes": 842966594, "checksum": "54b8cccea4799351259c3264d077b8df1f291332c0b93f08e66aa78f83a58d18"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-28.jsonl.gz": {"num_bytes": 876393409, "checksum": "a8ee205427dcf3be03759d44de276741f855892d76338ca26a72c76bc07cd3c4"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-29.jsonl.gz": {"num_bytes": 872982425, "checksum": "cb3c96df23bbb9097b61ce1a524c3eb375165404da72d9f0a51eff9744d75643"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-30.jsonl.gz": {"num_bytes": 899739217, "checksum": "e64447543e83b66b725686af6c753f8b08bb6bc9adbe8db36ab31cba11bfcd5b"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-31.jsonl.gz": {"num_bytes": 875703668, "checksum": "7f6195da4b45887d56563924a8741d9db64b4cca32cf50c9d07f8836a761ab09"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-32.jsonl.gz": {"num_bytes": 895840703, "checksum": "5c6574f0f8a157d585bef31fb79a53b1e1b37fdf638b475c92adbb83812b64db"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-33.jsonl.gz": {"num_bytes": 874713497, "checksum": "4d75fd17b0b6ee3133b405b7a90867b0b0b49a51659a5e1eb8bd1d70d0181473"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-34.jsonl.gz": {"num_bytes": 872620262, "checksum": "b70c517e40b7283f10b291f44e6a61a9c9f6dacb9de89ae37e2a7e92a96eec01"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-35.jsonl.gz": {"num_bytes": 854439473, "checksum": "c6e3615fb8753dd3ffe0890a99793847c99b364b50136c8e0430007023bd5506"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-36.jsonl.gz": {"num_bytes": 866233094, "checksum": "dbf6f9227c3558e5195690ace9ec1ccfc84c705eecdd2557d7ead73b88e264ff"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-37.jsonl.gz": {"num_bytes": 894411832, "checksum": "bcbf932a71ef07f0217a2620ec395854c2f200e18829c2f28400e52ad9799aaf"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-38.jsonl.gz": {"num_bytes": 879967719, "checksum": "6518d41f6a205a4551358a154e16e795a40d4d0cd164fa6556f367a7652e3a0d"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-39.jsonl.gz": {"num_bytes": 887056754, "checksum": "f82ba5c7bd19c853e34b2dfdee9c458ef7e9b55f022aed08c3753ebf93034293"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-40.jsonl.gz": {"num_bytes": 873720601, "checksum": "9a6a19e4c408858935bd5456d08e155b9418aa2c1e4fe5ea81d227e57bd6517f"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-41.jsonl.gz": {"num_bytes": 880452966, "checksum": "c3d3ba79c0f6bb718fa58e473dbc70b2064c8168fc59e3b8ef8df2dbea6bfa37"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-42.jsonl.gz": {"num_bytes": 856217171, "checksum": "1d6921d56ff4143e3c189c95e4ab506b70dc569fa4d91f94f9cf29052d253eb6"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-43.jsonl.gz": {"num_bytes": 908184635, "checksum": "595a069528f5988b4808821d1dc81bb8c6dfbd672e69f991bd4004b9e1c02736"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-44.jsonl.gz": {"num_bytes": 891701874, "checksum": "9a290d4d9c9c9507aeec304e1340a3a02e969f17021f02c969aa90b30a970a0d"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-45.jsonl.gz": {"num_bytes": 870559738, "checksum": "40f16e923391fca5f1a30eeacc39ca6c87fc522b9d7b86b7308683ed39c51d5d"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-46.jsonl.gz": {"num_bytes": 883791796, "checksum": "0a5425ac0b9800fb492f0199f358846fd63a10a377a80b7ce784fb715a1d5f90"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-47.jsonl.gz": {"num_bytes": 882109720, "checksum": "65c230069c85c8c74d1ff562c62c443e69e1e93869ecbdb0a2c673faaf4a184e"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-48.jsonl.gz": {"num_bytes": 882241605, "checksum": "df613f0496b7d5f7a49d837b914d1ea80e15c925bb3cf91720ec5b2a25710245"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-49.jsonl.gz": {"num_bytes": 863247626, "checksum": "ff023c8380d2e9a8c23a1babb24ab6fe2eb5c174f35d74e025bbe0961ea706ec"}, "https://storage.googleapis.com/natural_questions/v1.0/dev/nq-dev-00.jsonl.gz": {"num_bytes": 219593373, "checksum": "78a7f7899aa7d0bc9a29878cdb90daabbeda21a93e3730d8861f20ec736790b2"}, "https://storage.googleapis.com/natural_questions/v1.0/dev/nq-dev-01.jsonl.gz": {"num_bytes": 200209706, "checksum": "9cebaa5eb69cf4ce067079370456b2939d4154a17da88faf73844d8c418cfb9e"}, "https://storage.googleapis.com/natural_questions/v1.0/dev/nq-dev-02.jsonl.gz": {"num_bytes": 210446574, "checksum": "7b82aa74a35025ed91f514ad21e05c4a66cdec56ac1f6b77767a578156ff3bfc"}, "https://storage.googleapis.com/natural_questions/v1.0/dev/nq-dev-03.jsonl.gz": {"num_bytes": 216859801, "checksum": "c7d45bb464bda3da7788c985b07def313ab5bed69bcc258acbe6f0918050bf6e"}, "https://storage.googleapis.com/natural_questions/v1.0/dev/nq-dev-04.jsonl.gz": {"num_bytes": 220929521, "checksum": "00969275e9fb6a5dcc7e20ec9589c23ac00de61c979c8b957f4180b5b9a3043a"}}, "download_size": 45069199013, "dataset_size": 99799117880, "size_in_bytes": 144868316893}}
1
+ {"default": {"description": "\nThe NQ corpus contains questions from real users, and it requires QA systems to\nread and comprehend an entire Wikipedia article that may or may not contain the\nanswer to the question. The inclusion of real user questions, and the\nrequirement that solutions should read an entire page to find the answer, cause\nNQ to be a more realistic and challenging task than prior QA datasets.\n", "citation": "\n@article{47761,\ntitle\t= {Natural Questions: a Benchmark for Question Answering Research},\nauthor\t= {Tom Kwiatkowski and Jennimaria Palomaki and Olivia Redfield and Michael Collins and Ankur Parikh and Chris Alberti and Danielle Epstein and Illia Polosukhin and Matthew Kelcey and Jacob Devlin and Kenton Lee and Kristina N. Toutanova and Llion Jones and Ming-Wei Chang and Andrew Dai and Jakob Uszkoreit and Quoc Le and Slav Petrov},\nyear\t= {2019},\njournal\t= {Transactions of the Association of Computational Linguistics}\n}\n", "homepage": "https://ai.google.com/research/NaturalQuestions/dataset", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "document": {"title": {"dtype": "string", "id": null, "_type": "Value"}, "url": {"dtype": "string", "id": null, "_type": "Value"}, "html": {"dtype": "string", "id": null, "_type": "Value"}, "tokens": {"feature": {"token": {"dtype": "string", "id": null, "_type": "Value"}, "is_html": {"dtype": "bool", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}}, "question": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "tokens": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}}, "annotations": {"feature": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "long_answer": {"start_token": {"dtype": "int64", "id": null, "_type": "Value"}, "end_token": {"dtype": "int64", "id": null, "_type": "Value"}, "start_byte": {"dtype": "int64", "id": null, "_type": "Value"}, "end_byte": {"dtype": "int64", "id": null, "_type": "Value"}}, "short_answers": {"feature": {"start_token": {"dtype": "int64", "id": null, "_type": "Value"}, "end_token": {"dtype": "int64", "id": null, "_type": "Value"}, "start_byte": {"dtype": "int64", "id": null, "_type": "Value"}, "end_byte": {"dtype": "int64", "id": null, "_type": "Value"}, "text": {"dtype": "string", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}, "yes_no_answer": {"num_classes": 2, "names": ["NO", "YES"], "names_file": null, "id": null, "_type": "ClassLabel"}, "long_answer_candidates": {"feature": {"start_token": {"dtype": "int64", "id": null, "_type": "Value"}, "end_token": {"dtype": "int64", "id": null, "_type": "Value"}, "start_byte": {"dtype": "int64", "id": null, "_type": "Value"}, "end_byte": {"dtype": "int64", "id": null, "_type": "Value"}, "top_label": {"dtype": "bool", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}}, "length": -1, "id": null, "_type": "Sequence"}}, "supervised_keys": null, "builder_name": "natural_questions", "config_name": "default", "version": {"version_str": "0.0.2", "description": null, "datasets_version_to_prepare": null, "major": 0, "minor": 0, "patch": 2}, "splits": {"train": {"name": "train", "num_bytes": 97445142568, "num_examples": 307373, "dataset_name": "natural_questions"}, "validation": {"name": "validation", "num_bytes": 2353975312, "num_examples": 7830, "dataset_name": "natural_questions"}}, "download_checksums": {"https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-00.jsonl.gz": {"num_bytes": 858728609, "checksum": "fb63ed2a5af2921898d566a4e8e514ed17bd079735f5a37f9b0c5e83ce087106"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-01.jsonl.gz": {"num_bytes": 891498165, "checksum": "bbccdbc261ced6ee6351ede78c8be5af43d1024c72a60070ea658767d4c3023a"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-02.jsonl.gz": {"num_bytes": 885374316, "checksum": "923afd3c645b0bd887f7b6a43c03889936226708ec7a66d83e5e5fa9cee98f4e"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-03.jsonl.gz": {"num_bytes": 885313666, "checksum": "272b2fcdc37cf23ab4bcdf831a84e3b755da066ad4727cdded57a383a18f45de"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-04.jsonl.gz": {"num_bytes": 890873425, "checksum": "8a9eb2dcf818ab7a44c4fa4b73112547e7f250ec85bdf83d2a3f32542fc3e8c2"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-05.jsonl.gz": {"num_bytes": 873023109, "checksum": "2566560a3ad89300552385c3aba0cb51f9968083f01f04c494623542619cdaca"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-06.jsonl.gz": {"num_bytes": 866509301, "checksum": "8ae5491a1d86fea5025e9ec27fed574fe5886fb36a7b3567ab0dba498603728d"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-07.jsonl.gz": {"num_bytes": 838940867, "checksum": "7d1ee955d5a8dee1dc024e7b6a278314c85514f046d40d56ad5f1c2bb1fd794a"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-08.jsonl.gz": {"num_bytes": 902610214, "checksum": "233ab07737289b4122d0fd2d2278dd4d7de3ef44d5b7d7e2e5abb79dbae55541"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-09.jsonl.gz": {"num_bytes": 883494801, "checksum": "a1e546ee7db94117804c41c5fe80af91c78ee5b10878fc2714adb5322f56bb9b"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-10.jsonl.gz": {"num_bytes": 876311133, "checksum": "0d27b7682c4ebc655e18eb9f8dcbb800ae1d5b09ef1183e29faa10168a015724"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-11.jsonl.gz": {"num_bytes": 878127326, "checksum": "9b457cc0d4021da388c1322538b2b2140f0b2439c8eb056b5247c39ecb0de198"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-12.jsonl.gz": {"num_bytes": 889257016, "checksum": "e3078d51686869be12343e1d02ae656577b290355d540870a370c58baeb89bc6"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-13.jsonl.gz": {"num_bytes": 891769129, "checksum": "ff898b89d8423e4b5c9b35996fed80c8e1ddcc5f8a57c9af2a760d408bfa5df4"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-14.jsonl.gz": {"num_bytes": 892523839, "checksum": "7f28f63e565bfa3b9013a62000da6e070c2cdd2aa6f9fc5cfb14365a1a98ab0f"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-15.jsonl.gz": {"num_bytes": 910660095, "checksum": "64db3145b5021e52611f8aedf49bbd0b5f648fef43acc8b1a4481b3dfe96c248"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-16.jsonl.gz": {"num_bytes": 878177689, "checksum": "c12de70e57943288511596b5ebbf5c914a5f99e8fb50d74286274021e8a18fb7"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-17.jsonl.gz": {"num_bytes": 872805189, "checksum": "2beb6c9f24c650c60354b6b513634e1a209cba28c6f204df4e9e2efc8b7ca59e"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-18.jsonl.gz": {"num_bytes": 875275428, "checksum": "2420b73b47cfbb04bca2b1352371dc893879634956b98446bdbde3090556556c"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-19.jsonl.gz": {"num_bytes": 862034169, "checksum": "c514885fc1bff8f4e6291813debbc3a9568b538781eb17e273ac9e88b0b16f80"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-20.jsonl.gz": {"num_bytes": 887586358, "checksum": "59cd4abad74a38265d8e506afd29e3ea498e2f39fe0ee70e9b733810286b3959"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-21.jsonl.gz": {"num_bytes": 890472815, "checksum": "c8d0b1f4cdf78fd658185e92bf1ece16fd16cdde4d27da5221d1a37688ee935e"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-22.jsonl.gz": {"num_bytes": 888396337, "checksum": "6e1ca3851f138e75cc0bab36f5cad83db2e6ae126fac7c6fdc4ce71ad8f410ca"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-23.jsonl.gz": {"num_bytes": 900331594, "checksum": "d34bd25d0b7b8af8aa27b6b9fad8b7febdca6f0c4c1f5779dfc9b4ccbbec6ed2"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-24.jsonl.gz": {"num_bytes": 871216444, "checksum": "40972a44f50c460bcd8fa90a9a0794a2bc169504dc04dbee2a4896c88536f51d"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-25.jsonl.gz": {"num_bytes": 871166814, "checksum": "7028865d9a77d8f0b4b06a1291ff75a488578879ba87e9e679b2d68e8e1accd4"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-26.jsonl.gz": {"num_bytes": 903385811, "checksum": "e4fd4bdc5c63fa1d1310c0ab573601ca87b3809ce1346fc912b398a6bed7f205"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-27.jsonl.gz": {"num_bytes": 842966594, "checksum": "54b8cccea4799351259c3264d077b8df1f291332c0b93f08e66aa78f83a58d18"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-28.jsonl.gz": {"num_bytes": 876393409, "checksum": "a8ee205427dcf3be03759d44de276741f855892d76338ca26a72c76bc07cd3c4"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-29.jsonl.gz": {"num_bytes": 872982425, "checksum": "cb3c96df23bbb9097b61ce1a524c3eb375165404da72d9f0a51eff9744d75643"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-30.jsonl.gz": {"num_bytes": 899739217, "checksum": "e64447543e83b66b725686af6c753f8b08bb6bc9adbe8db36ab31cba11bfcd5b"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-31.jsonl.gz": {"num_bytes": 875703668, "checksum": "7f6195da4b45887d56563924a8741d9db64b4cca32cf50c9d07f8836a761ab09"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-32.jsonl.gz": {"num_bytes": 895840703, "checksum": "5c6574f0f8a157d585bef31fb79a53b1e1b37fdf638b475c92adbb83812b64db"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-33.jsonl.gz": {"num_bytes": 874713497, "checksum": "4d75fd17b0b6ee3133b405b7a90867b0b0b49a51659a5e1eb8bd1d70d0181473"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-34.jsonl.gz": {"num_bytes": 872620262, "checksum": "b70c517e40b7283f10b291f44e6a61a9c9f6dacb9de89ae37e2a7e92a96eec01"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-35.jsonl.gz": {"num_bytes": 854439473, "checksum": "c6e3615fb8753dd3ffe0890a99793847c99b364b50136c8e0430007023bd5506"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-36.jsonl.gz": {"num_bytes": 866233094, "checksum": "dbf6f9227c3558e5195690ace9ec1ccfc84c705eecdd2557d7ead73b88e264ff"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-37.jsonl.gz": {"num_bytes": 894411832, "checksum": "bcbf932a71ef07f0217a2620ec395854c2f200e18829c2f28400e52ad9799aaf"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-38.jsonl.gz": {"num_bytes": 879967719, "checksum": "6518d41f6a205a4551358a154e16e795a40d4d0cd164fa6556f367a7652e3a0d"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-39.jsonl.gz": {"num_bytes": 887056754, "checksum": "f82ba5c7bd19c853e34b2dfdee9c458ef7e9b55f022aed08c3753ebf93034293"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-40.jsonl.gz": {"num_bytes": 873720601, "checksum": "9a6a19e4c408858935bd5456d08e155b9418aa2c1e4fe5ea81d227e57bd6517f"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-41.jsonl.gz": {"num_bytes": 880452966, "checksum": "c3d3ba79c0f6bb718fa58e473dbc70b2064c8168fc59e3b8ef8df2dbea6bfa37"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-42.jsonl.gz": {"num_bytes": 856217171, "checksum": "1d6921d56ff4143e3c189c95e4ab506b70dc569fa4d91f94f9cf29052d253eb6"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-43.jsonl.gz": {"num_bytes": 908184635, "checksum": "595a069528f5988b4808821d1dc81bb8c6dfbd672e69f991bd4004b9e1c02736"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-44.jsonl.gz": {"num_bytes": 891701874, "checksum": "9a290d4d9c9c9507aeec304e1340a3a02e969f17021f02c969aa90b30a970a0d"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-45.jsonl.gz": {"num_bytes": 870559738, "checksum": "40f16e923391fca5f1a30eeacc39ca6c87fc522b9d7b86b7308683ed39c51d5d"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-46.jsonl.gz": {"num_bytes": 883791796, "checksum": "0a5425ac0b9800fb492f0199f358846fd63a10a377a80b7ce784fb715a1d5f90"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-47.jsonl.gz": {"num_bytes": 882109720, "checksum": "65c230069c85c8c74d1ff562c62c443e69e1e93869ecbdb0a2c673faaf4a184e"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-48.jsonl.gz": {"num_bytes": 882241605, "checksum": "df613f0496b7d5f7a49d837b914d1ea80e15c925bb3cf91720ec5b2a25710245"}, "https://storage.googleapis.com/natural_questions/v1.0/train/nq-train-49.jsonl.gz": {"num_bytes": 863247626, "checksum": "ff023c8380d2e9a8c23a1babb24ab6fe2eb5c174f35d74e025bbe0961ea706ec"}, "https://storage.googleapis.com/natural_questions/v1.0/dev/nq-dev-00.jsonl.gz": {"num_bytes": 219593373, "checksum": "78a7f7899aa7d0bc9a29878cdb90daabbeda21a93e3730d8861f20ec736790b2"}, "https://storage.googleapis.com/natural_questions/v1.0/dev/nq-dev-01.jsonl.gz": {"num_bytes": 200209706, "checksum": "9cebaa5eb69cf4ce067079370456b2939d4154a17da88faf73844d8c418cfb9e"}, "https://storage.googleapis.com/natural_questions/v1.0/dev/nq-dev-02.jsonl.gz": {"num_bytes": 210446574, "checksum": "7b82aa74a35025ed91f514ad21e05c4a66cdec56ac1f6b77767a578156ff3bfc"}, "https://storage.googleapis.com/natural_questions/v1.0/dev/nq-dev-03.jsonl.gz": {"num_bytes": 216859801, "checksum": "c7d45bb464bda3da7788c985b07def313ab5bed69bcc258acbe6f0918050bf6e"}, "https://storage.googleapis.com/natural_questions/v1.0/dev/nq-dev-04.jsonl.gz": {"num_bytes": 220929521, "checksum": "00969275e9fb6a5dcc7e20ec9589c23ac00de61c979c8b957f4180b5b9a3043a"}}, "download_size": 45069199013, "dataset_size": 99799117880, "size_in_bytes": 144868316893}}
natural_questions.py CHANGED
@@ -51,7 +51,7 @@ _DOWNLOAD_URLS = {
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):
@@ -74,13 +74,27 @@ class NaturalQuestions(datasets.BeamBasedBuilder):
74
  "url": datasets.Value("string"),
75
  "html": datasets.Value("string"),
76
  "tokens": datasets.features.Sequence(
77
- {"token": datasets.Value("string"), "is_html": datasets.Value("bool")}
 
 
 
 
 
78
  ),
79
  },
80
  "question": {
81
  "text": datasets.Value("string"),
82
  "tokens": datasets.features.Sequence(datasets.Value("string")),
83
  },
 
 
 
 
 
 
 
 
 
84
  "annotations": datasets.features.Sequence(
85
  {
86
  "id": datasets.Value("string"),
@@ -89,6 +103,7 @@ class NaturalQuestions(datasets.BeamBasedBuilder):
89
  "end_token": datasets.Value("int64"),
90
  "start_byte": datasets.Value("int64"),
91
  "end_byte": datasets.Value("int64"),
 
92
  },
93
  "short_answers": datasets.features.Sequence(
94
  {
@@ -162,6 +177,7 @@ class NaturalQuestions(datasets.BeamBasedBuilder):
162
  "end_token": an_json["long_answer"]["end_token"],
163
  "start_byte": an_json["long_answer"]["start_byte"],
164
  "end_byte": an_json["long_answer"]["end_byte"],
 
165
  },
166
  "short_answers": [_parse_short_answer(ans) for ans in an_json["short_answers"]],
167
  "yes_no_answer": (-1 if an_json["yes_no_answer"] == "NONE" else an_json["yes_no_answer"]),
@@ -179,10 +195,17 @@ class NaturalQuestions(datasets.BeamBasedBuilder):
179
  "url": ex_json["document_url"],
180
  "html": ex_json["document_html"],
181
  "tokens": [
182
- {"token": t["token"], "is_html": t["html_token"]} for t in ex_json["document_tokens"]
 
 
 
 
 
 
183
  ],
184
  },
185
  "question": {"text": ex_json["question_text"], "tokens": ex_json["question_tokens"]},
 
186
  "annotations": [_parse_annotation(an_json) for an_json in ex_json["annotations"]],
187
  },
188
  )
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.4")
55
 
56
 
57
  class NaturalQuestions(datasets.BeamBasedBuilder):
74
  "url": datasets.Value("string"),
75
  "html": datasets.Value("string"),
76
  "tokens": datasets.features.Sequence(
77
+ {
78
+ "token": datasets.Value("string"),
79
+ "is_html": datasets.Value("bool"),
80
+ "start_byte": datasets.Value("int64"),
81
+ "end_byte": datasets.Value("int64"),
82
+ }
83
  ),
84
  },
85
  "question": {
86
  "text": datasets.Value("string"),
87
  "tokens": datasets.features.Sequence(datasets.Value("string")),
88
  },
89
+ "long_answer_candidates": datasets.features.Sequence(
90
+ {
91
+ "start_token": datasets.Value("int64"),
92
+ "end_token": datasets.Value("int64"),
93
+ "start_byte": datasets.Value("int64"),
94
+ "end_byte": datasets.Value("int64"),
95
+ "top_level": datasets.Value("bool"),
96
+ }
97
+ ),
98
  "annotations": datasets.features.Sequence(
99
  {
100
  "id": datasets.Value("string"),
103
  "end_token": datasets.Value("int64"),
104
  "start_byte": datasets.Value("int64"),
105
  "end_byte": datasets.Value("int64"),
106
+ "candidate_index": datasets.Value("int64"),
107
  },
108
  "short_answers": datasets.features.Sequence(
109
  {
177
  "end_token": an_json["long_answer"]["end_token"],
178
  "start_byte": an_json["long_answer"]["start_byte"],
179
  "end_byte": an_json["long_answer"]["end_byte"],
180
+ "candidate_index": an_json["long_answer"]["candidate_index"],
181
  },
182
  "short_answers": [_parse_short_answer(ans) for ans in an_json["short_answers"]],
183
  "yes_no_answer": (-1 if an_json["yes_no_answer"] == "NONE" else an_json["yes_no_answer"]),
195
  "url": ex_json["document_url"],
196
  "html": ex_json["document_html"],
197
  "tokens": [
198
+ {
199
+ "token": t["token"],
200
+ "is_html": t["html_token"],
201
+ "start_byte": t["start_byte"],
202
+ "end_byte": t["end_byte"],
203
+ }
204
+ for t in ex_json["document_tokens"]
205
  ],
206
  },
207
  "question": {"text": ex_json["question_text"], "tokens": ex_json["question_tokens"]},
208
+ "long_answer_candidates": [lac_json for lac_json in ex_json["long_answer_candidates"]],
209
  "annotations": [_parse_annotation(an_json) for an_json in ex_json["annotations"]],
210
  },
211
  )