Datasets:

Modalities:
Text
Formats:
parquet
Languages:
English
Libraries:
Datasets
pandas
License:
albertvillanova HF staff commited on
Commit
d5f9617
1 Parent(s): 85df600

Delete loading script

Browse files
Files changed (1) hide show
  1. web_questions.py +0 -98
web_questions.py DELETED
@@ -1,98 +0,0 @@
1
- # coding=utf-8
2
- # Copyright 2020 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
- """WebQuestions Benchmark for Question Answering."""
18
-
19
-
20
- import json
21
- import re
22
-
23
- import datasets
24
-
25
-
26
- _CITATION = """
27
- @inproceedings{berant-etal-2013-semantic,
28
- title = "Semantic Parsing on {F}reebase from Question-Answer Pairs",
29
- author = "Berant, Jonathan and
30
- Chou, Andrew and
31
- Frostig, Roy and
32
- Liang, Percy",
33
- booktitle = "Proceedings of the 2013 Conference on Empirical Methods in Natural Language Processing",
34
- month = oct,
35
- year = "2013",
36
- address = "Seattle, Washington, USA",
37
- publisher = "Association for Computational Linguistics",
38
- url = "https://www.aclweb.org/anthology/D13-1160",
39
- pages = "1533--1544",
40
- }
41
- """
42
- _SPLIT_DOWNLOAD_URL = {
43
- "train": "https://worksheets.codalab.org/rest/bundles/0x4a763f8cde224c2da592b75f29e2f5c2/contents/blob/",
44
- "test": "https://worksheets.codalab.org/rest/bundles/0xe7bac352fce7448c9ef238fb0a297ec2/contents/blob/",
45
- }
46
-
47
- _DESCRIPTION = """\
48
- This dataset consists of 6,642 question/answer pairs.
49
- The questions are supposed to be answerable by Freebase, a large knowledge graph.
50
- The questions are mostly centered around a single named entity.
51
- The questions are popular ones asked on the web (at least in 2013).
52
- """
53
-
54
-
55
- class WebQuestions(datasets.GeneratorBasedBuilder):
56
- """WebQuestions Benchmark for Question Answering."""
57
-
58
- VERSION = datasets.Version("1.0.0")
59
-
60
- def _info(self):
61
- return datasets.DatasetInfo(
62
- description=_DESCRIPTION,
63
- features=datasets.Features(
64
- {
65
- "url": datasets.Value("string"),
66
- "question": datasets.Value("string"),
67
- "answers": datasets.features.Sequence(datasets.Value("string")),
68
- }
69
- ),
70
- supervised_keys=None,
71
- homepage="https://worksheets.codalab.org/worksheets/0xba659fe363cb46e7a505c5b6a774dc8a",
72
- citation=_CITATION,
73
- )
74
-
75
- def _split_generators(self, dl_manager):
76
- """Returns SplitGenerators."""
77
- file_paths = dl_manager.download(_SPLIT_DOWNLOAD_URL)
78
-
79
- return [
80
- datasets.SplitGenerator(name=split, gen_kwargs={"file_path": file_path})
81
- for split, file_path in file_paths.items()
82
- ]
83
-
84
- def _generate_examples(self, file_path):
85
- """Parses split file and yields examples."""
86
-
87
- def _target_to_answers(target):
88
- target = re.sub(r"^\(list |\)$", "", target)
89
- return ["".join(ans) for ans in re.findall(r'\(description (?:"([^"]+?)"|([^)]+?))\)\w*', target)]
90
-
91
- with open(file_path, encoding="utf-8") as f:
92
- examples = json.load(f)
93
- for i, ex in enumerate(examples):
94
- yield i, {
95
- "url": ex["url"],
96
- "question": ex["utterance"],
97
- "answers": _target_to_answers(ex["targetValue"]),
98
- }