Datasets:

Sub-tasks:
extractive-qa
Languages:
English
Multilinguality:
monolingual
Language Creators:
crowdsourced
Annotations Creators:
crowdsourced
Source Datasets:
original
License:
system HF staff commited on
Commit
d484edc
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

.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,192 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ annotations_creators:
3
+ - crowdsourced
4
+ language_creators:
5
+ - crowdsourced
6
+ languages:
7
+ - en
8
+ licenses:
9
+ - mit
10
+ multilinguality:
11
+ - monolingual
12
+ size_categories:
13
+ combined-json:
14
+ - 10K<n<100K
15
+ split:
16
+ - 100K<n<1M
17
+ source_datasets:
18
+ - original
19
+ task_categories:
20
+ - question-answering
21
+ task_ids:
22
+ - extractive-qa
23
+ ---
24
+
25
+ # Dataset Card for NewsQA
26
+
27
+ ## Table of Contents
28
+ - [Dataset Description](#dataset-description)
29
+ - [Dataset Summary](#dataset-summary)
30
+ - [Supported Tasks](#supported-tasks-and-leaderboards)
31
+ - [Languages](#languages)
32
+ - [Dataset Structure](#dataset-structure)
33
+ - [Data Instances](#data-instances)
34
+ - [Data Fields](#data-instances)
35
+ - [Data Splits](#data-instances)
36
+ - [Dataset Creation](#dataset-creation)
37
+ - [Curation Rationale](#curation-rationale)
38
+ - [Source Data](#source-data)
39
+ - [Annotations](#annotations)
40
+ - [Personal and Sensitive Information](#personal-and-sensitive-information)
41
+ - [Considerations for Using the Data](#considerations-for-using-the-data)
42
+ - [Social Impact of Dataset](#social-impact-of-dataset)
43
+ - [Discussion of Biases](#discussion-of-biases)
44
+ - [Other Known Limitations](#other-known-limitations)
45
+ - [Additional Information](#additional-information)
46
+ - [Dataset Curators](#dataset-curators)
47
+ - [Licensing Information](#licensing-information)
48
+ - [Citation Information](#citation-information)
49
+
50
+ ## Dataset Description
51
+
52
+ - **Homepage:** https://www.microsoft.com/en-us/research/project/newsqa-dataset/
53
+ - **Repository:** https://github.com/Maluuba/newsqa
54
+ - **Paper:** https://www.aclweb.org/anthology/W17-2623/
55
+ - **Leaderboard:** [Needs More Information]
56
+ - **Point of Contact:** [Needs More Information]
57
+
58
+ ### Dataset Summary
59
+
60
+ NewsQA is a challenging machine comprehension dataset of over 100,000 human-generated question-answer pairs.
61
+ Crowdworkers supply questions and answers based on a set of over 10,000 news articles from CNN, with answers consisting of spans of text from the corresponding articles.
62
+
63
+ ### Supported Tasks and Leaderboards
64
+
65
+ [Needs More Information]
66
+
67
+ ### Languages
68
+
69
+ English
70
+
71
+ ## Dataset Structure
72
+
73
+ ### Data Instances
74
+
75
+ ```
76
+ {'questions': {'answers': [{'sourcerAnswers': [{'e': [297], 'noAnswer': [False], 's': [294]}, {'e': [0], 'noAnswer': [True], 's': [0]}, {'e': [0], 'noAnswer': [True], 's': [0]}]}, {'sourcerAnswers': [{'e': [271], 'noAnswer': [False], 's': [261]}, {'e': [271], 'noAnswer': [False], 's': [258]}, {'e': [271], 'noAnswer': [False], 's': [261]}]}, {'sourcerAnswers': [{'e': [33], 'noAnswer': [False], 's': [26]}, {'e': [0], 'noAnswer': [True], 's': [0]}, {'e': [640], 'noAnswer': [False], 's': [624]}]}, {'sourcerAnswers': [{'e': [218], 'noAnswer': [False], 's': [195]}, {'e': [218], 'noAnswer': [False], 's': [195]}]}, {'sourcerAnswers': [{'e': [0], 'noAnswer': [True], 's': [0]}, {'e': [218, 271], 'noAnswer': [False, False], 's': [195, 232]}, {'e': [0], 'noAnswer': [True], 's': [0]}]}, {'sourcerAnswers': [{'e': [192], 'noAnswer': [False], 's': [129]}, {'e': [151], 'noAnswer': [False], 's': [129]}, {'e': [151], 'noAnswer': [False], 's': [133]}]}, {'sourcerAnswers': [{'e': [218], 'noAnswer': [False], 's': [195]}, {'e': [218], 'noAnswer': [False], 's': [195]}]}, {'sourcerAnswers': [{'e': [297], 'noAnswer': [False], 's': [294]}, {'e': [297], 'noAnswer': [False], 's': [294]}]}, {'sourcerAnswers': [{'e': [297], 'noAnswer': [False], 's': [294]}, {'e': [297], 'noAnswer': [False], 's': [294]}]}], 'consensus': [{'badQuestion': False, 'e': 297, 'noAnswer': False, 's': 294}, {'badQuestion': False, 'e': 271, 'noAnswer': False, 's': 261}, {'badQuestion': False, 'e': 640, 'noAnswer': False, 's': 624}, {'badQuestion': False, 'e': 218, 'noAnswer': False, 's': 195}, {'badQuestion': False, 'e': 218, 'noAnswer': False, 's': 195}, {'badQuestion': False, 'e': 151, 'noAnswer': False, 's': 129}, {'badQuestion': False, 'e': 218, 'noAnswer': False, 's': 195}, {'badQuestion': False, 'e': 297, 'noAnswer': False, 's': 294}, {'badQuestion': False, 'e': 297, 'noAnswer': False, 's': 294}], 'isAnswerAbsent': [0, 0, 0, 0, 0, 0, 0, 0, 0], 'isQuestionBad': [0, 0, 0, 0, 0, 0, 0, 0, 0], 'q': ['What was the amount of children murdered?', 'When was Pandher sentenced to death?', 'The court aquitted Moninder Singh Pandher of what crime?', 'who was acquitted', 'who was sentenced', 'What was Moninder Singh Pandher acquitted for?', 'Who was sentenced to death in February?', 'how many people died', 'How many children and young women were murdered?'], 'validated_answers': [{'sourcerAnswers': [{'count': [0], 'e': [297], 'noAnswer': [False], 's': [294]}, {'count': [0], 'e': [0], 'noAnswer': [True], 's': [0]}, {'count': [0], 'e': [0], 'noAnswer': [True], 's': [0]}]}, {'sourcerAnswers': [{'count': [0], 'e': [271], 'noAnswer': [False], 's': [261]}, {'count': [0], 'e': [271], 'noAnswer': [False], 's': [258]}, {'count': [0], 'e': [271], 'noAnswer': [False], 's': [261]}]}, {'sourcerAnswers': [{'count': [0], 'e': [33], 'noAnswer': [False], 's': [26]}, {'count': [0], 'e': [0], 'noAnswer': [True], 's': [0]}, {'count': [0], 'e': [640], 'noAnswer': [False], 's': [624]}]}, {'sourcerAnswers': [{'count': [0], 'e': [218], 'noAnswer': [False], 's': [195]}, {'count': [0], 'e': [218], 'noAnswer': [False], 's': [195]}]}, {'sourcerAnswers': [{'count': [0], 'e': [0], 'noAnswer': [True], 's': [0]}, {'count': [0, 0], 'e': [218, 271], 'noAnswer': [False, False], 's': [195, 232]}, {'count': [0], 'e': [0], 'noAnswer': [True], 's': [0]}]}, {'sourcerAnswers': [{'count': [0], 'e': [192], 'noAnswer': [False], 's': [129]}, {'count': [0], 'e': [151], 'noAnswer': [False], 's': [129]}, {'count': [0], 'e': [151], 'noAnswer': [False], 's': [133]}]}, {'sourcerAnswers': [{'count': [0], 'e': [218], 'noAnswer': [False], 's': [195]}, {'count': [0], 'e': [218], 'noAnswer': [False], 's': [195]}]}, {'sourcerAnswers': [{'count': [0], 'e': [297], 'noAnswer': [False], 's': [294]}, {'count': [0], 'e': [297], 'noAnswer': [False], 's': [294]}]}, {'sourcerAnswers': [{'count': [0], 'e': [297], 'noAnswer': [False], 's': [294]}, {'count': [0], 'e': [297], 'noAnswer': [False], 's': [294]}]}]}, 'storyId': './cnn/stories/42d01e187213e86f5fe617fe32e716ff7fa3afc4.story', 'text': 'NEW DELHI, India (CNN) -- A high court in northern India on Friday acquitted a wealthy businessman facing the death sentence for the killing of a teen in a case dubbed "the house of horrors."\n\n\n\nMoninder Singh Pandher was sentenced to death by a lower court in February.\n\n\n\nThe teen was one of 19 victims -- children and young women -- in one of the most gruesome serial killings in India in recent years.\n\n\n\nThe Allahabad high court has acquitted Moninder Singh Pandher, his lawyer Sikandar B. Kochar told CNN.\n\n\n\nPandher and his domestic employee Surinder Koli were sentenced to death in February by a lower court for the rape and murder of the 14-year-old.\n\n\n\nThe high court upheld Koli\'s death sentence, Kochar said.\n\n\n\nThe two were arrested two years ago after body parts packed in plastic bags were found near their home in Noida, a New Delhi suburb. Their home was later dubbed a "house of horrors" by the Indian media.\n\n\n\nPandher was not named a main suspect by investigators initially, but was summoned as co-accused during the trial, Kochar said.\n\n\n\nKochar said his client was in Australia when the teen was raped and killed.\n\n\n\nPandher faces trial in the remaining 18 killings and could remain in custody, the attorney said.', 'type': 'train'}
77
+ ```
78
+
79
+ ### Data Fields
80
+
81
+
82
+ Configuration: combined-csv
83
+ - 'story_id': An identifier of the story
84
+ - 'story_text': text of the story
85
+ - 'question': A question about the story.
86
+ - 'answer_char_ranges': The raw data collected for character based indices to answers in story_text. E.g. 196:228|196:202,217:228|None. Answers from different crowdsourcers are separated by |, within those, multiple selections from the same crowdsourcer are separated by ,. None means the crowdsourcer thought there was no answer to the question in the story. The start is inclusive and the end is exclusive. The end may point to whitespace after a token.
87
+
88
+ Configuration: combined-csv
89
+ - 'storyId': An identifier of the story.
90
+ - 'text': Text of the story
91
+ - 'type': Split type - train, validation or test
92
+ - 'questions': A list containing the following.
93
+ - 'q': A question
94
+ - 'isAnswerAbsent': Proportion of crowdsourcers that said there was no answer to the question in the story.
95
+ - 'isQuestionBad': Proportion of crowdsourcers that said the question does not make sense.
96
+ - 'consensus': The consensus answer. Use this field to pick the best continuous answer span from the text. If you want to know about a question having multiple answers in the text then you can use the more detailed "answers" and "validatedAnswers". The object can have start and end positions like in the example above or can be {"badQuestion": true} or {"noAnswer": true}. Note that there is only one consensus answer since it's based on the majority agreement of the crowdsourcers.
97
+ - 's': start of the answer
98
+ - 'e': end of the answer
99
+ - 'badQuestion': The validator said that the question did not make sense.
100
+ - 'noAnswer': The crowdsourcer said that there was no answer to the question in the text.
101
+ - 'answers': The answers from various crowdsourcers.
102
+ - 'sourcerAnswers': The answer provided from one crowdsourcer.
103
+ - 's': start
104
+ - 'e': end
105
+ - 'noAnswer': The crowdsourcer said that there was no answer to the question in the text.
106
+ - 'validated_answers': The answers from the validators.
107
+ - 'sourcerAnswers': The answer provided from one crowdsourcer.
108
+ - 's': start
109
+ - 'e': end
110
+ - 'noAnswer': The crowdsourcer said that there was no answer to the question in the text.
111
+ - 'count': The number of validators that agreed with this answer.
112
+
113
+ Configuration: split
114
+ - 'story_id': An identifier of the story
115
+ - 'story_text': text of the story
116
+ - 'question': A question about the story.
117
+ - 'answer_token_ranges': Word based indices to answers in story_text. E.g. 196:202,217:228. Multiple selections from the same answer are separated by ,. The start is inclusive and the end is exclusive. The end may point to whitespace after a token.
118
+
119
+ ### Data Splits
120
+
121
+ split: Train, Validation and Test.
122
+ combined-csv and combined-json: train (whole dataset)
123
+
124
+ ## Dataset Creation
125
+
126
+ ### Curation Rationale
127
+
128
+ [More Information Needed]
129
+
130
+ ### Source Data
131
+
132
+ #### Initial Data Collection and Normalization
133
+
134
+ [Needs More Information]
135
+
136
+ #### Who are the source language producers?
137
+
138
+ [Needs More Information]
139
+
140
+ ### Annotations
141
+
142
+ #### Annotation process
143
+
144
+ [Needs More Information]
145
+
146
+ #### Who are the annotators?
147
+
148
+ [Needs More Information]
149
+
150
+ ### Personal and Sensitive Information
151
+
152
+ [Needs More Information]
153
+
154
+ ## Considerations for Using the Data
155
+
156
+ ### Social Impact of Dataset
157
+
158
+ [Needs More Information]
159
+
160
+ ### Discussion of Biases
161
+
162
+ [Needs More Information]
163
+
164
+ ### Other Known Limitations
165
+
166
+ [Needs More Information]
167
+
168
+ ## Additional Information
169
+
170
+ ### Dataset Curators
171
+
172
+ [Needs More Information]
173
+
174
+ ### Licensing Information
175
+
176
+ NewsQA Code
177
+ Copyright (c) Microsoft Corporation
178
+ All rights reserved.
179
+ MIT License
180
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
181
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
182
+ THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
183
+ © 2020 GitHub, Inc.
184
+
185
+ ### Citation Information
186
+
187
+ @inproceedings{trischler2017newsqa,
188
+ title={NewsQA: A Machine Comprehension Dataset},
189
+ author={Trischler, Adam and Wang, Tong and Yuan, Xingdi and Harris, Justin and Sordoni, Alessandro and Bachman, Philip and Suleman, Kaheer},
190
+ booktitle={Proceedings of the 2nd Workshop on Representation Learning for NLP},
191
+ pages={191--200},
192
+ year={2017}
dataset_infos.json ADDED
@@ -0,0 +1 @@
 
1
+ {"combined-csv": {"description": "NewsQA is a challenging machine comprehension dataset of over 100,000 human-generated question-answer pairs. Crowdworkers supply questions and answers based on a set of over 10,000 news articles from CNN, with answers consisting of spans of text from the corresponding articles.\n", "citation": "@inproceedings{trischler2017newsqa,\n title={NewsQA: A Machine Comprehension Dataset},\n author={Trischler, Adam and Wang, Tong and Yuan, Xingdi and Harris, Justin and Sordoni, Alessandro and Bachman, Philip and Suleman, Kaheer},\n booktitle={Proceedings of the 2nd Workshop on Representation Learning for NLP},\n pages={191--200},\n year={2017}\n}\n\n", "homepage": "https://www.microsoft.com/en-us/research/project/newsqa-dataset/", "license": "NewsQA CodeCopyright (c) Microsoft CorporationAll rights reserved.MIT LicensePermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\u00a9 2020 GitHub, Inc.", "features": {"story_id": {"dtype": "string", "id": null, "_type": "Value"}, "story_text": {"dtype": "string", "id": null, "_type": "Value"}, "question": {"dtype": "string", "id": null, "_type": "Value"}, "answer_char_ranges": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "builder_name": "newsqa", "config_name": "combined-csv", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 465942194, "num_examples": 119633, "dataset_name": "newsqa"}}, "download_checksums": {}, "download_size": 0, "post_processing_size": null, "dataset_size": 465942194, "size_in_bytes": 465942194}, "combined-json": {"description": "NewsQA is a challenging machine comprehension dataset of over 100,000 human-generated question-answer pairs. Crowdworkers supply questions and answers based on a set of over 10,000 news articles from CNN, with answers consisting of spans of text from the corresponding articles.\n", "citation": "@inproceedings{trischler2017newsqa,\n title={NewsQA: A Machine Comprehension Dataset},\n author={Trischler, Adam and Wang, Tong and Yuan, Xingdi and Harris, Justin and Sordoni, Alessandro and Bachman, Philip and Suleman, Kaheer},\n booktitle={Proceedings of the 2nd Workshop on Representation Learning for NLP},\n pages={191--200},\n year={2017}\n}\n\n", "homepage": "https://www.microsoft.com/en-us/research/project/newsqa-dataset/", "license": "NewsQA CodeCopyright (c) Microsoft CorporationAll rights reserved.MIT LicensePermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\u00a9 2020 GitHub, Inc.", "features": {"storyId": {"dtype": "string", "id": null, "_type": "Value"}, "text": {"dtype": "string", "id": null, "_type": "Value"}, "type": {"dtype": "string", "id": null, "_type": "Value"}, "questions": {"feature": {"q": {"dtype": "string", "id": null, "_type": "Value"}, "isAnswerAbsent": {"dtype": "int32", "id": null, "_type": "Value"}, "isQuestionBad": {"dtype": "int32", "id": null, "_type": "Value"}, "consensus": {"s": {"dtype": "int32", "id": null, "_type": "Value"}, "e": {"dtype": "int32", "id": null, "_type": "Value"}, "badQuestion": {"dtype": "bool", "id": null, "_type": "Value"}, "noAnswer": {"dtype": "bool", "id": null, "_type": "Value"}}, "answers": {"feature": {"sourcerAnswers": {"feature": {"s": {"dtype": "int32", "id": null, "_type": "Value"}, "e": {"dtype": "int32", "id": null, "_type": "Value"}, "noAnswer": {"dtype": "bool", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}}, "length": -1, "id": null, "_type": "Sequence"}, "validated_answers": {"feature": {"sourcerAnswers": {"feature": {"s": {"dtype": "int32", "id": null, "_type": "Value"}, "e": {"dtype": "int32", "id": null, "_type": "Value"}, "noAnswer": {"dtype": "bool", "id": null, "_type": "Value"}, "count": {"dtype": "int32", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}}, "length": -1, "id": null, "_type": "Sequence"}}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "builder_name": "newsqa", "config_name": "combined-json", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 74492925, "num_examples": 12744, "dataset_name": "newsqa"}}, "download_checksums": {}, "download_size": 0, "post_processing_size": null, "dataset_size": 74492925, "size_in_bytes": 74492925}, "split": {"description": "NewsQA is a challenging machine comprehension dataset of over 100,000 human-generated question-answer pairs. Crowdworkers supply questions and answers based on a set of over 10,000 news articles from CNN, with answers consisting of spans of text from the corresponding articles.\n", "citation": "@inproceedings{trischler2017newsqa,\n title={NewsQA: A Machine Comprehension Dataset},\n author={Trischler, Adam and Wang, Tong and Yuan, Xingdi and Harris, Justin and Sordoni, Alessandro and Bachman, Philip and Suleman, Kaheer},\n booktitle={Proceedings of the 2nd Workshop on Representation Learning for NLP},\n pages={191--200},\n year={2017}\n}\n\n", "homepage": "https://www.microsoft.com/en-us/research/project/newsqa-dataset/", "license": "NewsQA CodeCopyright (c) Microsoft CorporationAll rights reserved.MIT LicensePermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\u00a9 2020 GitHub, Inc.", "features": {"story_id": {"dtype": "string", "id": null, "_type": "Value"}, "story_text": {"dtype": "string", "id": null, "_type": "Value"}, "question": {"dtype": "string", "id": null, "_type": "Value"}, "answer_token_ranges": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "builder_name": "newsqa", "config_name": "split", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 362031288, "num_examples": 92549, "dataset_name": "newsqa"}, "test": {"name": "test", "num_bytes": 19763673, "num_examples": 5126, "dataset_name": "newsqa"}, "validation": {"name": "validation", "num_bytes": 19862778, "num_examples": 5166, "dataset_name": "newsqa"}}, "download_checksums": {}, "download_size": 0, "post_processing_size": null, "dataset_size": 401657739, "size_in_bytes": 401657739}}
dummy/combined-csv/1.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b25585ed352472e60eb4b632e94c13f2f90a6e7de2b8d1ac00823d6a51c9ecbc
3
+ size 2000
dummy/combined-json/1.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9531d0e08e624db51e3385707dced0a9dc4dfd512fdabcc0f5e52b46e1e6eced
3
+ size 5859
dummy/split/1.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c2e54ee2101ad6f31b78204bed059d89f0547691d970eafcf3ec030755cf84a7
3
+ size 25784
newsqa.py ADDED
@@ -0,0 +1,333 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ """This code is used to read and load NewsQA dataset."""
16
+
17
+ from __future__ import absolute_import, division, print_function
18
+
19
+ import csv
20
+ import json
21
+ import os
22
+
23
+ import datasets
24
+
25
+
26
+ # Find for instance the citation on arxiv or on the dataset repo/website
27
+ _CITATION = """\
28
+ @inproceedings{trischler2017newsqa,
29
+ title={NewsQA: A Machine Comprehension Dataset},
30
+ author={Trischler, Adam and Wang, Tong and Yuan, Xingdi and Harris, Justin and Sordoni, Alessandro and Bachman, Philip and Suleman, Kaheer},
31
+ booktitle={Proceedings of the 2nd Workshop on Representation Learning for NLP},
32
+ pages={191--200},
33
+ year={2017}
34
+ }
35
+
36
+ """
37
+
38
+ # You can copy an official description
39
+ _DESCRIPTION = """\
40
+ NewsQA is a challenging machine comprehension dataset of over 100,000 human-generated question-answer pairs. \
41
+ Crowdworkers supply questions and answers based on a set of over 10,000 news articles from CNN, with answers consisting of spans of text from the corresponding articles.
42
+ """
43
+
44
+ _HOMEPAGE = "https://www.microsoft.com/en-us/research/project/newsqa-dataset/"
45
+
46
+ _LICENSE = 'NewsQA Code\
47
+ Copyright (c) Microsoft Corporation\
48
+ All rights reserved.\
49
+ MIT License\
50
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\
51
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\
52
+ THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\
53
+ © 2020 GitHub, Inc.'
54
+
55
+
56
+ class Newsqa(datasets.GeneratorBasedBuilder):
57
+
58
+ VERSION = datasets.Version("1.0.0")
59
+
60
+ BUILDER_CONFIGS = [
61
+ datasets.BuilderConfig(
62
+ name="combined-csv",
63
+ version=VERSION,
64
+ description="This part of the dataset covers the whole dataset in the combined format of CSV as mentioned here: https://github.com/Maluuba/newsqa#csv",
65
+ ),
66
+ datasets.BuilderConfig(
67
+ name="combined-json",
68
+ version=VERSION,
69
+ description="This part of the dataset covers the whole dataset in the combine format of JSON as mentioned here: https://github.com/Maluuba/newsqa#json",
70
+ ),
71
+ datasets.BuilderConfig(
72
+ name="split",
73
+ version=VERSION,
74
+ description="This part of the dataset covers train, validation and test splits.",
75
+ ),
76
+ ]
77
+
78
+ DEFAULT_CONFIG_NAME = "split" # It's not mandatory to have a default configuration. Just use one if it make sense.
79
+
80
+ @property
81
+ def manual_download_instructions(self):
82
+ return """ Due to legal restrictions with the CNN data and data extraction. The data has to be downloaded from several sources and compiled as per the instructions by Authors. \
83
+ Upon obtaining the resulting data folders, it can be loaded easily using the datasets API. \
84
+ Please refer to (https://github.com/Maluuba/newsqa) to download data from Microsoft Reseach site (https://msropendata.com/datasets/939b1042-6402-4697-9c15-7a28de7e1321) \
85
+ and a CNN datasource (https://cs.nyu.edu/~kcho/DMQA/) and run the scripts present here (https://github.com/Maluuba/newsqa).\
86
+ This will generate a folder named "split-data" and a file named "combined-newsqa-data-v1.csv".\
87
+ Copy the above folder and the file to a directory where you want to store them locally.\
88
+ They must be used to load the dataset via `datasets.load_dataset("narqa", data_dir="<path/to/folder>")."""
89
+
90
+ def _info(self):
91
+
92
+ if (
93
+ self.config.name == "combined-csv"
94
+ ): # This is the name of the configuration selected in BUILDER_CONFIGS above
95
+ features = datasets.Features(
96
+ {
97
+ "story_id": datasets.Value("string"),
98
+ "story_text": datasets.Value("string"),
99
+ "question": datasets.Value("string"),
100
+ "answer_char_ranges": datasets.Value("string"),
101
+ }
102
+ )
103
+ elif (
104
+ self.config.name == "combined-json"
105
+ ): # This is an example to show how to have different features for "first_domain" and "second_domain"
106
+ features = datasets.Features(
107
+ {
108
+ "storyId": datasets.Value("string"),
109
+ "text": datasets.Value("string"),
110
+ "type": datasets.Value("string"),
111
+ "questions": datasets.features.Sequence(
112
+ {
113
+ "q": datasets.Value("string"),
114
+ "isAnswerAbsent": datasets.Value("int32"),
115
+ "isQuestionBad": datasets.Value("int32"),
116
+ "consensus": datasets.Features(
117
+ {
118
+ "s": datasets.Value("int32"),
119
+ "e": datasets.Value("int32"),
120
+ "badQuestion": datasets.Value("bool"),
121
+ "noAnswer": datasets.Value("bool"),
122
+ }
123
+ ),
124
+ "answers": datasets.features.Sequence(
125
+ {
126
+ "sourcerAnswers": datasets.features.Sequence(
127
+ {
128
+ "s": datasets.Value("int32"),
129
+ "e": datasets.Value("int32"),
130
+ "noAnswer": datasets.Value("bool"),
131
+ }
132
+ ),
133
+ }
134
+ ),
135
+ "validated_answers": datasets.features.Sequence(
136
+ {
137
+ "sourcerAnswers": datasets.features.Sequence(
138
+ {
139
+ "s": datasets.Value("int32"),
140
+ "e": datasets.Value("int32"),
141
+ "noAnswer": datasets.Value("bool"),
142
+ "count": datasets.Value("int32"),
143
+ }
144
+ ),
145
+ }
146
+ ),
147
+ }
148
+ ),
149
+ }
150
+ )
151
+ else: # This is the name of the configuration selected in BUILDER_CONFIGS above
152
+ features = datasets.Features(
153
+ {
154
+ "story_id": datasets.Value("string"),
155
+ "story_text": datasets.Value("string"),
156
+ "question": datasets.Value("string"),
157
+ "answer_token_ranges": datasets.Value("string"),
158
+ }
159
+ )
160
+ return datasets.DatasetInfo(
161
+ # This is the description that will appear on the datasets page.
162
+ description=_DESCRIPTION,
163
+ # This defines the different columns of the dataset and their types
164
+ features=features, # Here we define them above because they are different between the two configurations
165
+ # If there's a common (input, target) tuple from the features,
166
+ # specify them here. They'll be used if as_supervised=True in
167
+ # builder.as_dataset.
168
+ supervised_keys=None,
169
+ # Homepage of the dataset for documentation
170
+ homepage=_HOMEPAGE,
171
+ # License for the dataset if available
172
+ license=_LICENSE,
173
+ # Citation for the dataset
174
+ citation=_CITATION,
175
+ )
176
+
177
+ def _split_generators(self, dl_manager):
178
+ """Returns SplitGenerators."""
179
+
180
+ path_to_manual_folder = os.path.abspath(os.path.expanduser(dl_manager.manual_dir))
181
+ combined_file_csv = os.path.join(path_to_manual_folder, "combined-newsqa-data-v1.csv")
182
+ combined_file_json = os.path.join(path_to_manual_folder, "combined-newsqa-data-v1.json")
183
+ split_files = os.path.join(path_to_manual_folder, "split_data")
184
+
185
+ if not os.path.exists(path_to_manual_folder):
186
+ raise FileNotFoundError(
187
+ "{} does not exist. Make sure you insert a manual dir via `datasets.load_dataset('newsqa', data_dir=...)` that includes files from the Manual download instructions: {}".format(
188
+ path_to_manual_folder, self.manual_download_instructions
189
+ )
190
+ )
191
+
192
+ if self.config.name == "combined-csv":
193
+ return [
194
+ datasets.SplitGenerator(
195
+ name=datasets.Split.TRAIN,
196
+ # These kwargs will be passed to _generate_examples
197
+ gen_kwargs={
198
+ "filepath": combined_file_csv,
199
+ "split": "combined",
200
+ },
201
+ )
202
+ ]
203
+ elif self.config.name == "combined-json":
204
+ return [
205
+ datasets.SplitGenerator(
206
+ name=datasets.Split.TRAIN,
207
+ # These kwargs will be passed to _generate_examples
208
+ gen_kwargs={
209
+ "filepath": combined_file_json,
210
+ "split": "combined",
211
+ },
212
+ )
213
+ ]
214
+ else:
215
+ return [
216
+ datasets.SplitGenerator(
217
+ name=datasets.Split.TRAIN,
218
+ # These kwargs will be passed to _generate_examples
219
+ gen_kwargs={
220
+ "filepath": os.path.join(split_files, "train.csv"),
221
+ "split": "train",
222
+ },
223
+ ),
224
+ datasets.SplitGenerator(
225
+ name=datasets.Split.TEST,
226
+ # These kwargs will be passed to _generate_examples
227
+ gen_kwargs={"filepath": os.path.join(split_files, "test.csv"), "split": "test"},
228
+ ),
229
+ datasets.SplitGenerator(
230
+ name=datasets.Split.VALIDATION,
231
+ # These kwargs will be passed to _generate_examples
232
+ gen_kwargs={
233
+ "filepath": os.path.join(split_files, "dev.csv"),
234
+ "split": "dev",
235
+ },
236
+ ),
237
+ ]
238
+
239
+ def _generate_examples(self, filepath, split):
240
+ """ Yields examples. """
241
+
242
+ if self.config.name == "combined-csv":
243
+ with open(filepath, encoding="utf-8") as csv_file:
244
+ csv_reader = csv.reader(
245
+ csv_file, quotechar='"', delimiter=",", quoting=csv.QUOTE_ALL, skipinitialspace=True
246
+ )
247
+ _ = next(csv_reader)
248
+ for id_, row in enumerate(csv_reader):
249
+ if row:
250
+ yield row[0], {
251
+ "story_id": row[0],
252
+ "story_text": row[-1],
253
+ "question": row[1],
254
+ "answer_char_ranges": str(row[2:-2]),
255
+ }
256
+
257
+ elif self.config.name == "combined-json":
258
+ with open(filepath, encoding="utf-8") as f:
259
+ d = json.load(f)
260
+ data = d["data"]
261
+
262
+ for iter in data:
263
+
264
+ questions = []
265
+
266
+ for ques in iter["questions"]:
267
+ dict1 = {}
268
+ dict1["q"] = ques["q"]
269
+ if "isAnswerAbsent" in ques.keys():
270
+ dict1["isAnswerAbsent"] = ques["isAnswerAbsent"]
271
+ else:
272
+ dict1["isAnswerAbsent"] = 0.0
273
+ if "isQuestionBad" in ques.keys():
274
+ dict1["isQuestionBad"] = ques["isQuestionBad"]
275
+ else:
276
+ dict1["isQuestionBad"] = 0.0
277
+ dict1["consensus"] = {"s": 0, "e": 0, "badQuestion": False, "noAnswer": False}
278
+
279
+ for keys in ques["consensus"]:
280
+ dict1["consensus"][keys] = ques["consensus"][keys]
281
+
282
+ answers = []
283
+ for ans in ques["answers"]:
284
+ dict2 = {}
285
+ dict2["sourcerAnswers"] = []
286
+ for index, i in enumerate(ans["sourcerAnswers"]):
287
+ dict_temp = {"s": 0, "e": 0, "noAnswer": False}
288
+ for keys in i.keys():
289
+ dict_temp[keys] = i[keys]
290
+ dict2["sourcerAnswers"].append(dict_temp)
291
+
292
+ answers.append(dict2)
293
+
294
+ dict1["answers"] = answers
295
+
296
+ validated_answers = []
297
+ for ans in ques["answers"]:
298
+ dict2 = {}
299
+ dict2["sourcerAnswers"] = []
300
+ for index, i in enumerate(ans["sourcerAnswers"]):
301
+ dict_temp = {"s": 0, "e": 0, "noAnswer": False, "count": 0}
302
+ for keys in i.keys():
303
+ dict_temp[keys] = i[keys]
304
+
305
+ dict2["sourcerAnswers"].append(dict_temp)
306
+
307
+ validated_answers.append(dict2)
308
+
309
+ dict1["validated_answers"] = validated_answers
310
+ questions.append(dict1)
311
+
312
+ yield iter["storyId"], {
313
+ "storyId": iter["storyId"],
314
+ "text": iter["text"],
315
+ "type": iter["type"],
316
+ "questions": questions,
317
+ }
318
+ else:
319
+ with open(filepath, encoding="utf-8") as csv_file:
320
+
321
+ csv_reader = csv.reader(
322
+ csv_file, quotechar='"', delimiter=",", quoting=csv.QUOTE_ALL, skipinitialspace=True
323
+ )
324
+ _ = next(csv_reader)
325
+ for id_, row in enumerate(csv_reader):
326
+ if row:
327
+ # print (row)
328
+ yield row[0], {
329
+ "story_id": row[0],
330
+ "story_text": row[1],
331
+ "question": row[2],
332
+ "answer_token_ranges": row[3],
333
+ }