Skip to content

Commit a96772e

Browse files
mariamabarhamjplu
authored andcommitted
add DoQA dataset (ACL 2020)
1 parent ee4b5a0 commit a96772e

File tree

5 files changed

+185
-0
lines changed

5 files changed

+185
-0
lines changed

datasets/doqa/dataset_infos.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"cooking": {"description": "\nDoQA is a dataset for accessing Domain Specific FAQs via conversational QA that contains 2,437 information-seeking question/answer dialogues \n(10,917 questions in total) on three different domains: cooking, travel and movies. Note that we include in the generic concept of FAQs also \nCommunity Question Answering sites, as well as corporate information in intranets which is maintained in textual form similar to FAQs, often \nreferred to as internal \u201cknowledge bases\u201d.\n\nThese dialogues are created by crowd workers that play the following two roles: the user who asks questions about a given topic posted in Stack \nExchange (https://stackexchange.com/), and the domain expert who replies to the questions by selecting a short span of text from the long textual \nreply in the original post. The expert can rephrase the selected span, in order to make it look more natural. The dataset covers unanswerable \nquestions and some relevant dialogue acts.\n\nDoQA enables the development and evaluation of conversational QA systems that help users access the knowledge buried in domain specific FAQs.\n", "citation": "\n@misc{campos2020doqa,\n title={DoQA -- Accessing Domain-Specific FAQs via Conversational QA},\n author={Jon Ander Campos and Arantxa Otegi and Aitor Soroa and Jan Deriu and Mark Cieliebak and Eneko Agirre},\n year={2020},\n eprint={2005.01328},\n archivePrefix={arXiv},\n primaryClass={cs.CL}\n}\n ", "homepage": "https://github.com/RevanthRameshkumar/CRD3", "license": "", "features": {"title": {"dtype": "string", "id": null, "_type": "Value"}, "background": {"dtype": "string", "id": null, "_type": "Value"}, "context": {"dtype": "string", "id": null, "_type": "Value"}, "question": {"dtype": "string", "id": null, "_type": "Value"}, "id": {"dtype": "string", "id": null, "_type": "Value"}, "answers": {"feature": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "answer_start": {"dtype": "int32", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}, "followup": {"dtype": "string", "id": null, "_type": "Value"}, "yesno": {"dtype": "string", "id": null, "_type": "Value"}, "orig_answer": {"feature": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "answer_start": {"dtype": "int32", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}}, "supervised_keys": null, "builder_name": "doqa", "config_name": "cooking", "version": {"version_str": "2.1.0", "description": "New split API (https://tensorflow.org/datasets/splits)", "nlp_version_to_prepare": null, "major": 2, "minor": 1, "patch": 0}, "splits": {"test": {"name": "test", "num_bytes": 2969064, "num_examples": 1797, "dataset_name": "doqa"}, "validation": {"name": "validation", "num_bytes": 1461613, "num_examples": 911, "dataset_name": "doqa"}, "train": {"name": "train", "num_bytes": 6881681, "num_examples": 4612, "dataset_name": "doqa"}}, "download_checksums": {"https://ixa2.si.ehu.es/convai/doqa-v2.1.zip": {"num_bytes": 4197671, "checksum": "aa5b236accee68a5ecc49f1d884ea5251f61f4cb7bb2c20fe005e47d41555ef7"}}, "download_size": 4197671, "dataset_size": 11312358, "size_in_bytes": 15510029}, "movies": {"description": "\nDoQA is a dataset for accessing Domain Specific FAQs via conversational QA that contains 2,437 information-seeking question/answer dialogues \n(10,917 questions in total) on three different domains: cooking, travel and movies. Note that we include in the generic concept of FAQs also \nCommunity Question Answering sites, as well as corporate information in intranets which is maintained in textual form similar to FAQs, often \nreferred to as internal \u201cknowledge bases\u201d.\n\nThese dialogues are created by crowd workers that play the following two roles: the user who asks questions about a given topic posted in Stack \nExchange (https://stackexchange.com/), and the domain expert who replies to the questions by selecting a short span of text from the long textual \nreply in the original post. The expert can rephrase the selected span, in order to make it look more natural. The dataset covers unanswerable \nquestions and some relevant dialogue acts.\n\nDoQA enables the development and evaluation of conversational QA systems that help users access the knowledge buried in domain specific FAQs.\n", "citation": "\n@misc{campos2020doqa,\n title={DoQA -- Accessing Domain-Specific FAQs via Conversational QA},\n author={Jon Ander Campos and Arantxa Otegi and Aitor Soroa and Jan Deriu and Mark Cieliebak and Eneko Agirre},\n year={2020},\n eprint={2005.01328},\n archivePrefix={arXiv},\n primaryClass={cs.CL}\n}\n ", "homepage": "https://github.com/RevanthRameshkumar/CRD3", "license": "", "features": {"title": {"dtype": "string", "id": null, "_type": "Value"}, "background": {"dtype": "string", "id": null, "_type": "Value"}, "context": {"dtype": "string", "id": null, "_type": "Value"}, "question": {"dtype": "string", "id": null, "_type": "Value"}, "id": {"dtype": "string", "id": null, "_type": "Value"}, "answers": {"feature": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "answer_start": {"dtype": "int32", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}, "followup": {"dtype": "string", "id": null, "_type": "Value"}, "yesno": {"dtype": "string", "id": null, "_type": "Value"}, "orig_answer": {"feature": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "answer_start": {"dtype": "int32", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}}, "supervised_keys": null, "builder_name": "doqa", "config_name": "movies", "version": {"version_str": "2.1.0", "description": "New split API (https://tensorflow.org/datasets/splits)", "nlp_version_to_prepare": null, "major": 2, "minor": 1, "patch": 0}, "splits": {"test": {"name": "test", "num_bytes": 3166075, "num_examples": 1884, "dataset_name": "doqa"}}, "download_checksums": {"https://ixa2.si.ehu.es/convai/doqa-v2.1.zip": {"num_bytes": 4197671, "checksum": "aa5b236accee68a5ecc49f1d884ea5251f61f4cb7bb2c20fe005e47d41555ef7"}}, "download_size": 4197671, "dataset_size": 3166075, "size_in_bytes": 7363746}, "travel": {"description": "\nDoQA is a dataset for accessing Domain Specific FAQs via conversational QA that contains 2,437 information-seeking question/answer dialogues \n(10,917 questions in total) on three different domains: cooking, travel and movies. Note that we include in the generic concept of FAQs also \nCommunity Question Answering sites, as well as corporate information in intranets which is maintained in textual form similar to FAQs, often \nreferred to as internal \u201cknowledge bases\u201d.\n\nThese dialogues are created by crowd workers that play the following two roles: the user who asks questions about a given topic posted in Stack \nExchange (https://stackexchange.com/), and the domain expert who replies to the questions by selecting a short span of text from the long textual \nreply in the original post. The expert can rephrase the selected span, in order to make it look more natural. The dataset covers unanswerable \nquestions and some relevant dialogue acts.\n\nDoQA enables the development and evaluation of conversational QA systems that help users access the knowledge buried in domain specific FAQs.\n", "citation": "\n@misc{campos2020doqa,\n title={DoQA -- Accessing Domain-Specific FAQs via Conversational QA},\n author={Jon Ander Campos and Arantxa Otegi and Aitor Soroa and Jan Deriu and Mark Cieliebak and Eneko Agirre},\n year={2020},\n eprint={2005.01328},\n archivePrefix={arXiv},\n primaryClass={cs.CL}\n}\n ", "homepage": "https://github.com/RevanthRameshkumar/CRD3", "license": "", "features": {"title": {"dtype": "string", "id": null, "_type": "Value"}, "background": {"dtype": "string", "id": null, "_type": "Value"}, "context": {"dtype": "string", "id": null, "_type": "Value"}, "question": {"dtype": "string", "id": null, "_type": "Value"}, "id": {"dtype": "string", "id": null, "_type": "Value"}, "answers": {"feature": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "answer_start": {"dtype": "int32", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}, "followup": {"dtype": "string", "id": null, "_type": "Value"}, "yesno": {"dtype": "string", "id": null, "_type": "Value"}, "orig_answer": {"feature": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "answer_start": {"dtype": "int32", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}}, "supervised_keys": null, "builder_name": "doqa", "config_name": "travel", "version": {"version_str": "2.1.0", "description": "New split API (https://tensorflow.org/datasets/splits)", "nlp_version_to_prepare": null, "major": 2, "minor": 1, "patch": 0}, "splits": {"test": {"name": "test", "num_bytes": 3216374, "num_examples": 1713, "dataset_name": "doqa"}}, "download_checksums": {"https://ixa2.si.ehu.es/convai/doqa-v2.1.zip": {"num_bytes": 4197671, "checksum": "aa5b236accee68a5ecc49f1d884ea5251f61f4cb7bb2c20fe005e47d41555ef7"}}, "download_size": 4197671, "dataset_size": 3216374, "size_in_bytes": 7414045}}

datasets/doqa/doqa.py

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
# coding=utf-8
2+
# Copyright 2020 The TensorFlow Datasets Authors and the HuggingFace NLP 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+
"""CRD3 dataset"""
18+
19+
from __future__ import absolute_import, division, print_function
20+
import logging
21+
22+
import json
23+
import os
24+
25+
import nlp
26+
27+
28+
_CITATION = """
29+
@misc{campos2020doqa,
30+
title={DoQA -- Accessing Domain-Specific FAQs via Conversational QA},
31+
author={Jon Ander Campos and Arantxa Otegi and Aitor Soroa and Jan Deriu and Mark Cieliebak and Eneko Agirre},
32+
year={2020},
33+
eprint={2005.01328},
34+
archivePrefix={arXiv},
35+
primaryClass={cs.CL}
36+
}
37+
"""
38+
39+
_DESCRIPTION = """
40+
DoQA is a dataset for accessing Domain Specific FAQs via conversational QA that contains 2,437 information-seeking question/answer dialogues
41+
(10,917 questions in total) on three different domains: cooking, travel and movies. Note that we include in the generic concept of FAQs also
42+
Community Question Answering sites, as well as corporate information in intranets which is maintained in textual form similar to FAQs, often
43+
referred to as internal “knowledge bases”.
44+
45+
These dialogues are created by crowd workers that play the following two roles: the user who asks questions about a given topic posted in Stack
46+
Exchange (https://stackexchange.com/), and the domain expert who replies to the questions by selecting a short span of text from the long textual
47+
reply in the original post. The expert can rephrase the selected span, in order to make it look more natural. The dataset covers unanswerable
48+
questions and some relevant dialogue acts.
49+
50+
DoQA enables the development and evaluation of conversational QA systems that help users access the knowledge buried in domain specific FAQs.
51+
"""
52+
53+
_URL = "https://ixa2.si.ehu.es/convai/doqa-v2.1.zip"
54+
class DoqaConfig(nlp.BuilderConfig):
55+
"""BuilderConfig for DoQA."""
56+
57+
def __init__(self, **kwargs):
58+
"""Constructs a DoQA.
59+
60+
Args:
61+
**kwargs: keyword arguments forwarded to super.
62+
"""
63+
64+
super(DoqaConfig, self).__init__(version=nlp.Version("2.1.0", "New split API (https://tensorflow.org/datasets/splits)"), **kwargs)
65+
66+
67+
class Doqa(nlp.GeneratorBasedBuilder):
68+
69+
BUILDER_CONFIGS = [
70+
DoqaConfig(
71+
name="cooking",
72+
description=""
73+
),
74+
DoqaConfig(
75+
name="movies",
76+
description=""
77+
),
78+
DoqaConfig(
79+
name="travel",
80+
description=""
81+
)
82+
]
83+
84+
def _info(self):
85+
return nlp.DatasetInfo(
86+
description=_DESCRIPTION,
87+
features=nlp.Features({
88+
"title": nlp.Value("string"),
89+
"background": nlp.Value("string"),
90+
"context": nlp.Value("string"),
91+
"question": nlp.Value("string"),
92+
"id": nlp.Value("string"),
93+
"answers":nlp.features.Sequence({
94+
"text": nlp.Value("string"),
95+
"answer_start": nlp.Value("int32"),
96+
}),
97+
"followup": nlp.Value("string"),
98+
"yesno": nlp.Value("string"),
99+
"orig_answer": nlp.features.Sequence({
100+
"text": nlp.Value("string"),
101+
"answer_start": nlp.Value("int32"),
102+
}),
103+
}),
104+
homepage="http://ixa.eus/node/12931",
105+
citation=_CITATION,
106+
)
107+
108+
def _split_generators(self, dl_manager):
109+
path = dl_manager.download_and_extract(_URL)
110+
if self.config.name == 'cooking':
111+
return [
112+
nlp.SplitGenerator(
113+
name=nlp.Split.TEST,
114+
gen_kwargs={"filepath": os.path.join(path, "doqa-v2.1", "doqa_dataset", "doqa-cooking-test-v2.1.json")},
115+
),
116+
nlp.SplitGenerator(
117+
name=nlp.Split.VALIDATION,
118+
gen_kwargs={"filepath": os.path.join(path, "doqa-v2.1", "doqa_dataset", "doqa-cooking-dev-v2.1.json")},
119+
),
120+
nlp.SplitGenerator(
121+
name=nlp.Split.TRAIN,
122+
gen_kwargs={"filepath": os.path.join(path, "doqa-v2.1","doqa_dataset", "doqa-cooking-train-v2.1.json")},
123+
)
124+
]
125+
elif self.config.name == "movies":
126+
return [
127+
nlp.SplitGenerator(
128+
name=nlp.Split.TEST,
129+
gen_kwargs={"filepath": os.path.join(path, "doqa-v2.1", "doqa_dataset", "doqa-movies-test-v2.1.json")},
130+
)
131+
]
132+
elif self.config.name == "travel":
133+
return [
134+
nlp.SplitGenerator(
135+
name=nlp.Split.TEST,
136+
gen_kwargs={"filepath": os.path.join(path, "doqa-v2.1", "doqa_dataset", "doqa-travel-test-v2.1.json")},
137+
)
138+
]
139+
140+
def _generate_examples(self, filepath):
141+
"""Yields examples."""
142+
143+
with open(filepath) as f:
144+
data = json.load(f)
145+
for row in data["data"]:
146+
title = row["title"]
147+
background = row["background"]
148+
paragraphs = row["paragraphs"]
149+
for p in paragraphs:
150+
context = p["context"]
151+
id_ = p["id"]
152+
qas = p["qas"]
153+
for qa in qas:
154+
question = qa["question"]
155+
answers = qa["answers"]
156+
id1 = qa["id"]
157+
yesno = qa["yesno"]
158+
followup = qa["followup"]
159+
answer_text = [answer["text"] for answer in answers]
160+
answer_start = [answer["answer_start"] for answer in answers]
161+
162+
orig_answer_start = [qa["orig_answer"]["answer_start"]]
163+
orig_answer_text = [qa["orig_answer"]["text"]]
164+
yield id1, {
165+
"title": title,
166+
"background": background,
167+
"context": context,
168+
"question": question,
169+
"id": id1,
170+
"answers": {
171+
"text": answer_text,
172+
"answer_start": answer_start,
173+
},
174+
"followup": followup,
175+
"yesno":yesno,
176+
"orig_answer":{
177+
"text": orig_answer_text,
178+
"answer_start": orig_answer_start,
179+
},
180+
}
181+
182+
183+
184+
4.5 KB
Binary file not shown.
1.87 KB
Binary file not shown.
1.87 KB
Binary file not shown.

0 commit comments

Comments
 (0)