Datasets:

Modalities:
Text
Languages:
English
ArXiv:
Libraries:
Datasets
License:
davzoku commited on
Commit
eeb00d8
1 Parent(s): 35ded0c

Delete loading script

Browse files
Files changed (1) hide show
  1. qasper.py +0 -152
qasper.py DELETED
@@ -1,152 +0,0 @@
1
- # coding=utf-8
2
- # Copyright 2022 The TensorFlow Datasets Authors and the 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
- """Qasper: A Dataset of Information-Seeking Questions and Answers Anchored in Research Papers."""
18
-
19
-
20
- import json
21
-
22
- import datasets
23
-
24
-
25
- logger = datasets.logging.get_logger(__name__)
26
-
27
-
28
- _CITATION = """\
29
- @inproceedings{Dasigi2021ADO,
30
- title={A Dataset of Information-Seeking Questions and Answers Anchored in Research Papers},
31
- author={Pradeep Dasigi and Kyle Lo and Iz Beltagy and Arman Cohan and Noah A. Smith and Matt Gardner},
32
- year={2021}
33
- }
34
- """
35
- _LICENSE = "CC BY 4.0"
36
- _DESCRIPTION = """\
37
- A dataset containing 1585 papers with 5049 information-seeking questions asked by regular readers of NLP papers, and answered by a separate set of NLP practitioners.
38
- """
39
-
40
- _HOMEPAGE = "https://allenai.org/data/qasper"
41
- _URL_TRAIN_DEV = "https://qasper-dataset.s3.us-west-2.amazonaws.com/qasper-train-dev-v0.3.tgz"
42
- _URL_TEST = "https://qasper-dataset.s3.us-west-2.amazonaws.com/qasper-test-and-evaluator-v0.3.tgz"
43
- _DATA_FILES = {"train": "qasper-train-v0.3.json",
44
- "dev": "qasper-dev-v0.3.json",
45
- "test": "qasper-test-v0.3.json"}
46
-
47
- _VERSION = "0.3.0"
48
-
49
-
50
- class Qasper(datasets.GeneratorBasedBuilder):
51
- """Qasper: A Dataset of Information-Seeking Q&A Anchored in Research Papers."""
52
-
53
- BUILDER_CONFIGS = [
54
- datasets.BuilderConfig(
55
- name="qasper",
56
- version=datasets.Version(_VERSION),
57
- description=_DESCRIPTION,
58
- )
59
- ]
60
-
61
- def _info(self):
62
-
63
- features = datasets.Features(
64
- {
65
- "id": datasets.Value("string"),
66
- "title": datasets.Value("string"),
67
- "abstract": datasets.Value("string"),
68
- "full_text": datasets.features.Sequence(
69
- {
70
- "section_name": datasets.Value("string"),
71
- "paragraphs": [datasets.Value("string")],
72
- }
73
- ),
74
- "qas": datasets.features.Sequence(
75
- {
76
- "question": datasets.Value("string"),
77
- "question_id": datasets.Value("string"),
78
- "nlp_background": datasets.Value("string"),
79
- "topic_background": datasets.Value("string"),
80
- "paper_read": datasets.Value("string"),
81
- "search_query": datasets.Value("string"),
82
- "question_writer": datasets.Value("string"),
83
- "answers": datasets.features.Sequence(
84
- {
85
- "answer": {
86
- "unanswerable": datasets.Value("bool"),
87
- "extractive_spans": datasets.features.Sequence(datasets.Value("string")),
88
- "yes_no": datasets.Value("bool"),
89
- "free_form_answer": datasets.Value("string"),
90
- "evidence": datasets.features.Sequence(datasets.Value("string")),
91
- "highlighted_evidence": datasets.features.Sequence(datasets.Value("string")),
92
- },
93
- "annotation_id": datasets.Value("string"),
94
- "worker_id": datasets.Value("string"),
95
- }
96
- ),
97
- }
98
- ),
99
- "figures_and_tables": datasets.features.Sequence(
100
- {
101
- "caption": datasets.Value("string"),
102
- "file": datasets.Value("string"),
103
- }
104
- ),
105
- }
106
- )
107
-
108
- return datasets.DatasetInfo(
109
- description=_DESCRIPTION,
110
- features=features,
111
- supervised_keys=None,
112
- homepage=_HOMEPAGE,
113
- license=_LICENSE,
114
- citation=_CITATION,
115
- )
116
-
117
- def _split_generators(self, dl_manager):
118
- archive_train_dev, archive_test = dl_manager.download((
119
- _URL_TRAIN_DEV, _URL_TEST)
120
- )
121
-
122
- return [
123
- datasets.SplitGenerator(
124
- name=datasets.Split.TRAIN,
125
- gen_kwargs={
126
- "filepath": _DATA_FILES["train"],
127
- "files": dl_manager.iter_archive(archive_train_dev)},
128
- ),
129
- datasets.SplitGenerator(
130
- name=datasets.Split.VALIDATION,
131
- gen_kwargs={
132
- "filepath": _DATA_FILES["dev"],
133
- "files": dl_manager.iter_archive(archive_train_dev)},
134
- ),
135
- datasets.SplitGenerator(
136
- name=datasets.Split.TEST,
137
- gen_kwargs={
138
- "filepath": _DATA_FILES["test"],
139
- "files": dl_manager.iter_archive(archive_test)},
140
- ),
141
- ]
142
-
143
- def _generate_examples(self, filepath, files):
144
- """This function returns the examples in the raw (text) form."""
145
- logger.info("generating examples from = %s", filepath)
146
- for path, f in files:
147
- if path == filepath:
148
- qasper = json.loads(f.read().decode("utf-8"))
149
- for id_ in qasper:
150
- qasper[id_]["id"] = id_
151
- yield id_, qasper[id_]
152
- break