Datasets:

ArXiv:
License:
soongfs drt commited on
Commit
9afa7c8
·
0 Parent(s):

Duplicate from drt/complex_web_questions

Browse files

Co-authored-by: Yuanchun <drt@users.noreply.huggingface.co>

Files changed (3) hide show
  1. .gitattributes +53 -0
  2. README.md +101 -0
  3. complex_web_questions.py +144 -0
.gitattributes ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ftz filter=lfs diff=lfs merge=lfs -text
6
+ *.gz filter=lfs diff=lfs merge=lfs -text
7
+ *.h5 filter=lfs diff=lfs merge=lfs -text
8
+ *.joblib filter=lfs diff=lfs merge=lfs -text
9
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
10
+ *.lz4 filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tflite filter=lfs diff=lfs merge=lfs -text
29
+ *.tgz filter=lfs diff=lfs merge=lfs -text
30
+ *.wasm filter=lfs diff=lfs merge=lfs -text
31
+ *.xz filter=lfs diff=lfs merge=lfs -text
32
+ *.zip filter=lfs diff=lfs merge=lfs -text
33
+ *.zst filter=lfs diff=lfs merge=lfs -text
34
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
35
+ # Audio files - uncompressed
36
+ *.pcm filter=lfs diff=lfs merge=lfs -text
37
+ *.sam filter=lfs diff=lfs merge=lfs -text
38
+ *.raw filter=lfs diff=lfs merge=lfs -text
39
+ # Audio files - compressed
40
+ *.aac filter=lfs diff=lfs merge=lfs -text
41
+ *.flac filter=lfs diff=lfs merge=lfs -text
42
+ *.mp3 filter=lfs diff=lfs merge=lfs -text
43
+ *.ogg filter=lfs diff=lfs merge=lfs -text
44
+ *.wav filter=lfs diff=lfs merge=lfs -text
45
+ # Image files - uncompressed
46
+ *.bmp filter=lfs diff=lfs merge=lfs -text
47
+ *.gif filter=lfs diff=lfs merge=lfs -text
48
+ *.png filter=lfs diff=lfs merge=lfs -text
49
+ *.tiff filter=lfs diff=lfs merge=lfs -text
50
+ # Image files - compressed
51
+ *.jpg filter=lfs diff=lfs merge=lfs -text
52
+ *.jpeg filter=lfs diff=lfs merge=lfs -text
53
+ *.webp filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ source: https://github.com/KGQA/KGQA-datasets
4
+ ---
5
+
6
+ # Dataset Card for Dataset Name
7
+
8
+ ## Dataset Description
9
+
10
+ - **Homepage:** https://www.tau-nlp.sites.tau.ac.il/compwebq
11
+ - **Repository:** https://github.com/alontalmor/WebAsKB
12
+ - **Paper:** https://arxiv.org/abs/1803.06643
13
+ - **Leaderboard:** https://www.tau-nlp.sites.tau.ac.il/compwebq-leaderboard
14
+ - **Point of Contact:** alontalmor@mail.tau.ac.il.
15
+
16
+ ### Dataset Summary
17
+
18
+ **A dataset for answering complex questions that require reasoning over multiple web snippets**
19
+
20
+ ComplexWebQuestions is a new dataset that contains a large set of complex questions in natural language, and can be used in multiple ways:
21
+
22
+ - By interacting with a search engine, which is the focus of our paper (Talmor and Berant, 2018);
23
+ - As a reading comprehension task: we release 12,725,989 web snippets that are relevant for the questions, and were collected during the development of our model;
24
+ - As a semantic parsing task: each question is paired with a SPARQL query that can be executed against Freebase to retrieve the answer.
25
+
26
+ ### Supported Tasks and Leaderboards
27
+
28
+ [More Information Needed]
29
+
30
+ ### Languages
31
+
32
+ - English
33
+
34
+ ## Dataset Structure
35
+
36
+ QUESTION FILES
37
+
38
+ The dataset contains 34,689 examples divided into 27,734 train, 3,480 dev, 3,475 test.
39
+ each containing:
40
+
41
+ ```
42
+ "ID”: The unique ID of the example;
43
+ "webqsp_ID": The original WebQuestionsSP ID from which the question was constructed;
44
+ "webqsp_question": The WebQuestionsSP Question from which the question was constructed;
45
+ "machine_question": The artificial complex question, before paraphrasing;
46
+ "question": The natural language complex question;
47
+ "sparql": Freebase SPARQL query for the question. Note that the SPARQL was constructed for the machine question, the actual question after paraphrasing
48
+ may differ from the SPARQL.
49
+ "compositionality_type": An estimation of the type of compositionally. {composition, conjunction, comparative, superlative}. The estimation has not been manually verified,
50
+ the question after paraphrasing may differ from this estimation.
51
+ "answers": a list of answers each containing answer: the actual answer; answer_id: the Freebase answer id; aliases: freebase extracted aliases for the answer.
52
+ "created": creation time
53
+ ```
54
+
55
+ NOTE: test set does not contain “answer” field. For test evaluation please send email to
56
+ alontalmor@mail.tau.ac.il.
57
+
58
+
59
+ WEB SNIPPET FILES
60
+
61
+
62
+ The snippets files consist of 12,725,989 snippets each containing
63
+ PLEASE DON”T USE CHROME WHEN DOWNLOADING THESE FROM DROPBOX (THE UNZIP COULD FAIL)
64
+
65
+ "question_ID”: the ID of related question, containing at least 3 instances of the same ID (full question, split1, split2);
66
+ "question": The natural language complex question;
67
+ "web_query": Query sent to the search engine.
68
+ “split_source”: 'noisy supervision split' or ‘ptrnet split’, please train on examples containing “ptrnet split” when comparing to Split+Decomp from https://arxiv.org/abs/1807.09623
69
+ “split_type”: 'full_question' or ‘split_part1' or ‘split_part2’ please use ‘composition_answer’ in question of type composition and split_type: “split_part1” when training a reading comprehension model on splits as in Split+Decomp from https://arxiv.org/abs/1807.09623 (in the rest of the cases use the original answer).
70
+ "web_snippets": ~100 web snippets per query. Each snippet includes Title,Snippet. They are ordered according to Google results.
71
+
72
+ With a total of
73
+ 10,035,571 training set snippets
74
+ 1,350,950 dev set snippets
75
+ 1,339,468 test set snippets
76
+
77
+
78
+ ### Source Data
79
+
80
+ The original files can be found at this [dropbox link](https://www.dropbox.com/sh/7pkwkrfnwqhsnpo/AACuu4v3YNkhirzBOeeaHYala)
81
+
82
+
83
+ ### Licensing Information
84
+
85
+ Not specified
86
+
87
+ ### Citation Information
88
+
89
+ ```
90
+ @inproceedings{talmor2018web,
91
+ title={The Web as a Knowledge-Base for Answering Complex Questions},
92
+ author={Talmor, Alon and Berant, Jonathan},
93
+ booktitle={Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers)},
94
+ pages={641--651},
95
+ year={2018}
96
+ }
97
+ ```
98
+
99
+ ### Contributions
100
+
101
+ Thanks for [yuancu](https://github.com/yuancu) for contributing this dataset.
complex_web_questions.py ADDED
@@ -0,0 +1,144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """ComplexWebQuestions: A Dataset for Answering Complex Questions that Require Reasoning over Multiple Web Snippets."""
2
+
3
+ import json
4
+ import os
5
+
6
+ import datasets
7
+
8
+ logger = datasets.logging.get_logger(__name__)
9
+
10
+ _CITATION = """\
11
+ @inproceedings{Talmor2018TheWA,
12
+ title={The Web as a Knowledge-Base for Answering Complex Questions},
13
+ author={Alon Talmor and Jonathan Berant},
14
+ booktitle={NAACL},
15
+ year={2018}
16
+ }
17
+ """
18
+
19
+ _DESCRIPTION = """\
20
+ ComplexWebQuestions is a dataset for answering complex questions that require reasoning over multiple web snippets. It contains a large set of complex questions in natural language, and can be used in multiple ways: 1) By interacting with a search engine, which is the focus of our paper (Talmor and Berant, 2018); 2) As a reading comprehension task: we release 12,725,989 web snippets that are relevant for the questions, and were collected during the development of our model; 3) As a semantic parsing task: each question is paired with a SPARQL query that can be executed against Freebase to retrieve the answer.
21
+ """
22
+
23
+ _URL = "https://allenai.org/data/complexwebquestions"
24
+ _COMPLEXWEBQUESTIONS_URLS = {
25
+ "train": "https://www.dropbox.com/sh/7pkwkrfnwqhsnpo/AAAIHeWX0cPpbpwK6w06BCxva/ComplexWebQuestions_train.json?dl=1",
26
+ "dev": "https://www.dropbox.com/sh/7pkwkrfnwqhsnpo/AADH8beLbOUWxwvY_K38E3ADa/ComplexWebQuestions_dev.json?dl=1",
27
+ "test": "https://www.dropbox.com/sh/7pkwkrfnwqhsnpo/AABr4ysSy_Tg8Wfxww4i_UWda/ComplexWebQuestions_test.json?dl=1"
28
+ }
29
+
30
+ class ComplexWebQuestionsConfig(datasets.BuilderConfig):
31
+ """BuilderConfig for ComplexWebQuestions"""
32
+ def __init__(self,
33
+ data_url,
34
+ data_dir,
35
+ **kwargs):
36
+ """BuilderConfig for ComplexWebQuestions.
37
+ Args:
38
+ **kwargs: keyword arguments forwarded to super.
39
+ """
40
+ super(ComplexWebQuestionsConfig, self).__init__(**kwargs)
41
+ self.data_url = data_url
42
+ self.data_dir = data_dir
43
+
44
+ class ComplexWebQuestions(datasets.GeneratorBasedBuilder):
45
+ """ComplexWebQuestions: A Dataset for Answering Complex Questions that Require Reasoning over Multiple Web Snippets."""
46
+ BUILDER_CONFIGS = [
47
+ ComplexWebQuestionsConfig(
48
+ name="complex_web_questions",
49
+ description="ComplexWebQuestions",
50
+ data_url="",
51
+ data_dir="ComplexWebQuestions"
52
+ ),
53
+ ComplexWebQuestionsConfig(
54
+ name="complexwebquestions_test",
55
+ description="ComplexWebQuestions",
56
+ data_url="",
57
+ data_dir="ComplexWebQuestions"
58
+ )
59
+ ]
60
+
61
+ def _info(self):
62
+ features = datasets.Features(
63
+ {
64
+ "ID": datasets.Value("string"),
65
+ "answers": datasets.features.Sequence(
66
+ datasets.Features(
67
+ {
68
+ "aliases": datasets.features.Sequence(
69
+ datasets.Value("string")
70
+ ),
71
+ "answer": datasets.Value("string"),
72
+ "answer_id": datasets.Value("string")
73
+ }
74
+ )
75
+ ),
76
+ "composition_answer": datasets.Value("string"),
77
+ "compositionality_type": datasets.Value("string"),
78
+ "created": datasets.Value("string"),
79
+ "machine_question": datasets.Value("string"),
80
+ "question": datasets.Value("string"),
81
+ "sparql": datasets.Value("string"),
82
+ "webqsp_ID": datasets.Value("string"),
83
+ "webqsp_question": datasets.Value("string")
84
+ }
85
+ )
86
+
87
+ if self.config.name == "complexwebquestions_test":
88
+ features.pop("answers", None)
89
+ features.pop("composition_answer", None)
90
+
91
+ return datasets.DatasetInfo(
92
+ description=_DESCRIPTION,
93
+ supervised_keys=None,
94
+ homepage=_URL,
95
+ citation=_CITATION,
96
+ features=features
97
+ )
98
+
99
+ def _split_generators(self, dl_manager):
100
+ data_dir = None
101
+ if self.config.name == "complexwebquestions_test":
102
+ complexwebquestions_test_files = dl_manager.download(
103
+ {
104
+ "test": _COMPLEXWEBQUESTIONS_URLS["test"],
105
+ }
106
+ )
107
+ return [
108
+ datasets.SplitGenerator(
109
+ name=datasets.Split.TEST,
110
+ gen_kwargs={
111
+ "data_file": os.path.join(data_dir or "", complexwebquestions_test_files["test"]),
112
+ "split": "test"
113
+ }
114
+ )
115
+ ]
116
+ else:
117
+ complexwebquestions_files = dl_manager.download(
118
+ {
119
+ "train": _COMPLEXWEBQUESTIONS_URLS["train"],
120
+ "dev": _COMPLEXWEBQUESTIONS_URLS["dev"]
121
+ }
122
+ )
123
+ return [
124
+ datasets.SplitGenerator(
125
+ name=datasets.Split.TRAIN,
126
+ gen_kwargs={
127
+ "data_file": os.path.join(data_dir or "", complexwebquestions_files["train"]),
128
+ "split": "train"
129
+ }
130
+ ),
131
+ datasets.SplitGenerator(
132
+ name=datasets.Split.VALIDATION,
133
+ gen_kwargs={
134
+ "data_file": os.path.join(data_dir or "", complexwebquestions_files["dev"]),
135
+ "split": "validation"
136
+ }
137
+ )
138
+ ]
139
+
140
+ def _generate_examples(self, data_file, **kwargs):
141
+ with open(data_file, encoding="utf8") as f:
142
+ complexwebquestions = json.load(f)
143
+ for idx, question in enumerate(complexwebquestions):
144
+ yield idx, question