Vaibhav Adlakha commited on
Commit
43c785e
1 Parent(s): 8b6e9d4
Files changed (1) hide show
  1. TopiOCQA.py +0 -128
TopiOCQA.py DELETED
@@ -1,128 +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
- """TopiOCQA: Open-domain Conversational Question Answering with Topic Switching"""
18
-
19
-
20
- import json
21
-
22
- import datasets
23
- # from datasets.tasks import QuestionAnsweringExtractive
24
-
25
-
26
- logger = datasets.logging.get_logger(__name__)
27
-
28
-
29
- # _CITATION = """\
30
- # @article{2016arXiv160605250R,
31
- # author = {{Rajpurkar}, Pranav and {Zhang}, Jian and {Lopyrev},
32
- # Konstantin and {Liang}, Percy},
33
- # title = "{SQuAD: 100,000+ Questions for Machine Comprehension of Text}",
34
- # journal = {arXiv e-prints},
35
- # year = 2016,
36
- # eid = {arXiv:1606.05250},
37
- # pages = {arXiv:1606.05250},
38
- # archivePrefix = {arXiv},
39
- # eprint = {1606.05250},
40
- # }
41
- # """
42
-
43
- _DESCRIPTION = """\
44
- TopiOCQA is an information-seeking conversational dataset with challenging topic switching phenomena.
45
- """
46
-
47
- # _URL = "https://rajpurkar.github.io/SQuAD-explorer/dataset/"
48
- _URLS = {
49
- "train": "data/topiocqa_train.jsonl",
50
- "valid": "data/topiocqa_valid.jsonl",
51
- }
52
-
53
-
54
- class TopiOCQAConfig(datasets.BuilderConfig):
55
- """BuilderConfig for SQUAD."""
56
-
57
- def __init__(self, **kwargs):
58
- """BuilderConfig for TopiOCQA.
59
-
60
- Args:
61
- **kwargs: keyword arguments forwarded to super.
62
- """
63
- super(TopiOCQAConfig, self).__init__(**kwargs)
64
-
65
-
66
- class Squad(datasets.GeneratorBasedBuilder):
67
- """SQUAD: The Stanford Question Answering Dataset. Version 1.1."""
68
-
69
- BUILDER_CONFIGS = [
70
- TopiOCQAConfig(
71
- name="plain_text",
72
- version=datasets.Version("1.0.0", ""),
73
- description="Plain text",
74
- ),
75
- ]
76
-
77
- def _info(self):
78
- return datasets.DatasetInfo(
79
- description=_DESCRIPTION,
80
- features=datasets.Features(
81
- {
82
- "Conversation_no": datasets.Value("int32"),
83
- "Turn_no": datasets.Value("int32"),
84
- "Question": datasets.Value("string"),
85
- "Answer": datasets.Value("string"),
86
- "Topic": datasets.Value("string"),
87
- "Topic_section": datasets.Value("string"),
88
- "Rationale": datasets.Value("string"),
89
- "is_nq": datasets.Value("bool"),
90
- "Context": datasets.features.Sequence(datasets.Value("string")),
91
- "Additional_answers": datasets.features.Sequence(
92
- {
93
- "Answer": datasets.Value("string"),
94
- "Topic": datasets.Value("string"),
95
- "Topic_section": datasets.Value("string"),
96
- "Rationale": datasets.Value("string"),
97
- }
98
- ),
99
- }
100
- ),
101
- supervised_keys=None,
102
- homepage="https://mcgill-nlp.github.io/topiocqa/",
103
- # citation=_CITATION,
104
- # task_templates=[
105
- # QuestionAnsweringExtractive(
106
- # question_column="Question", context_column="context", answers_column="answers"
107
- # )
108
- # ],
109
- )
110
-
111
- def _split_generators(self, dl_manager):
112
- downloaded_files = dl_manager.download_and_extract(_URLS)
113
-
114
- return [
115
- datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_files["train"]}),
116
- datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": downloaded_files["valid"]}),
117
- ]
118
-
119
- def _generate_examples(self, filepath):
120
- """This function returns the examples in the raw (text) form."""
121
- logger.info("generating examples from = %s", filepath)
122
- key = 0
123
- with open(filepath, encoding="utf-8") as f:
124
- for line in f:
125
- data = json.loads(line)
126
- yield key, data
127
- key += 1
128
-