Commit
•
7857036
0
Parent(s):
Update files from the datasets library (from 1.3.0)
Browse filesRelease notes: https://github.com/huggingface/datasets/releases/tag/1.3.0
- .gitattributes +27 -0
- README.md +170 -0
- dataset_infos.json +1 -0
- dummy/ParaphraseRC/1.0.0/dummy_data.zip +3 -0
- dummy/SelfRC/1.0.0/dummy_data.zip +3 -0
- duorc.py +147 -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,170 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
ParaphraseRC:
|
14 |
+
- 100K<n<1M
|
15 |
+
SelfRC:
|
16 |
+
- 10K<n<100K
|
17 |
+
source_datasets:
|
18 |
+
- original
|
19 |
+
task_categories:
|
20 |
+
- question-answering
|
21 |
+
task_ids:
|
22 |
+
- abstractive-qa
|
23 |
+
- extractive-qa
|
24 |
+
---
|
25 |
+
|
26 |
+
# Dataset Card for duorc
|
27 |
+
|
28 |
+
## Table of Contents
|
29 |
+
- [Dataset Description](#dataset-description)
|
30 |
+
- [Dataset Summary](#dataset-summary)
|
31 |
+
- [Supported Tasks](#supported-tasks-and-leaderboards)
|
32 |
+
- [Languages](#languages)
|
33 |
+
- [Dataset Structure](#dataset-structure)
|
34 |
+
- [Data Instances](#data-instances)
|
35 |
+
- [Data Fields](#data-instances)
|
36 |
+
- [Data Splits](#data-instances)
|
37 |
+
- [Dataset Creation](#dataset-creation)
|
38 |
+
- [Curation Rationale](#curation-rationale)
|
39 |
+
- [Source Data](#source-data)
|
40 |
+
- [Annotations](#annotations)
|
41 |
+
- [Personal and Sensitive Information](#personal-and-sensitive-information)
|
42 |
+
- [Considerations for Using the Data](#considerations-for-using-the-data)
|
43 |
+
- [Social Impact of Dataset](#social-impact-of-dataset)
|
44 |
+
- [Discussion of Biases](#discussion-of-biases)
|
45 |
+
- [Other Known Limitations](#other-known-limitations)
|
46 |
+
- [Additional Information](#additional-information)
|
47 |
+
- [Dataset Curators](#dataset-curators)
|
48 |
+
- [Licensing Information](#licensing-information)
|
49 |
+
- [Citation Information](#citation-information)
|
50 |
+
- [Contributions](#contributions)
|
51 |
+
|
52 |
+
## Dataset Description
|
53 |
+
|
54 |
+
- **Homepage:** [DuoRC](https://duorc.github.io/)
|
55 |
+
- **Repository:** [GitHub](https://github.com/duorc/duorc)
|
56 |
+
- **Paper:** [arXiv](https://arxiv.org/abs/1804.07927)
|
57 |
+
- **Leaderboard:** [DuoRC Leaderboard](https://duorc.github.io/#leaderboard)
|
58 |
+
- **Point of Contact:** [Needs More Information]
|
59 |
+
|
60 |
+
### Dataset Summary
|
61 |
+
|
62 |
+
The DuoRC dataset is an English language dataset of questions and answers gathered from crowdsourced AMT workers on Wikipedia and IMDb movie plots. The workers were given freedom to pick answer from the plots or synthesize their own answers. It contains two sub-datasets - SelfRC and ParaphraseRC. SelfRC dataset is built on Wikipedia movie plots solely. ParaphraseRC has questions written from Wikipedia movie plots and the answers are given based on corresponding IMDb movie plots.
|
63 |
+
|
64 |
+
### Supported Tasks and Leaderboards
|
65 |
+
|
66 |
+
- `abstractive-qa` : The dataset can be used to train a model for Abstractive Question Answering. An abstractive question answering model is presented with a passage and a question and is expected to generate a multi-word answer. The model performance is measured by exact-match and F1 score, similar to [SQuAD V1.1](https://huggingface.co/metrics/squad) or [SQuAD V2](https://huggingface.co/metrics/squad_v2). A [BART-based model](https://huggingface.co/yjernite/bart_eli5) with a [dense retriever](https://huggingface.co/yjernite/retribert-base-uncased) may be used for this task.
|
67 |
+
|
68 |
+
- `extractive-qa`: The dataset can be used to train a model for Extractive Question Answering. An extractive question answering model is presented with a passage and a question and is expected to predict the start and end of the answer span in the passage. The model performance is measured by exact-match and F1 score, similar to [SQuAD V1.1](https://huggingface.co/metrics/squad) or [SQuAD V2](https://huggingface.co/metrics/squad_v2). [BertForQuestionAnswering](https://huggingface.co/transformers/model_doc/bert.html#bertforquestionanswering) or any other similar model may be used for this task.
|
69 |
+
|
70 |
+
### Languages
|
71 |
+
|
72 |
+
The text in the dataset is in English, as spoken by Wikipedia writers for movie plots. The associated BCP-47 code is `en`.
|
73 |
+
|
74 |
+
## Dataset Structure
|
75 |
+
|
76 |
+
### Data Instances
|
77 |
+
|
78 |
+
```
|
79 |
+
{'answers': ['They arrived by train.'], 'no_answer': False, 'plot': "200 years in the future, Mars has been colonized by a high-tech company.\nMelanie Ballard (Natasha Henstridge) arrives by train to a Mars mining camp which has cut all communication links with the company headquarters. She's not alone, as she is with a group of fellow police officers. They find the mining camp deserted except for a person in the prison, Desolation Williams (Ice Cube), who seems to laugh about them because they are all going to die. They were supposed to take Desolation to headquarters, but decide to explore first to find out what happened.They find a man inside an encapsulated mining car, who tells them not to open it. However, they do and he tries to kill them. One of the cops witnesses strange men with deep scarred and heavily tattooed faces killing the remaining survivors. The cops realise they need to leave the place fast.Desolation explains that the miners opened a kind of Martian construction in the soil which unleashed red dust. Those who breathed that dust became violent psychopaths who started to build weapons and kill the uninfected. They changed genetically, becoming distorted but much stronger.The cops and Desolation leave the prison with difficulty, and devise a plan to kill all the genetically modified ex-miners on the way out. However, the plan goes awry, and only Melanie and Desolation reach headquarters alive. Melanie realises that her bosses won't ever believe her. However, the red dust eventually arrives to headquarters, and Melanie and Desolation need to fight once again.", 'plot_id': '/m/03vyhn', 'question': 'How did the police arrive at the Mars mining camp?', 'question_id': 'b440de7d-9c3f-841c-eaec-a14bdff950d1', 'title': 'Ghosts of Mars'}
|
80 |
+
```
|
81 |
+
|
82 |
+
### Data Fields
|
83 |
+
|
84 |
+
- `plot_id`: a `string` feature containing the movie plot ID.
|
85 |
+
- `plot`: a `string` feature containing the movie plot text.
|
86 |
+
- `title`: a `string` feature containing the movie title.
|
87 |
+
- `question_id`: a `string` feature containing the question ID.
|
88 |
+
- `question`: a `string` feature containing the question text.
|
89 |
+
- `answers`: a `list` of `string` features containing list of answers.
|
90 |
+
- `no_answer`: a `bool` feature informing whether the question has no answer or not.
|
91 |
+
|
92 |
+
|
93 |
+
### Data Splits
|
94 |
+
|
95 |
+
The data is split into a training, dev and test set in such a way that the resulting sets contain 70%, 15%, and 15% of the total QA pairs and no QA pairs for any movie seen in train are included in the test set. The final split sizes are as follows:
|
96 |
+
|
97 |
+
Name Train Dec Test
|
98 |
+
SelfRC 60721 12961 12599
|
99 |
+
ParaphraseRC 69524 15591 15857
|
100 |
+
## Dataset Creation
|
101 |
+
|
102 |
+
### Curation Rationale
|
103 |
+
|
104 |
+
[Needs More Information]
|
105 |
+
|
106 |
+
### Source Data
|
107 |
+
|
108 |
+
Wikipedia and IMDb movie plots
|
109 |
+
|
110 |
+
#### Initial Data Collection and Normalization
|
111 |
+
|
112 |
+
[Needs More Information]
|
113 |
+
|
114 |
+
#### Who are the source language producers?
|
115 |
+
|
116 |
+
[Needs More Information]
|
117 |
+
|
118 |
+
### Annotations
|
119 |
+
|
120 |
+
#### Annotation process
|
121 |
+
|
122 |
+
For SelfRC, the annotators were allowed to mark an answer span in the plot or synthesize their own answers after reading Wikipedia movie plots.
|
123 |
+
For ParaphraseRC, questions from the Wikipedia movie plots from SelfRC were used and the annotators were asked to answer based on IMDb movie plots.
|
124 |
+
|
125 |
+
#### Who are the annotators?
|
126 |
+
|
127 |
+
Amazon Mechanical Turk Workers
|
128 |
+
|
129 |
+
### Personal and Sensitive Information
|
130 |
+
|
131 |
+
[Needs More Information]
|
132 |
+
|
133 |
+
## Considerations for Using the Data
|
134 |
+
|
135 |
+
### Social Impact of Dataset
|
136 |
+
|
137 |
+
[Needs More Information]
|
138 |
+
|
139 |
+
### Discussion of Biases
|
140 |
+
|
141 |
+
[Needs More Information]
|
142 |
+
|
143 |
+
### Other Known Limitations
|
144 |
+
|
145 |
+
[Needs More Information]
|
146 |
+
|
147 |
+
## Additional Information
|
148 |
+
|
149 |
+
### Dataset Curators
|
150 |
+
|
151 |
+
The dataset was intially created by Amrita Saha, Rahul Aralikatte, Mitesh M. Khapra, and Karthik Sankaranarayanan in a collaborated work between IIT Madras and IBM Research.
|
152 |
+
|
153 |
+
### Licensing Information
|
154 |
+
|
155 |
+
[MIT License](https://github.com/duorc/duorc/blob/master/LICENSE)
|
156 |
+
|
157 |
+
### Citation Information
|
158 |
+
|
159 |
+
```
|
160 |
+
@inproceedings{DuoRC,
|
161 |
+
author = { Amrita Saha and Rahul Aralikatte and Mitesh M. Khapra and Karthik Sankaranarayanan},
|
162 |
+
title = {{DuoRC: Towards Complex Language Understanding with Paraphrased Reading Comprehension}},
|
163 |
+
booktitle = {Meeting of the Association for Computational Linguistics (ACL)},
|
164 |
+
year = {2018}
|
165 |
+
}
|
166 |
+
```
|
167 |
+
|
168 |
+
### Contributions
|
169 |
+
|
170 |
+
Thanks to [@gchhablani](https://github.com/gchhablani) for adding this dataset.
|
dataset_infos.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"SelfRC": {"description": "DuoRC contains 186,089 unique question-answer pairs created from a collection of 7680 pairs of movie plots where each pair in the collection reflects two versions of the same movie.\n", "citation": "@inproceedings{DuoRC,\nauthor = { Amrita Saha and Rahul Aralikatte and Mitesh M. Khapra and Karthik Sankaranarayanan},title = {{DuoRC: Towards Complex Language Understanding with Paraphrased Reading Comprehension}},\nbooktitle = {Meeting of the Association for Computational Linguistics (ACL)},\nyear = {2018}\n}\n", "homepage": "https://duorc.github.io/", "license": "https://raw.githubusercontent.com/duorc/duorc/master/LICENSE", "features": {"plot_id": {"dtype": "string", "id": null, "_type": "Value"}, "plot": {"dtype": "string", "id": null, "_type": "Value"}, "title": {"dtype": "string", "id": null, "_type": "Value"}, "question_id": {"dtype": "string", "id": null, "_type": "Value"}, "question": {"dtype": "string", "id": null, "_type": "Value"}, "answers": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "no_answer": {"dtype": "bool", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "builder_name": "duorc", "config_name": "SelfRC", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 239852925, "num_examples": 60721, "dataset_name": "duorc"}, "validation": {"name": "validation", "num_bytes": 51662575, "num_examples": 12961, "dataset_name": "duorc"}, "test": {"name": "test", "num_bytes": 49142766, "num_examples": 12559, "dataset_name": "duorc"}}, "download_checksums": {"https://raw.githubusercontent.com/duorc/duorc/master/dataset/SelfRC_train.json": {"num_bytes": 24388192, "checksum": "38c9dd56f3f0debc5d86ac9eadc42ab06e3bf4095feb0f7dd2c968a1555d774e"}, "https://raw.githubusercontent.com/duorc/duorc/master/dataset/SelfRC_dev.json": {"num_bytes": 5051240, "checksum": "003bc7f551041cbdbc433276cffbebf02a743d58e7d295b990c66bb643c75ffa"}, "https://raw.githubusercontent.com/duorc/duorc/master/dataset/SelfRC_test.json": {"num_bytes": 5023228, "checksum": "3372be8248a9dba7455eb22ff035378b40bf125cf8ae1409d9affebb4d2fe96f"}}, "download_size": 34462660, "post_processing_size": null, "dataset_size": 340658266, "size_in_bytes": 375120926}, "ParaphraseRC": {"description": "DuoRC contains 186,089 unique question-answer pairs created from a collection of 7680 pairs of movie plots where each pair in the collection reflects two versions of the same movie.\n", "citation": "@inproceedings{DuoRC,\nauthor = { Amrita Saha and Rahul Aralikatte and Mitesh M. Khapra and Karthik Sankaranarayanan},title = {{DuoRC: Towards Complex Language Understanding with Paraphrased Reading Comprehension}},\nbooktitle = {Meeting of the Association for Computational Linguistics (ACL)},\nyear = {2018}\n}\n", "homepage": "https://duorc.github.io/", "license": "https://raw.githubusercontent.com/duorc/duorc/master/LICENSE", "features": {"plot_id": {"dtype": "string", "id": null, "_type": "Value"}, "plot": {"dtype": "string", "id": null, "_type": "Value"}, "title": {"dtype": "string", "id": null, "_type": "Value"}, "question_id": {"dtype": "string", "id": null, "_type": "Value"}, "question": {"dtype": "string", "id": null, "_type": "Value"}, "answers": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "no_answer": {"dtype": "bool", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "builder_name": "duorc", "config_name": "ParaphraseRC", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 496683105, "num_examples": 69524, "dataset_name": "duorc"}, "validation": {"name": "validation", "num_bytes": 106510545, "num_examples": 15591, "dataset_name": "duorc"}, "test": {"name": "test", "num_bytes": 115215816, "num_examples": 15857, "dataset_name": "duorc"}}, "download_checksums": {"https://raw.githubusercontent.com/duorc/duorc/master/dataset/ParaphraseRC_train.json": {"num_bytes": 43374860, "checksum": "8a22500def833cf33a4eaaf7c00b5fc144b5fe26d40e6d94a96bd23a88056193"}, "https://raw.githubusercontent.com/duorc/duorc/master/dataset/ParaphraseRC_dev.json": {"num_bytes": 9319561, "checksum": "6d49a1ace1cebe7c73063551e91548725c75db505e1ada58af81c0e1dd21fe60"}, "https://raw.githubusercontent.com/duorc/duorc/master/dataset/ParaphraseRC_test.json": {"num_bytes": 10226629, "checksum": "98e471e3b8203664b1656f19fd22d50c3e8ec4e84792846ccf1ccbf0c1298799"}}, "download_size": 62921050, "post_processing_size": null, "dataset_size": 718409466, "size_in_bytes": 781330516}}
|
dummy/ParaphraseRC/1.0.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d59230b2fde45fecd9f0316f9bb16e7ba6a16d22ded7536c6bb97fcc34dfdae5
|
3 |
+
size 61456
|
dummy/SelfRC/1.0.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:80c9a32f9a2beef2ec45690b1193130c863703a7a29b9ea9e479108299d5fefc
|
3 |
+
size 38672
|
duorc.py
ADDED
@@ -0,0 +1,147 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
"""DuoRC: A Paraphrased
|
16 |
+
Reading Comprehension Question Answering Dataset"""
|
17 |
+
|
18 |
+
from __future__ import absolute_import, division, print_function
|
19 |
+
|
20 |
+
import json
|
21 |
+
|
22 |
+
import datasets
|
23 |
+
|
24 |
+
|
25 |
+
_CITATION = """\
|
26 |
+
@inproceedings{DuoRC,
|
27 |
+
author = { Amrita Saha and Rahul Aralikatte and Mitesh M. Khapra and Karthik Sankaranarayanan},\
|
28 |
+
title = {{DuoRC: Towards Complex Language Understanding with Paraphrased Reading Comprehension}},
|
29 |
+
booktitle = {Meeting of the Association for Computational Linguistics (ACL)},
|
30 |
+
year = {2018}
|
31 |
+
}
|
32 |
+
"""
|
33 |
+
|
34 |
+
|
35 |
+
_DESCRIPTION = """\
|
36 |
+
DuoRC contains 186,089 unique question-answer pairs created from a collection of 7680 pairs of movie plots where each pair in the collection reflects two versions of the same movie.
|
37 |
+
"""
|
38 |
+
|
39 |
+
_HOMEPAGE = "https://duorc.github.io/"
|
40 |
+
|
41 |
+
_LICENSE = "https://raw.githubusercontent.com/duorc/duorc/master/LICENSE"
|
42 |
+
|
43 |
+
_URL = "https://raw.githubusercontent.com/duorc/duorc/master/dataset/"
|
44 |
+
_URLs = {
|
45 |
+
"SelfRC": {
|
46 |
+
"train": _URL + "SelfRC_train.json",
|
47 |
+
"dev": _URL + "SelfRC_dev.json",
|
48 |
+
"test": _URL + "SelfRC_test.json",
|
49 |
+
},
|
50 |
+
"ParaphraseRC": {
|
51 |
+
"train": _URL + "ParaphraseRC_train.json",
|
52 |
+
"dev": _URL + "ParaphraseRC_dev.json",
|
53 |
+
"test": _URL + "ParaphraseRC_test.json",
|
54 |
+
},
|
55 |
+
}
|
56 |
+
|
57 |
+
|
58 |
+
class DuorcConfig(datasets.BuilderConfig):
|
59 |
+
"""BuilderConfig for DuoRC SelfRC."""
|
60 |
+
|
61 |
+
def __init__(self, **kwargs):
|
62 |
+
"""BuilderConfig for DuoRC SelfRC.
|
63 |
+
Args:
|
64 |
+
**kwargs: keyword arguments forwarded to super.
|
65 |
+
"""
|
66 |
+
super(DuorcConfig, self).__init__(**kwargs)
|
67 |
+
|
68 |
+
|
69 |
+
class Duorc(datasets.GeneratorBasedBuilder):
|
70 |
+
"""DuoRC Dataset"""
|
71 |
+
|
72 |
+
VERSION = datasets.Version("1.0.0")
|
73 |
+
BUILDER_CONFIGS = [
|
74 |
+
DuorcConfig(name="SelfRC", version=VERSION, description="SelfRC dataset"),
|
75 |
+
DuorcConfig(name="ParaphraseRC", version=VERSION, description="ParaphraseRC dataset"),
|
76 |
+
]
|
77 |
+
|
78 |
+
def _info(self):
|
79 |
+
return datasets.DatasetInfo(
|
80 |
+
# This is the description that will appear on the datasets page.
|
81 |
+
description=_DESCRIPTION,
|
82 |
+
# This defines the different columns of the dataset and their types
|
83 |
+
features=datasets.Features(
|
84 |
+
{
|
85 |
+
"plot_id": datasets.Value("string"),
|
86 |
+
"plot": datasets.Value("string"),
|
87 |
+
"title": datasets.Value("string"),
|
88 |
+
"question_id": datasets.Value("string"),
|
89 |
+
"question": datasets.Value("string"),
|
90 |
+
"answers": datasets.features.Sequence(datasets.Value("string")),
|
91 |
+
"no_answer": datasets.Value("bool"),
|
92 |
+
}
|
93 |
+
),
|
94 |
+
supervised_keys=None,
|
95 |
+
homepage=_HOMEPAGE,
|
96 |
+
license=_LICENSE,
|
97 |
+
citation=_CITATION,
|
98 |
+
)
|
99 |
+
|
100 |
+
def _split_generators(self, dl_manager):
|
101 |
+
"""Returns SplitGenerators."""
|
102 |
+
my_urls = _URLs[self.config.name]
|
103 |
+
downloaded_files = dl_manager.download_and_extract(my_urls)
|
104 |
+
return [
|
105 |
+
datasets.SplitGenerator(
|
106 |
+
name=datasets.Split.TRAIN,
|
107 |
+
gen_kwargs={
|
108 |
+
"filepath": downloaded_files["train"],
|
109 |
+
},
|
110 |
+
),
|
111 |
+
datasets.SplitGenerator(
|
112 |
+
name=datasets.Split.VALIDATION,
|
113 |
+
gen_kwargs={
|
114 |
+
"filepath": downloaded_files["dev"],
|
115 |
+
},
|
116 |
+
),
|
117 |
+
datasets.SplitGenerator(
|
118 |
+
name=datasets.Split.TEST,
|
119 |
+
gen_kwargs={
|
120 |
+
"filepath": downloaded_files["test"],
|
121 |
+
},
|
122 |
+
),
|
123 |
+
]
|
124 |
+
|
125 |
+
def _generate_examples(self, filepath):
|
126 |
+
"""This function returns the examples in the raw (text) form."""
|
127 |
+
with open(filepath, encoding="utf-8") as f:
|
128 |
+
duorc = json.load(f)
|
129 |
+
for example in duorc:
|
130 |
+
plot_id = example["id"]
|
131 |
+
plot = example["plot"].strip()
|
132 |
+
title = example["title"].strip()
|
133 |
+
for qas in example["qa"]:
|
134 |
+
question_id = qas["id"]
|
135 |
+
question = qas["question"].strip()
|
136 |
+
answers = [answer.strip() for answer in qas["answers"]]
|
137 |
+
no_answer = qas["no_answer"]
|
138 |
+
|
139 |
+
yield question_id, {
|
140 |
+
"title": title,
|
141 |
+
"plot": plot,
|
142 |
+
"question": question,
|
143 |
+
"plot_id": plot_id,
|
144 |
+
"question_id": question_id,
|
145 |
+
"answers": answers,
|
146 |
+
"no_answer": no_answer,
|
147 |
+
}
|