Datasets:

Modalities:
Text
Formats:
parquet
Sub-tasks:
extractive-qa
Languages:
English
ArXiv:
Libraries:
Datasets
pandas
License:
albertvillanova HF staff commited on
Commit
239fef9
1 Parent(s): 81f0ec7

Delete loading script

Browse files
Files changed (1) hide show
  1. ropes.py +0 -138
ropes.py DELETED
@@ -1,138 +0,0 @@
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
- """ROPES dataset.
16
- Code is heavily inspired from https://github.com/huggingface/datasets/blob/master/datasets/squad/squad.py"""
17
-
18
-
19
- import json
20
-
21
- import datasets
22
-
23
-
24
- _CITATION = """\
25
- @inproceedings{Lin2019ReasoningOP,
26
- title={Reasoning Over Paragraph Effects in Situations},
27
- author={Kevin Lin and Oyvind Tafjord and Peter Clark and Matt Gardner},
28
- booktitle={MRQA@EMNLP},
29
- year={2019}
30
- }
31
- """
32
-
33
- _DESCRIPTION = """\
34
- ROPES (Reasoning Over Paragraph Effects in Situations) is a QA dataset
35
- which tests a system's ability to apply knowledge from a passage
36
- of text to a new situation. A system is presented a background
37
- passage containing a causal or qualitative relation(s) (e.g.,
38
- "animal pollinators increase efficiency of fertilization in flowers"),
39
- a novel situation that uses this background, and questions that require
40
- reasoning about effects of the relationships in the background
41
- passage in the background of the situation.
42
- """
43
-
44
- _LICENSE = "CC BY 4.0"
45
-
46
- _URLs = {
47
- "train+dev": "https://ropes-dataset.s3-us-west-2.amazonaws.com/train_and_dev/ropes-train-dev-v1.0.tar.gz",
48
- "test": "https://ropes-dataset.s3-us-west-2.amazonaws.com/test/ropes-test-questions-v1.0.tar.gz",
49
- }
50
-
51
-
52
- class Ropes(datasets.GeneratorBasedBuilder):
53
- """ROPES datset: testing a system's ability
54
- to apply knowledge from a passage of text to a new situation.."""
55
-
56
- VERSION = datasets.Version("1.1.0")
57
-
58
- BUILDER_CONFIGS = [
59
- datasets.BuilderConfig(name="plain_text", description="Plain text", version=VERSION),
60
- ]
61
-
62
- def _info(self):
63
- return datasets.DatasetInfo(
64
- description=_DESCRIPTION,
65
- features=datasets.Features(
66
- {
67
- "id": datasets.Value("string"),
68
- "background": datasets.Value("string"),
69
- "situation": datasets.Value("string"),
70
- "question": datasets.Value("string"),
71
- "answers": datasets.features.Sequence(
72
- {
73
- "text": datasets.Value("string"),
74
- }
75
- ),
76
- }
77
- ),
78
- supervised_keys=None,
79
- homepage="https://allenai.org/data/ropes",
80
- license=_LICENSE,
81
- citation=_CITATION,
82
- )
83
-
84
- def _split_generators(self, dl_manager):
85
- """Returns SplitGenerators."""
86
- archives = dl_manager.download(_URLs)
87
-
88
- return [
89
- datasets.SplitGenerator(
90
- name=datasets.Split.TRAIN,
91
- gen_kwargs={
92
- "filepath": "/".join(["ropes-train-dev-v1.0", "train-v1.0.json"]),
93
- "split": "train",
94
- "files": dl_manager.iter_archive(archives["train+dev"]),
95
- },
96
- ),
97
- datasets.SplitGenerator(
98
- name=datasets.Split.TEST,
99
- gen_kwargs={
100
- "filepath": "/".join(["ropes-test-questions-v1.0", "test-1.0.json"]),
101
- "split": "test",
102
- "files": dl_manager.iter_archive(archives["test"]),
103
- },
104
- ),
105
- datasets.SplitGenerator(
106
- name=datasets.Split.VALIDATION,
107
- gen_kwargs={
108
- "filepath": "/".join(["ropes-train-dev-v1.0", "dev-v1.0.json"]),
109
- "split": "dev",
110
- "files": dl_manager.iter_archive(archives["train+dev"]),
111
- },
112
- ),
113
- ]
114
-
115
- def _generate_examples(self, filepath, split, files):
116
- """Yields examples."""
117
- for path, f in files:
118
- if path == filepath:
119
- ropes = json.loads(f.read().decode("utf-8"))
120
- for article in ropes["data"]:
121
- for paragraph in article["paragraphs"]:
122
- background = paragraph["background"].strip()
123
- situation = paragraph["situation"].strip()
124
- for qa in paragraph["qas"]:
125
- question = qa["question"].strip()
126
- id_ = qa["id"]
127
- answers = [] if split == "test" else [answer["text"].strip() for answer in qa["answers"]]
128
-
129
- yield id_, {
130
- "background": background,
131
- "situation": situation,
132
- "question": question,
133
- "id": id_,
134
- "answers": {
135
- "text": answers,
136
- },
137
- }
138
- break