Datasets:

Modalities:
Text
Formats:
parquet
Languages:
English
ArXiv:
Libraries:
Datasets
Dask
License:
system HF staff commited on
Commit
4b15773
0 Parent(s):

Update files from the datasets library (from 1.2.0)

Browse files

Release notes: https://github.com/huggingface/datasets/releases/tag/1.2.0

Files changed (5) hide show
  1. .gitattributes +27 -0
  2. README.md +194 -0
  3. dataset_infos.json +1 -0
  4. dummy/0.0.0/dummy_data.zip +3 -0
  5. narrativeqa.py +160 -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
README.md ADDED
@@ -0,0 +1,194 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ annotations_creators:
3
+ - crowdsourced
4
+ language_creators:
5
+ - found
6
+ languages:
7
+ - en
8
+ licenses:
9
+ - apache-2-0
10
+ multilinguality:
11
+ - monolingual
12
+ size_categories:
13
+ - 10K<n<100K
14
+ source_datasets:
15
+ - original
16
+ task_categories:
17
+ - question-answering
18
+ task_ids:
19
+ - abstractive-qa
20
+ ---
21
+
22
+ # Dataset Card for Narrative QA
23
+
24
+ ## Table of Contents
25
+ - [Dataset Description](#dataset-description)
26
+ - [Dataset Summary](#dataset-summary)
27
+ - [Supported Tasks](#supported-tasks-and-leaderboards)
28
+ - [Languages](#languages)
29
+ - [Dataset Structure](#dataset-structure)
30
+ - [Data Instances](#data-instances)
31
+ - [Data Fields](#data-fields)
32
+ - [Data Splits](#data-splits)
33
+ - [Dataset Creation](#dataset-creation)
34
+ - [Curation Rationale](#curation-rationale)
35
+ - [Source Data](#source-data)
36
+ - [Annotations](#annotations)
37
+ - [Personal and Sensitive Information](#personal-and-sensitive-information)
38
+ - [Considerations for Using the Data](#considerations-for-using-the-data)
39
+ - [Social Impact of Dataset](#social-impact-of-dataset)
40
+ - [Discussion of Biases](#discussion-of-biases)
41
+ - [Other Known Limitations](#other-known-limitations)
42
+ - [Additional Information](#additional-information)
43
+ - [Dataset Curators](#dataset-curators)
44
+ - [Licensing Information](#licensing-information)
45
+ - [Citation Information](#citation-information)
46
+
47
+ ## Dataset Description
48
+
49
+ - **Homepage:** [NarrativeQA Homepage](https://deepmind.com/research/open-source/narrativeqa)
50
+ - **Repository:** [NarrativeQA Repo](https://github.com/deepmind/narrativeqa)
51
+ - **Paper:** [The NarrativeQA Reading Comprehension Challenge](https://arxiv.org/pdf/1712.07040.pdf)
52
+ - **Leaderboard:**
53
+ - **Point of Contact:** [Tomáš Kočiský](mailto:[email protected]) [Jonathan Schwarz](mailto:[email protected]) [Phil Blunsom]([email protected]) [Chris Dyer]([email protected]) [Karl Moritz Hermann](mailto:[email protected]) [Gábor Melis](mailto:[email protected]) [Edward Grefenstette](mailto:[email protected])
54
+
55
+ ### Dataset Summary
56
+
57
+ NarrativeQA is an English-lanaguage dataset of stories and corresponding questions designed to test reading comprehension, especially on long documents.
58
+
59
+ ### Supported Tasks and Leaderboards
60
+
61
+ The dataset is used to test reading comprehension. There are 2 tasks proposed in the paper: "summaries only" and "stories only", depending on whether the human-generated summary or the full story text is used to answer the question.
62
+
63
+ ### Languages
64
+
65
+ English
66
+
67
+ ## Dataset Structure
68
+
69
+ ### Data Instances
70
+
71
+ A typical data point consists of a question and answer pair along with a summary/story which can be used to answer the question. Additional information such as the url, word count, wikipedia page, are also provided.
72
+
73
+ A typical example looks like this:
74
+ ```
75
+ {
76
+ "document": {
77
+ "id": "23jncj2n3534563110",
78
+ "kind": "movie",
79
+ "url": "https://www.imsdb.com/Movie%20Scripts/Name%20of%20Movie.html",
80
+ "file_size": 80473,
81
+ "word_count": 41000,
82
+ "start": "MOVIE screenplay by",
83
+ "end": ". THE END",
84
+ "summary": {
85
+ "text": "Joe Bloggs begins his journey exploring...",
86
+ "tokens": ["Joe", "Bloggs", "begins", "his", "journey", "exploring",...],
87
+ "url": "http://en.wikipedia.org/wiki/Name_of_Movie",
88
+ "title": "Name of Movie (film)"
89
+ },
90
+ "text": "MOVIE screenplay by John Doe\nSCENE 1..."
91
+ },
92
+ "question": {
93
+ "text": "Where does Joe Bloggs live?",
94
+ "tokens": ["Where", "does", "Joe", "Bloggs", "live", "?"],
95
+ },
96
+ "answers": [
97
+ {"text": "At home", "tokens": ["At", "home"]},
98
+ {"text": "His house", "tokens": ["His", "house"]}
99
+ ]
100
+ }
101
+ ```
102
+
103
+ ### Data Fields
104
+
105
+ - `document.id` - Unique ID for the story.
106
+ - `document.kind` - "movie" or "gutenberg" depending on the source of the story.
107
+ - `document.url` - The URL where the story was downloaded from.
108
+ - `document.file_size` - File size (in bytes) of the story.
109
+ - `document.word_count` - Number of tokens in the story.
110
+ - `document.start` - First 3 tokens of the story. Used for verifying the story hasn't been modified.
111
+ - `document.end` - Last 3 tokens of the story. Used for verifying the story hasn't been modified.
112
+ - `document.summary.text` - Text of the wikipedia summary of the story.
113
+ - `document.summary.tokens` - Tokenized version of `document.summary.text`.
114
+ - `document.summary.url` - Wikipedia URL of the summary.
115
+ - `document.summary.title` - Wikipedia Title of the summary.
116
+ - `question` - `{"text":"...", "tokens":[...]}` for the question about the story.
117
+ - `answers` - List of `{"text":"...", "tokens":[...]}` for valid answers for the question.
118
+
119
+ ### Data Splits
120
+
121
+ The data is split into training, valiudation, and test sets based on story (i.e. the same story cannot appear in more than one split):
122
+
123
+ | Train | Valid | Test |
124
+ | ------ | ----- | ----- |
125
+ | 32747 | 3461 | 10557 |
126
+
127
+ ## Dataset Creation
128
+
129
+ ### Curation Rationale
130
+
131
+ [More Information Needed]
132
+
133
+ ### Source Data
134
+
135
+ #### Initial Data Collection and Normalization
136
+ Stories and movies scripts were downloaded from [Project Gutenburg](https://www.gutenberg.org) and a range of movie script repositories (mainly [imsdb](http://www.imsdb.com)).
137
+
138
+ #### Who are the source language producers?
139
+
140
+ The language producers are authors of the stories and scripts as well as Amazon Turk workers for the questions.
141
+
142
+ ### Annotations
143
+
144
+ #### Annotation process
145
+
146
+ Amazon Turk Workers were provided with human written summaries of the stories (To make the annotation tractable and to lead annotators towards asking non-localized questions). Stories were matched with plot summaries from Wikipedia using titles and verified the matching with help from human annotators. The annotators were asked to determine if both the story and the summary refer to a movie or a book (as some books are made into movies), or if they are the same part in a series produced in the same year. Annotators on Amazon Mechanical Turk were instructed to write 10 question–answer pairs each based solely on a given summary. Annotators were instructed to imagine that they are writing questions to test students who have read the full stories but not the summaries. We required questions that are specific enough, given the length and complexity of the narratives, and to provide adiverse set of questions about characters, events, why this happened, and so on. Annotators were encouraged to use their own words and we prevented them from copying. We asked for answers that are grammatical, complete sentences, and explicitly allowed short answers (one word, or a few-word phrase, or ashort sentence) as we think that answering with a full sentence is frequently perceived as artificial when asking about factual information. Annotators were asked to avoid extra, unnecessary information in the question or the answer, and to avoid yes/no questions or questions about the author or the actors.
147
+
148
+ #### Who are the annotators?
149
+
150
+ Amazon Mechanical Turk workers.
151
+
152
+ ### Personal and Sensitive Information
153
+
154
+ None
155
+
156
+ ## Considerations for Using the Data
157
+
158
+ ### Social Impact of Dataset
159
+
160
+ [More Information Needed]
161
+
162
+ ### Discussion of Biases
163
+
164
+ [More Information Needed]
165
+
166
+ ### Other Known Limitations
167
+
168
+ [More Information Needed]
169
+
170
+ ## Additional Information
171
+
172
+ ### Dataset Curators
173
+
174
+ [More Information Needed]
175
+
176
+ ### Licensing Information
177
+
178
+ The dataset is released under a [Apache-2.0 License](https://github.com/deepmind/narrativeqa/blob/master/LICENSE).
179
+
180
+ ### Citation Information
181
+
182
+ ```
183
+ @article{narrativeqa,
184
+ author = {Tom\'a\v s Ko\v cisk\'y and Jonathan Schwarz and Phil Blunsom and
185
+ Chris Dyer and Karl Moritz Hermann and G\'abor Melis and
186
+ Edward Grefenstette},
187
+ title = {The {NarrativeQA} Reading Comprehension Challenge},
188
+ journal = {Transactions of the Association for Computational Linguistics},
189
+ url = {https://TBD},
190
+ volume = {TBD},
191
+ year = {2018},
192
+ pages = {TBD},
193
+ }
194
+ ```
dataset_infos.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"default": {"description": "The NarrativeQA dataset for question answering on long documents (movie scripts, books). It includes the list of documents with Wikipedia summaries, links to full stories, and questions and answers.\n", "citation": "@article{narrativeqa,\nauthor = {Tom\\'a\\v s Ko\\v cisk\\'y and Jonathan Schwarz and Phil Blunsom and\n Chris Dyer and Karl Moritz Hermann and G\\'abor Melis and\n Edward Grefenstette},\ntitle = {The {NarrativeQA} Reading Comprehension Challenge},\njournal = {Transactions of the Association for Computational Linguistics},\nurl = {https://TBD},\nvolume = {TBD},\nyear = {2018},\npages = {TBD},\n}\n", "homepage": "https://github.com/deepmind/narrativeqa", "license": "", "features": {"document": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "kind": {"dtype": "string", "id": null, "_type": "Value"}, "url": {"dtype": "string", "id": null, "_type": "Value"}, "file_size": {"dtype": "int32", "id": null, "_type": "Value"}, "word_count": {"dtype": "int32", "id": null, "_type": "Value"}, "start": {"dtype": "string", "id": null, "_type": "Value"}, "end": {"dtype": "string", "id": null, "_type": "Value"}, "summary": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "tokens": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "url": {"dtype": "string", "id": null, "_type": "Value"}, "title": {"dtype": "string", "id": null, "_type": "Value"}}, "text": {"dtype": "string", "id": null, "_type": "Value"}}, "question": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "tokens": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}}, "answers": [{"text": {"dtype": "string", "id": null, "_type": "Value"}, "tokens": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}}]}, "post_processed": null, "supervised_keys": null, "builder_name": "narrative_qa", "config_name": "default", "version": {"version_str": "0.0.0", "description": null, "major": 0, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 11565035136, "num_examples": 32747, "dataset_name": "narrative_qa"}, "test": {"name": "test", "num_bytes": 3549964281, "num_examples": 10557, "dataset_name": "narrative_qa"}, "validation": {"name": "validation", "num_bytes": 1211859490, "num_examples": 3461, "dataset_name": "narrative_qa"}}, "download_checksums": {"https://storage.googleapis.com/huggingface-nlp/datasets/narrative_qa/narrativeqa_full_text.zip": {"num_bytes": 187416846, "checksum": "3e179a579d348da37b4929f20ece277a721f853fdc5efc11f915904de2a71727"}, "https://github.com/deepmind/narrativeqa/archive/master.zip": {"num_bytes": 5112076, "checksum": "d9fc92d5f53409f845ba44780e6689676d879c739589861b4805064513d1476b"}}, "download_size": 192528922, "post_processing_size": null, "dataset_size": 16326858907, "size_in_bytes": 16519387829}}
dummy/0.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:748da35e2c7118ca01d297a529dabe1f94c2be69aa62323d468b750bd26093e8
3
+ size 4987
narrativeqa.py ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
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
+ """NarrativeQA Reading Comprehension Challenge"""
16
+
17
+ from __future__ import absolute_import, division, print_function
18
+
19
+ import csv
20
+ import os
21
+
22
+ import datasets
23
+
24
+
25
+ _CITATION = """\
26
+ @article{narrativeqa,
27
+ author = {Tom\\'a\\v s Ko\\v cisk\\'y and Jonathan Schwarz and Phil Blunsom and
28
+ Chris Dyer and Karl Moritz Hermann and G\\'abor Melis and
29
+ Edward Grefenstette},
30
+ title = {The {NarrativeQA} Reading Comprehension Challenge},
31
+ journal = {Transactions of the Association for Computational Linguistics},
32
+ url = {https://TBD},
33
+ volume = {TBD},
34
+ year = {2018},
35
+ pages = {TBD},
36
+ }
37
+ """
38
+
39
+ _DESCRIPTION = """\
40
+ The NarrativeQA dataset for question answering on long documents (movie scripts, books). It includes the list of documents with Wikipedia summaries, links to full stories, and questions and answers.
41
+ """
42
+
43
+ _URLS = {
44
+ "full_text": "https://storage.googleapis.com/huggingface-nlp/datasets/narrative_qa/narrativeqa_full_text.zip",
45
+ "repo": "https://github.com/deepmind/narrativeqa/archive/master.zip",
46
+ }
47
+
48
+
49
+ class NarrativeQa(datasets.GeneratorBasedBuilder):
50
+ """NarrativeQA: Question answering on long-documents"""
51
+
52
+ def _info(self):
53
+ return datasets.DatasetInfo(
54
+ description=_DESCRIPTION,
55
+ citation=_CITATION,
56
+ features=datasets.Features(
57
+ {
58
+ "document": {
59
+ "id": datasets.Value("string"),
60
+ "kind": datasets.Value("string"),
61
+ "url": datasets.Value("string"),
62
+ "file_size": datasets.Value("int32"),
63
+ "word_count": datasets.Value("int32"),
64
+ "start": datasets.Value("string"),
65
+ "end": datasets.Value("string"),
66
+ "summary": {
67
+ "text": datasets.Value("string"),
68
+ "tokens": datasets.features.Sequence(datasets.Value("string")),
69
+ "url": datasets.Value("string"),
70
+ "title": datasets.Value("string"),
71
+ },
72
+ "text": datasets.Value("string"),
73
+ },
74
+ "question": {
75
+ "text": datasets.Value("string"),
76
+ "tokens": datasets.features.Sequence(datasets.Value("string")),
77
+ },
78
+ "answers": [
79
+ {
80
+ "text": datasets.Value("string"),
81
+ "tokens": datasets.features.Sequence(datasets.Value("string")),
82
+ }
83
+ ],
84
+ }
85
+ ),
86
+ homepage="https://github.com/deepmind/narrativeqa",
87
+ )
88
+
89
+ def _split_generators(self, dl_manager):
90
+ """Returns SplitGenerators."""
91
+
92
+ dl_dir = dl_manager.download_and_extract(_URLS)
93
+ dl_dir["repo"] = os.path.join(dl_dir["repo"], "narrativeqa-master")
94
+
95
+ return [
96
+ datasets.SplitGenerator(
97
+ name=datasets.Split.TRAIN,
98
+ gen_kwargs={"repo_dir": dl_dir["repo"], "full_text_dir": dl_dir["full_text"], "split": "train"},
99
+ ),
100
+ datasets.SplitGenerator(
101
+ name=datasets.Split.TEST,
102
+ gen_kwargs={"repo_dir": dl_dir["repo"], "full_text_dir": dl_dir["full_text"], "split": "test"},
103
+ ),
104
+ datasets.SplitGenerator(
105
+ name=datasets.Split.VALIDATION,
106
+ gen_kwargs={"repo_dir": dl_dir["repo"], "full_text_dir": dl_dir["full_text"], "split": "valid"},
107
+ ),
108
+ ]
109
+
110
+ def _generate_examples(self, repo_dir, full_text_dir, split):
111
+ """Yields examples."""
112
+ documents = {}
113
+ with open(os.path.join(repo_dir, "documents.csv"), encoding="utf-8") as f:
114
+ reader = csv.DictReader(f)
115
+ for row in reader:
116
+ if row["set"] != split:
117
+ continue
118
+ documents[row["document_id"]] = row
119
+
120
+ summaries = {}
121
+ with open(os.path.join(repo_dir, "third_party", "wikipedia", "summaries.csv"), encoding="utf-8") as f:
122
+ reader = csv.DictReader(f)
123
+ for row in reader:
124
+ if row["set"] != split:
125
+ continue
126
+ summaries[row["document_id"]] = row
127
+
128
+ with open(os.path.join(repo_dir, "qaps.csv"), encoding="utf-8") as f:
129
+ reader = csv.DictReader(f)
130
+ for id_, row in enumerate(reader):
131
+ if row["set"] != split:
132
+ continue
133
+ document_id = row["document_id"]
134
+ document = documents[document_id]
135
+ summary = summaries[document_id]
136
+ full_text = open(os.path.join(full_text_dir, document_id + ".content"), encoding="latin-1").read()
137
+ res = {
138
+ "document": {
139
+ "id": document["document_id"],
140
+ "kind": document["kind"],
141
+ "url": document["story_url"],
142
+ "file_size": document["story_file_size"],
143
+ "word_count": document["story_word_count"],
144
+ "start": document["story_start"],
145
+ "end": document["story_end"],
146
+ "summary": {
147
+ "text": summary["summary"],
148
+ "tokens": summary["summary_tokenized"].split(),
149
+ "url": document["wiki_url"],
150
+ "title": document["wiki_title"],
151
+ },
152
+ "text": full_text,
153
+ },
154
+ "question": {"text": row["question"], "tokens": row["question_tokenized"].split()},
155
+ "answers": [
156
+ {"text": row["answer1"], "tokens": row["answer1_tokenized"].split()},
157
+ {"text": row["answer2"], "tokens": row["answer2_tokenized"].split()},
158
+ ],
159
+ }
160
+ yield id_, res