Datasets:
Tasks:
Other
Modalities:
Text
Languages:
English
Size:
10K - 100K
ArXiv:
Tags:
question-generation
License:
WorkInTheDark
commited on
Commit
•
4cbdb9b
1
Parent(s):
c3dbf09
upload
Browse files- dataset_infos.json +1 -0
- fairytaleqa.py +31 -11
- test.json +3 -0
- train.json +3 -0
- valid.json +3 -0
dataset_infos.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"default": {"description": "The FairytaleQA dataset focusing on narrative comprehension of kindergarten to eighth-grade students. Generated by educational experts based on an evidence-based theoretical framework, FairytaleQA consists of 10,580 explicit and implicit questions derived from 278 children-friendly stories, covering seven types of narrative elements or relations. This is for the Question Generation Task of FairytaleQA.\n", "citation": "@inproceedings{xu2022fairytaleqa,\n author={Xu, Ying and Wang, Dakuo and Yu, Mo and Ritchie, Daniel and Yao, Bingsheng and Wu, Tongshuang and Zhang, Zheng and Li, Toby Jia-Jun and Bradford, Nora and Sun, Branda and Hoang, Tran Bao and Sang, Yisi and Hou, Yufang and Ma, Xiaojuan and Yang, Diyi and Peng, Nanyun and Yu, Zhou and Warschauer, Mark},\n title = {Fantastic Questions and Where to Find Them: Fairytale{QA} -- An Authentic Dataset for Narrative Comprehension},\n publisher = {Association for Computational Linguistics},\n year = {2022}\n}\n", "homepage": "https://github.com/uci-soe/FairytaleQAData", "license": "", "features": {"story_name": {"dtype": "string", "id": null, "_type": "Value"}, "content": {"dtype": "string", "id": null, "_type": "Value"}, "answer": {"dtype": "string", "id": null, "_type": "Value"}, "gem_id": {"dtype": "string", "id": null, "_type": "Value"}, "target": {"dtype": "string", "id": null, "_type": "Value"}, "references": [{"dtype": "string", "id": null, "_type": "Value"}], "local_or_sum": {"dtype": "string", "id": null, "_type": "Value"}, "attribute": {"dtype": "string", "id": null, "_type": "Value"}, "ex_or_im": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "fairytale_qa", "config_name": "default", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 10644996, "num_examples": 8548, "dataset_name": "fairytale_qa"}, "validation": {"name": "validation", "num_bytes": 1266906, "num_examples": 1025, "dataset_name": "fairytale_qa"}, "test": {"name": "test", "num_bytes": 1230405, "num_examples": 1007, "dataset_name": "fairytale_qa"}}, "download_checksums": {"train.json": {"num_bytes": 11603740, "checksum": "0fa291ddf323a73f5210d5c48c56ed8aa348d9a1ba8d9917c4fc2d72b484cc30"}, "valid.json": {"num_bytes": 1314327, "checksum": "963d2115e4fecddb9572cc18d0a2c82d483e6ab565e4835b5b5ed51eb6cabd0e"}, "test.json": {"num_bytes": 1285095, "checksum": "dd1e663069786ebd24f5325aadd00bab73a289692c8375488281c5a7d6d555c6"}}, "download_size": 14203162, "post_processing_size": null, "dataset_size": 13142307, "size_in_bytes": 27345469}}
|
fairytaleqa.py
CHANGED
@@ -155,21 +155,41 @@ class FairytaleQA(datasets.GeneratorBasedBuilder):
|
|
155 |
|
156 |
with open(filepath, encoding="utf-8") as f:
|
157 |
|
158 |
-
|
159 |
|
160 |
-
|
161 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
162 |
yield id_, {
|
163 |
-
"story_name":
|
164 |
-
"content":
|
165 |
-
"answer":
|
166 |
"gem_id": f"GEM-FairytaleQA-{split}-{id_}",
|
167 |
-
"target":
|
168 |
-
"references": [] if split == "train" else [
|
169 |
-
"local_or_sum":
|
170 |
-
"attribute":
|
171 |
-
"ex_or_im":
|
172 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
173 |
|
174 |
|
175 |
|
|
|
155 |
|
156 |
with open(filepath, encoding="utf-8") as f:
|
157 |
|
158 |
+
json_data = json.load(f)
|
159 |
|
160 |
+
|
161 |
+
for id_, row in enumerate(json_data["data"]):
|
162 |
+
story_name = row['story_name']
|
163 |
+
content = row['content']
|
164 |
+
answer = row['answer']
|
165 |
+
question = row['question']
|
166 |
+
local_or_sum = row['local_or_sum']
|
167 |
+
attribute = row['attribute']
|
168 |
+
ex_or_im = row['ex_or_im']
|
169 |
+
# data = json.loads(row)
|
170 |
+
|
171 |
yield id_, {
|
172 |
+
"story_name": story_name,
|
173 |
+
"content": content,
|
174 |
+
"answer": answer,
|
175 |
"gem_id": f"GEM-FairytaleQA-{split}-{id_}",
|
176 |
+
"target": question,
|
177 |
+
"references": [] if split == "train" else [ question ],
|
178 |
+
"local_or_sum": local_or_sum,
|
179 |
+
"attribute": attribute,
|
180 |
+
"ex_or_im": ex_or_im
|
181 |
}
|
182 |
+
# yield id_, {
|
183 |
+
# "story_name": data['story_name'],
|
184 |
+
# "content": data['content'],
|
185 |
+
# "answer": data['answer'],
|
186 |
+
# "gem_id": f"GEM-FairytaleQA-{split}-{id_}",
|
187 |
+
# "target": data['question'],
|
188 |
+
# "references": [] if split == "train" else [ data['question'] ],
|
189 |
+
# "local_or_sum": data['local_or_sum'],
|
190 |
+
# "attribute": data['attribute'],
|
191 |
+
# "ex_or_im": data['ex_or_im']
|
192 |
+
# }
|
193 |
|
194 |
|
195 |
|
test.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:dd1e663069786ebd24f5325aadd00bab73a289692c8375488281c5a7d6d555c6
|
3 |
+
size 1285095
|
train.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0fa291ddf323a73f5210d5c48c56ed8aa348d9a1ba8d9917c4fc2d72b484cc30
|
3 |
+
size 11603740
|
valid.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:963d2115e4fecddb9572cc18d0a2c82d483e6ab565e4835b5b5ed51eb6cabd0e
|
3 |
+
size 1314327
|