-
Notifications
You must be signed in to change notification settings - Fork 3k
add DoQA dataset (ACL 2020) #473
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +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}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,183 @@ | ||
| # coding=utf-8 | ||
| # Copyright 2020 The TensorFlow Datasets Authors and the HuggingFace NLP Authors. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| # Lint as: python3 | ||
| """CRD3 dataset""" | ||
|
|
||
| from __future__ import absolute_import, division, print_function | ||
| import logging | ||
|
|
||
| import json | ||
| import os | ||
|
|
||
| import nlp | ||
|
|
||
|
|
||
| _CITATION = """ | ||
| @misc{campos2020doqa, | ||
| title={DoQA -- Accessing Domain-Specific FAQs via Conversational QA}, | ||
| author={Jon Ander Campos and Arantxa Otegi and Aitor Soroa and Jan Deriu and Mark Cieliebak and Eneko Agirre}, | ||
| year={2020}, | ||
| eprint={2005.01328}, | ||
| archivePrefix={arXiv}, | ||
| primaryClass={cs.CL} | ||
| } | ||
| """ | ||
|
|
||
| _DESCRIPTION = """ | ||
| DoQA is a dataset for accessing Domain Specific FAQs via conversational QA that contains 2,437 information-seeking question/answer dialogues | ||
| (10,917 questions in total) on three different domains: cooking, travel and movies. Note that we include in the generic concept of FAQs also | ||
| Community Question Answering sites, as well as corporate information in intranets which is maintained in textual form similar to FAQs, often | ||
| referred to as internal “knowledge bases”. | ||
|
|
||
| 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 | ||
| Exchange (https://stackexchange.com/), and the domain expert who replies to the questions by selecting a short span of text from the long textual | ||
| reply in the original post. The expert can rephrase the selected span, in order to make it look more natural. The dataset covers unanswerable | ||
| questions and some relevant dialogue acts. | ||
|
|
||
| DoQA enables the development and evaluation of conversational QA systems that help users access the knowledge buried in domain specific FAQs. | ||
| """ | ||
|
|
||
| _URL = "https://ixa2.si.ehu.es/convai/doqa-v2.1.zip" | ||
| class DoqaConfig(nlp.BuilderConfig): | ||
| """BuilderConfig for DoQA.""" | ||
|
|
||
| def __init__(self, **kwargs): | ||
| """Constructs a DoQA. | ||
|
|
||
| Args: | ||
| **kwargs: keyword arguments forwarded to super. | ||
| """ | ||
|
|
||
| super(DoqaConfig, self).__init__(version=nlp.Version("2.1.0", "New split API (https://tensorflow.org/datasets/splits)"), **kwargs) | ||
|
|
||
|
|
||
| class Doqa(nlp.GeneratorBasedBuilder): | ||
|
|
||
| BUILDER_CONFIGS = [ | ||
| DoqaConfig( | ||
| name="cooking", | ||
| ), | ||
| DoqaConfig( | ||
| name="movies", | ||
| ), | ||
| DoqaConfig( | ||
| name="travel", | ||
| ) | ||
| ] | ||
|
|
||
| def _info(self): | ||
| return nlp.DatasetInfo( | ||
| description=_DESCRIPTION, | ||
| features=nlp.Features({ | ||
| "title": nlp.Value("string"), | ||
| "background": nlp.Value("string"), | ||
| "context": nlp.Value("string"), | ||
| "question": nlp.Value("string"), | ||
| "id": nlp.Value("string"), | ||
| "answers":nlp.features.Sequence({ | ||
| "text": nlp.Value("string"), | ||
| "answer_start": nlp.Value("int32"), | ||
| }), | ||
| "followup": nlp.Value("string"), | ||
| "yesno": nlp.Value("string"), | ||
| "orig_answer": nlp.features.Sequence({ | ||
| "text": nlp.Value("string"), | ||
| "answer_start": nlp.Value("int32"), | ||
| }), | ||
| }), | ||
| homepage="http://ixa.eus/node/12931", | ||
| citation=_CITATION, | ||
| ) | ||
|
|
||
| def _split_generators(self, dl_manager): | ||
| path = dl_manager.download_and_extract(_URL) | ||
| if self.config.name == 'cooking': | ||
| return [ | ||
| nlp.SplitGenerator( | ||
| name=nlp.Split.TEST, | ||
| gen_kwargs={"filepath": os.path.join(path, "doqa-v2.1", "doqa_dataset", "doqa-cooking-test-v2.1.json")}, | ||
| ), | ||
| nlp.SplitGenerator( | ||
| name=nlp.Split.VALIDATION, | ||
| gen_kwargs={"filepath": os.path.join(path, "doqa-v2.1", "doqa_dataset", "doqa-cooking-dev-v2.1.json")}, | ||
| ), | ||
| nlp.SplitGenerator( | ||
| name=nlp.Split.TRAIN, | ||
| gen_kwargs={"filepath": os.path.join(path, "doqa-v2.1","doqa_dataset", "doqa-cooking-train-v2.1.json")}, | ||
| ) | ||
| ] | ||
| elif self.config.name == "movies": | ||
| return [ | ||
| nlp.SplitGenerator( | ||
| name=nlp.Split.TEST, | ||
| gen_kwargs={"filepath": os.path.join(path, "doqa-v2.1", "doqa_dataset", "doqa-movies-test-v2.1.json")}, | ||
| ) | ||
| ] | ||
| elif self.config.name == "travel": | ||
| return [ | ||
| nlp.SplitGenerator( | ||
| name=nlp.Split.TEST, | ||
| gen_kwargs={"filepath": os.path.join(path, "doqa-v2.1", "doqa_dataset", "doqa-travel-test-v2.1.json")}, | ||
| ) | ||
| ] | ||
| else: | ||
| raise ValueError("Unknown config name") | ||
|
|
||
| def _generate_examples(self, filepath): | ||
| """Yields examples.""" | ||
|
|
||
| with open(filepath, encoding="utf-8") as f: | ||
| data = json.load(f) | ||
| for row in data["data"]: | ||
| title = row["title"] | ||
| background = row["background"] | ||
| paragraphs = row["paragraphs"] | ||
| for p in paragraphs: | ||
| context = p["context"] | ||
| id_ = p["id"] | ||
| qas = p["qas"] | ||
| for qa in qas: | ||
| question = qa["question"] | ||
| answers = qa["answers"] | ||
| id1 = qa["id"] | ||
| yesno = qa["yesno"] | ||
| followup = qa["followup"] | ||
| answer_text = [answer["text"] for answer in answers] | ||
| answer_start = [answer["answer_start"] for answer in answers] | ||
|
|
||
| orig_answer_start = [qa["orig_answer"]["answer_start"]] | ||
| orig_answer_text = [qa["orig_answer"]["text"]] | ||
|
Comment on lines
+161
to
+162
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Those two fields are supposed to be |
||
| yield id1, { | ||
| "title": title, | ||
| "background": background, | ||
| "context": context, | ||
| "question": question, | ||
| "id": id1, | ||
| "answers": { | ||
| "text": answer_text, | ||
| "answer_start": answer_start, | ||
| }, | ||
| "followup": followup, | ||
| "yesno":yesno, | ||
| "orig_answer":{ | ||
| "text": orig_answer_text, | ||
| "answer_start": orig_answer_start, | ||
| }, | ||
| } | ||
|
|
||
|
|
||
|
|
||
|
|
||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe raise an error if the config name is wrong ?