Commit
•
2f07800
0
Parent(s):
Update files from the datasets library (from 1.2.0)
Browse filesRelease notes: https://github.com/huggingface/datasets/releases/tag/1.2.0
- .gitattributes +27 -0
- README.md +140 -0
- dataset_infos.json +1 -0
- dummy/plain_text/1.0.0/dummy_data.zip +3 -0
- inquisitive_qg.py +161 -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,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
annotations_creators:
|
3 |
+
- crowdsourced
|
4 |
+
language_creators:
|
5 |
+
- crowdsourced
|
6 |
+
languages:
|
7 |
+
- en
|
8 |
+
licenses:
|
9 |
+
- unknown
|
10 |
+
multilinguality:
|
11 |
+
- monolingual
|
12 |
+
size_categories:
|
13 |
+
- 10K<n<100K
|
14 |
+
source_datasets:
|
15 |
+
- original
|
16 |
+
task_categories:
|
17 |
+
- conditional-text-generation
|
18 |
+
task_ids:
|
19 |
+
- conditional-text-generation-other-question-generation
|
20 |
+
---
|
21 |
+
|
22 |
+
# Dataset Card Creation Guide
|
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-instances)
|
32 |
+
- [Data Splits](#data-instances)
|
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:** [Add homepage URL here if available (unless it's a GitHub repository)]()
|
50 |
+
- **Repository:** [If the dataset is hosted on github or has a github homepage, add URL here]()
|
51 |
+
- **Paper:** [If the dataset was introduced by a paper or there was a paper written describing the dataset, add URL here (landing page for Arxiv paper preferred)]()
|
52 |
+
- **Leaderboard:** [If the dataset supports an active leaderboard, add link here]()
|
53 |
+
- **Point of Contact:** [If known, name and email of at least one person the reader can contact for questions about the dataset.]()
|
54 |
+
|
55 |
+
### Dataset Summary
|
56 |
+
|
57 |
+
[More Information Needed]
|
58 |
+
|
59 |
+
### Supported Tasks and Leaderboards
|
60 |
+
|
61 |
+
[More Information Needed]
|
62 |
+
|
63 |
+
### Languages
|
64 |
+
|
65 |
+
[More Information Needed]
|
66 |
+
|
67 |
+
## Dataset Structure
|
68 |
+
|
69 |
+
### Data Instances
|
70 |
+
|
71 |
+
[More Information Needed]
|
72 |
+
|
73 |
+
### Data Fields
|
74 |
+
|
75 |
+
[More Information Needed]
|
76 |
+
|
77 |
+
### Data Splits
|
78 |
+
|
79 |
+
[More Information Needed]
|
80 |
+
## Dataset Creation
|
81 |
+
|
82 |
+
### Curation Rationale
|
83 |
+
|
84 |
+
[More Information Needed]
|
85 |
+
|
86 |
+
### Source Data
|
87 |
+
|
88 |
+
[More Information Needed]
|
89 |
+
|
90 |
+
#### Initial Data Collection and Normalization
|
91 |
+
|
92 |
+
[More Information Needed]
|
93 |
+
|
94 |
+
#### Who are the source language producers?
|
95 |
+
|
96 |
+
[More Information Needed]
|
97 |
+
|
98 |
+
### Annotations
|
99 |
+
|
100 |
+
[More Information Needed]
|
101 |
+
|
102 |
+
#### Annotation process
|
103 |
+
|
104 |
+
[More Information Needed]
|
105 |
+
|
106 |
+
#### Who are the annotators?
|
107 |
+
|
108 |
+
[More Information Needed]
|
109 |
+
|
110 |
+
### Personal and Sensitive Information
|
111 |
+
|
112 |
+
[More Information Needed]
|
113 |
+
|
114 |
+
## Considerations for Using the Data
|
115 |
+
|
116 |
+
### Social Impact of Dataset
|
117 |
+
|
118 |
+
[More Information Needed]
|
119 |
+
|
120 |
+
### Discussion of Biases
|
121 |
+
|
122 |
+
[More Information Needed]
|
123 |
+
|
124 |
+
### Other Known Limitations
|
125 |
+
|
126 |
+
[More Information Needed]
|
127 |
+
|
128 |
+
## Additional Information
|
129 |
+
|
130 |
+
### Dataset Curators
|
131 |
+
|
132 |
+
[More Information Needed]
|
133 |
+
|
134 |
+
### Licensing Information
|
135 |
+
|
136 |
+
[More Information Needed]
|
137 |
+
|
138 |
+
### Citation Information
|
139 |
+
|
140 |
+
[More Information Needed]
|
dataset_infos.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"plain_text": {"description": "A dataset of about 20k questions that are elicited from readers as they naturally read through a document sentence by sentence. Compared to existing datasets, INQUISITIVE questions target more towards high-level (semantic and discourse) comprehension of text. Because these questions are generated while the readers are pro-cessing the information, the questions directly communicate gaps between the reader\u2019s and writer\u2019s knowledge about the events described in the text, and are not necessarily answered in the document itself. This type of question reflects a real-world scenario: if one has questions during reading, some of them are answered by the text later on, the rest are not, but any of them would help further the reader\u2019s understanding at the particular point when they asked it. This resource could enable question generation models to simulate human-like curiosity and cognitive processing, which may open up a new realm of applications.\n", "citation": "@InProceedings{ko2020inquisitive,\n author = {Ko, Wei-Jen and Chen, Te-Yuan and Huang, Yiyan and Durrett, Greg and Li, Junyi Jessy},\n title = {Inquisitive Question Generation for High Level Text Comprehension},\n booktitle = {Proceedings of EMNLP},\n year = {2020},\n}\n", "homepage": "https://github.com/wjko2/INQUISITIVE", "license": "", "features": {"id": {"dtype": "int32", "id": null, "_type": "Value"}, "article_id": {"dtype": "int32", "id": null, "_type": "Value"}, "article": {"dtype": "string", "id": null, "_type": "Value"}, "sentence_id": {"dtype": "int32", "id": null, "_type": "Value"}, "sentence": {"dtype": "string", "id": null, "_type": "Value"}, "span": {"dtype": "string", "id": null, "_type": "Value"}, "question": {"dtype": "string", "id": null, "_type": "Value"}, "span_start_position": {"dtype": "int32", "id": null, "_type": "Value"}, "span_end_position": {"dtype": "int32", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "builder_name": "inquisitive_qg", "config_name": "plain_text", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 66099232, "num_examples": 15931, "dataset_name": "inquisitive_qg"}, "validation": {"name": "validation", "num_bytes": 8904329, "num_examples": 1991, "dataset_name": "inquisitive_qg"}, "test": {"name": "test", "num_bytes": 7167203, "num_examples": 1894, "dataset_name": "inquisitive_qg"}}, "download_checksums": {"https://github.com/wjko2/INQUISITIVE/raw/master/questions.txt": {"num_bytes": 4769525, "checksum": "3d954e957d6df1dde297682b1c1f8c63ccc0c7cff1dcb9b995a7e054b3dd04ee"}, "https://github.com/wjko2/INQUISITIVE/raw/master/articles.tgz": {"num_bytes": 2316416, "checksum": "c2bf68d391514807b4e982d9983373b943d8295fd61f099784df200266571b2d"}}, "download_size": 7085941, "post_processing_size": null, "dataset_size": 82170764, "size_in_bytes": 89256705}}
|
dummy/plain_text/1.0.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:630c525596f8a5fb16b82c5bd5293aa0e5cdbb736efea091f0461ae84f49dd39
|
3 |
+
size 17335
|
inquisitive_qg.py
ADDED
@@ -0,0 +1,161 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# coding=utf-8
|
2 |
+
# Copyright 2020 HuggingFace Datasets Authors.
|
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 |
+
|
16 |
+
# Lint as: python3
|
17 |
+
"""Inquisitive Question Generation for High Level Text Comprehension"""
|
18 |
+
|
19 |
+
from __future__ import absolute_import, division, print_function
|
20 |
+
|
21 |
+
import itertools
|
22 |
+
import os
|
23 |
+
|
24 |
+
import datasets
|
25 |
+
|
26 |
+
|
27 |
+
_CITATION = """\
|
28 |
+
@InProceedings{ko2020inquisitive,
|
29 |
+
author = {Ko, Wei-Jen and Chen, Te-Yuan and Huang, Yiyan and Durrett, Greg and Li, Junyi Jessy},
|
30 |
+
title = {Inquisitive Question Generation for High Level Text Comprehension},
|
31 |
+
booktitle = {Proceedings of EMNLP},
|
32 |
+
year = {2020},
|
33 |
+
}
|
34 |
+
"""
|
35 |
+
|
36 |
+
_DESCRIPTION = """\
|
37 |
+
A dataset of about 20k questions that are elicited from readers as they naturally read through a document sentence by sentence. \
|
38 |
+
Compared to existing datasets, INQUISITIVE questions target more towards high-level (semantic and discourse) comprehension of text. \
|
39 |
+
Because these questions are generated while the readers are processing the information, the questions directly communicate gaps between \
|
40 |
+
the reader’s and writer’s knowledge about the events described in the text, and are not necessarily answered in the document itself. \
|
41 |
+
This type of question reflects a real-world scenario: if one has questions during reading, some of them are answered by the text later on, \
|
42 |
+
the rest are not, but any of them would help further the reader’s understanding at the particular point when they asked it. \
|
43 |
+
This resource could enable question generation models to simulate human-like curiosity and cognitive processing, which may open up a new realm of applications.
|
44 |
+
"""
|
45 |
+
|
46 |
+
_ARTICLES_URL = "https://github.com/wjko2/INQUISITIVE/raw/master/articles.tgz"
|
47 |
+
_QUESTIONS_URL = "https://github.com/wjko2/INQUISITIVE/raw/master/questions.txt"
|
48 |
+
|
49 |
+
ALL_ARTICLE_IDS = list(range(1, 1501))
|
50 |
+
DEV_ARTICLE_IDS = list(itertools.chain(range(1, 101), range(1051, 1101)))
|
51 |
+
TEST_ARTICLE_IDS = list(itertools.chain(range(101, 151), range(501, 551), range(1101, 1151)))
|
52 |
+
DEV_AND_TEST_IDS = DEV_ARTICLE_IDS + TEST_ARTICLE_IDS
|
53 |
+
TRAIN_ARTICLE_IDS = [id_ for id_ in ALL_ARTICLE_IDS if id_ not in DEV_AND_TEST_IDS]
|
54 |
+
|
55 |
+
|
56 |
+
class InquisitiveQgConfig(datasets.BuilderConfig):
|
57 |
+
"""BuilderConfig for INQUISITIVE."""
|
58 |
+
|
59 |
+
def __init__(self, **kwrags):
|
60 |
+
"""BuilderConfig for INQUISITIVE.
|
61 |
+
|
62 |
+
Args:
|
63 |
+
**kwargs: keyword arguments forwarded to super.
|
64 |
+
"""
|
65 |
+
super(InquisitiveQgConfig, self).__init__(**kwrags)
|
66 |
+
|
67 |
+
|
68 |
+
class InquisitiveQg(datasets.GeneratorBasedBuilder):
|
69 |
+
"""Inquisitive Question Generation for High Level Text Comprehension"""
|
70 |
+
|
71 |
+
VERSION = datasets.Version("1.0.0")
|
72 |
+
BUILDER_CONFIGS = [
|
73 |
+
InquisitiveQgConfig(name="plain_text", version=datasets.Version("1.0.0", ""), description="plain_text"),
|
74 |
+
]
|
75 |
+
|
76 |
+
def _info(self):
|
77 |
+
return datasets.DatasetInfo(
|
78 |
+
description=_DESCRIPTION,
|
79 |
+
features=datasets.Features(
|
80 |
+
{
|
81 |
+
"id": datasets.Value("int32"),
|
82 |
+
"article_id": datasets.Value("int32"),
|
83 |
+
"article": datasets.Value("string"),
|
84 |
+
"sentence_id": datasets.Value("int32"),
|
85 |
+
"sentence": datasets.Value("string"),
|
86 |
+
"span": datasets.Value("string"),
|
87 |
+
"question": datasets.Value("string"),
|
88 |
+
"span_start_position": datasets.Value("int32"),
|
89 |
+
"span_end_position": datasets.Value("int32"),
|
90 |
+
}
|
91 |
+
),
|
92 |
+
supervised_keys=None,
|
93 |
+
homepage="https://github.com/wjko2/INQUISITIVE",
|
94 |
+
citation=_CITATION,
|
95 |
+
)
|
96 |
+
|
97 |
+
def _split_generators(self, dl_manager):
|
98 |
+
questions_file = dl_manager.download(_QUESTIONS_URL)
|
99 |
+
extracted_path = dl_manager.download_and_extract(_ARTICLES_URL)
|
100 |
+
articles_dir = os.path.join(extracted_path, "article")
|
101 |
+
|
102 |
+
return [
|
103 |
+
datasets.SplitGenerator(
|
104 |
+
name=datasets.Split.TRAIN,
|
105 |
+
gen_kwargs={
|
106 |
+
"articles_dir": articles_dir,
|
107 |
+
"questions_file": questions_file,
|
108 |
+
"article_ids": TRAIN_ARTICLE_IDS,
|
109 |
+
},
|
110 |
+
),
|
111 |
+
datasets.SplitGenerator(
|
112 |
+
name=datasets.Split.VALIDATION,
|
113 |
+
gen_kwargs={
|
114 |
+
"articles_dir": articles_dir,
|
115 |
+
"questions_file": questions_file,
|
116 |
+
"article_ids": DEV_ARTICLE_IDS,
|
117 |
+
},
|
118 |
+
),
|
119 |
+
datasets.SplitGenerator(
|
120 |
+
name=datasets.Split.TEST,
|
121 |
+
gen_kwargs={
|
122 |
+
"articles_dir": articles_dir,
|
123 |
+
"questions_file": questions_file,
|
124 |
+
"article_ids": TEST_ARTICLE_IDS,
|
125 |
+
},
|
126 |
+
),
|
127 |
+
]
|
128 |
+
|
129 |
+
def _generate_examples(self, articles_dir, questions_file, article_ids):
|
130 |
+
with open(questions_file, encoding="utf-8") as f:
|
131 |
+
questions_counter = 0
|
132 |
+
rows = f.readlines()
|
133 |
+
for i, row in enumerate(rows):
|
134 |
+
if i == 0:
|
135 |
+
continue # skip header line
|
136 |
+
row = row.strip()
|
137 |
+
cols = row.split("\t")
|
138 |
+
|
139 |
+
article_id = int(cols[0])
|
140 |
+
if article_id not in article_ids:
|
141 |
+
continue
|
142 |
+
|
143 |
+
# read the article file
|
144 |
+
fname = str(article_id).rjust(4, "0") + ".txt"
|
145 |
+
article_path = os.path.join(articles_dir, fname)
|
146 |
+
with open(article_path, encoding="utf-8") as f:
|
147 |
+
article = f.read()
|
148 |
+
|
149 |
+
id_ = str(questions_counter)
|
150 |
+
example = {
|
151 |
+
"article_id": article_id,
|
152 |
+
"sentence_id": int(cols[1]),
|
153 |
+
"sentence": cols[2],
|
154 |
+
"span": cols[3],
|
155 |
+
"question": cols[4],
|
156 |
+
"span_start_position": cols[5],
|
157 |
+
"span_end_position": cols[6],
|
158 |
+
"id": id_,
|
159 |
+
"article": article,
|
160 |
+
}
|
161 |
+
yield id_, example
|