Datasets:

Modalities:
Text
Formats:
parquet
Languages:
English
ArXiv:
Libraries:
Datasets
pandas
License:
albertvillanova HF staff commited on
Commit
085e84e
1 Parent(s): 74fb3a3

Delete loading script

Browse files
Files changed (1) hide show
  1. circa.py +0 -153
circa.py DELETED
@@ -1,153 +0,0 @@
1
- # coding=utf-8
2
- # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
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
- """Dataset containing polar questions and indirect answers."""
16
-
17
-
18
- import csv
19
-
20
- import datasets
21
-
22
-
23
- _CITATION = """\
24
- @InProceedings{louis_emnlp2020,
25
- author = "Annie Louis and Dan Roth and Filip Radlinski",
26
- title = ""{I}'d rather just go to bed": {U}nderstanding {I}ndirect {A}nswers",
27
- booktitle = "Proceedings of the 2020 Conference on Empirical Methods
28
- in Natural Language Processing",
29
- year = "2020",
30
- }
31
- """
32
-
33
- _DESCRIPTION = """\
34
- The Circa (meaning ‘approximately’) dataset aims to help machine learning systems
35
- to solve the problem of interpreting indirect answers to polar questions.
36
-
37
- The dataset contains pairs of yes/no questions and indirect answers, together with
38
- annotations for the interpretation of the answer. The data is collected in 10
39
- different social conversational situations (eg. food preferences of a friend).
40
-
41
- NOTE: There might be missing labels in the dataset and we have replaced them with -1.
42
- The original dataset contains no train/dev/test splits.
43
- """
44
-
45
- _LICENSE = "Creative Commons Attribution 4.0 License"
46
-
47
- _DATA_URL = "https://raw.githubusercontent.com/google-research-datasets/circa/main/circa-data.tsv"
48
-
49
-
50
- class Circa(datasets.GeneratorBasedBuilder):
51
- """Dataset containing polar questions and indirect answers."""
52
-
53
- VERSION = datasets.Version("1.1.0")
54
-
55
- def _info(self):
56
- features = datasets.Features(
57
- {
58
- "context": datasets.Value("string"),
59
- "question-X": datasets.Value("string"),
60
- "canquestion-X": datasets.Value("string"),
61
- "answer-Y": datasets.Value("string"),
62
- "judgements": datasets.Value("string"),
63
- "goldstandard1": datasets.features.ClassLabel(
64
- names=[
65
- "Yes",
66
- "No",
67
- "In the middle, neither yes nor no",
68
- "Probably yes / sometimes yes",
69
- "Probably no",
70
- "Yes, subject to some conditions",
71
- "Other",
72
- "I am not sure how X will interpret Y’s answer",
73
- ]
74
- ),
75
- "goldstandard2": datasets.features.ClassLabel(
76
- names=[
77
- "Yes",
78
- "No",
79
- "In the middle, neither yes nor no",
80
- "Yes, subject to some conditions",
81
- "Other",
82
- ]
83
- ),
84
- }
85
- )
86
- return datasets.DatasetInfo(
87
- # This is the description that will appear on the datasets page.
88
- description=_DESCRIPTION,
89
- # This defines the different columns of the dataset and their types
90
- features=features, # Here we define them above because they are different between the two configurations
91
- # If there's a common (input, target) tuple from the features,
92
- # specify them here. They'll be used if as_supervised=True in
93
- # builder.as_dataset.
94
- supervised_keys=None,
95
- # Homepage of the dataset for documentation
96
- homepage="https://github.com/google-research-datasets/circa",
97
- # License for the dataset if available
98
- license=_LICENSE,
99
- # Citation for the dataset
100
- citation=_CITATION,
101
- )
102
-
103
- def _split_generators(self, dl_manager):
104
- train_path = dl_manager.download_and_extract(_DATA_URL)
105
- return [
106
- datasets.SplitGenerator(
107
- name=datasets.Split.TRAIN,
108
- # These kwargs will be passed to _generate_examples
109
- gen_kwargs={
110
- "filepath": train_path,
111
- "split": datasets.Split.TRAIN,
112
- },
113
- ),
114
- ]
115
-
116
- def _generate_examples(self, filepath, split):
117
- with open(filepath, encoding="utf-8") as f:
118
- goldstandard1_labels = [
119
- "Yes",
120
- "No",
121
- "In the middle, neither yes nor no",
122
- "Probably yes / sometimes yes",
123
- "Probably no",
124
- "Yes, subject to some conditions",
125
- "Other",
126
- "I am not sure how X will interpret Y’s answer",
127
- ]
128
- goldstandard2_labels = [
129
- "Yes",
130
- "No",
131
- "In the middle, neither yes nor no",
132
- "Yes, subject to some conditions",
133
- "Other",
134
- ]
135
- data = csv.reader(f, delimiter="\t")
136
- next(data, None) # skip the headers
137
- for id_, row in enumerate(data):
138
- row = [x if x != "nan" else -1 for x in row]
139
- _, context, question_X, canquestion_X, answer_Y, judgements, goldstandard1, goldstandard2 = row
140
- if goldstandard1 not in goldstandard1_labels:
141
- goldstandard1 = -1
142
- if goldstandard2 not in goldstandard2_labels:
143
- goldstandard2 = -1
144
-
145
- yield id_, {
146
- "context": context,
147
- "question-X": question_X,
148
- "canquestion-X": canquestion_X,
149
- "answer-Y": answer_Y,
150
- "judgements": judgements,
151
- "goldstandard1": goldstandard1,
152
- "goldstandard2": goldstandard2,
153
- }