Datasets:

Modalities:
Text
Formats:
parquet
Languages:
English
ArXiv:
Libraries:
Datasets
pandas
License:
albertvillanova HF staff commited on
Commit
a202432
1 Parent(s): 788845f

Delete loading script

Browse files
Files changed (1) hide show
  1. ambig_qa.py +0 -150
ambig_qa.py DELETED
@@ -1,150 +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
-
16
- """AmbigQA: Answering Ambiguous Open-domain Questions"""
17
-
18
-
19
- import json
20
- import os
21
-
22
- import datasets
23
-
24
-
25
- _CITATION = """\
26
- @inproceedings{ min2020ambigqa,
27
- title={ {A}mbig{QA}: Answering Ambiguous Open-domain Questions },
28
- author={ Min, Sewon and Michael, Julian and Hajishirzi, Hannaneh and Zettlemoyer, Luke },
29
- booktitle={ EMNLP },
30
- year={2020}
31
- }
32
- """
33
-
34
- _DESCRIPTION = """\
35
- AmbigNQ, a dataset covering 14,042 questions from NQ-open, an existing open-domain QA benchmark. We find that over half of the questions in NQ-open are ambiguous. The types of ambiguity are diverse and sometimes subtle, many of which are only apparent after examining evidence provided by a very large text corpus. AMBIGNQ, a dataset with
36
- 14,042 annotations on NQ-OPEN questions containing diverse types of ambiguity.
37
- We provide two distributions of our new dataset AmbigNQ: a full version with all annotation metadata and a light version with only inputs and outputs.
38
- """
39
- _HOMEPAGE = "https://nlp.cs.washington.edu/ambigqa/"
40
- _LICENSE = "CC BY-SA 3.0"
41
-
42
- _URL = "https://nlp.cs.washington.edu/ambigqa/data/"
43
- _URLS = {
44
- "light": _URL + "ambignq_light.zip",
45
- "full": _URL + "ambignq.zip",
46
- }
47
-
48
-
49
- class AmbigQa(datasets.GeneratorBasedBuilder):
50
- """AmbigQA dataset"""
51
-
52
- VERSION = datasets.Version("1.0.0")
53
- BUILDER_CONFIGS = [
54
- datasets.BuilderConfig(
55
- name="light",
56
- version=VERSION,
57
- description="AmbigNQ light version with only inputs and outputs",
58
- ),
59
- datasets.BuilderConfig(
60
- name="full",
61
- version=VERSION,
62
- description="AmbigNQ full version with all annotation metadata",
63
- ),
64
- ]
65
- DEFAULT_CONFIG_NAME = "full"
66
-
67
- def _info(self):
68
- features_dict = {
69
- "id": datasets.Value("string"),
70
- "question": datasets.Value("string"),
71
- "annotations": datasets.features.Sequence(
72
- {
73
- "type": datasets.Value("string"), # datasets.ClassLabel(names = ["singleAnswer","multipleQAs"])
74
- "answer": datasets.features.Sequence(datasets.Value("string")),
75
- "qaPairs": datasets.features.Sequence(
76
- {
77
- "question": datasets.Value("string"),
78
- "answer": datasets.features.Sequence(datasets.Value("string")),
79
- }
80
- ),
81
- }
82
- ),
83
- }
84
- if self.config.name == "full":
85
-
86
- detail_features = {
87
- "viewed_doc_titles": datasets.features.Sequence(datasets.Value("string")),
88
- "used_queries": datasets.features.Sequence(
89
- {
90
- "query": datasets.Value("string"),
91
- "results": datasets.features.Sequence(
92
- {
93
- "title": datasets.Value("string"),
94
- "snippet": datasets.Value("string"),
95
- }
96
- ),
97
- }
98
- ),
99
- "nq_answer": datasets.features.Sequence(datasets.Value("string")),
100
- "nq_doc_title": datasets.Value("string"),
101
- }
102
- features_dict.update(detail_features)
103
-
104
- features = datasets.Features(features_dict)
105
-
106
- return datasets.DatasetInfo(
107
- description=_DESCRIPTION,
108
- features=features,
109
- supervised_keys=None,
110
- homepage=_HOMEPAGE,
111
- license=_LICENSE,
112
- citation=_CITATION,
113
- )
114
-
115
- def _split_generators(self, dl_manager):
116
- """Returns SplitGenerators."""
117
- # download and extract URLs
118
- urls_to_download = _URLS
119
- downloaded_files = dl_manager.download_and_extract(urls_to_download)
120
-
121
- train_file_name = "train.json" if self.config.name == "full" else "train_light.json"
122
- dev_file_name = "dev.json" if self.config.name == "full" else "dev_light.json"
123
-
124
- return [
125
- datasets.SplitGenerator(
126
- name=datasets.Split.TRAIN,
127
- gen_kwargs={"filepath": os.path.join(downloaded_files[self.config.name], train_file_name)},
128
- ),
129
- datasets.SplitGenerator(
130
- name=datasets.Split.VALIDATION,
131
- gen_kwargs={"filepath": os.path.join(downloaded_files[self.config.name], dev_file_name)},
132
- ),
133
- ]
134
-
135
- def _generate_examples(self, filepath):
136
- """Yields examples."""
137
-
138
- with open(filepath, encoding="utf-8") as f:
139
- data = json.load(f)
140
- for example in data:
141
- id_ = example["id"]
142
- annotations = example["annotations"]
143
- # Add this because we cannot have None values (all keys in the schema should be present)
144
- for an in annotations:
145
- if "qaPairs" not in an:
146
- an["qaPairs"] = []
147
- if "answer" not in an:
148
- an["answer"] = []
149
-
150
- yield id_, example