Datasets:

Languages:
English
ArXiv:
License:
henry12348 commited on
Commit
3176f9b
1 Parent(s): a5c6df4
CQA_task_dataset/.gitattributes ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ test.jsonl filter=lfs diff=lfs merge=lfs -text
2
+ train.jsonl filter=lfs diff=lfs merge=lfs -text
3
+ val.jsonl filter=lfs diff=lfs merge=lfs -text
CQA_task_dataset/test.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:40bb92992294137a90d07e99624ca1d11705bf16b2b57e1a7c23a6baa420538c
3
+ size 3067923
CQA_task_dataset/train.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a80b133642508baae46317598d5ccdc8145d4e066e5c21015360eb7ea4e2ef36
3
+ size 20473078
CQA_task_dataset/val.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3637749a299462e8146735dda26e9cbb5249d8fade5c18e0980f4da9c2bd274c
3
+ size 2025917
NLI_dataset_without_context/dataset.json ADDED
The diff for this file is too large to render. See raw diff
 
NLI_task_dataset/dataset.json ADDED
The diff for this file is too large to render. See raw diff
 
PIR_first_subtask_dataset/test.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
PIR_first_subtask_dataset/train.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
PIR_first_subtask_dataset/val.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
PIR_second_subtask_dataset/test.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
PIR_second_subtask_dataset/train.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
PIR_second_subtask_dataset/val.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
README.md ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ pretty_name: DiPlomat
5
+ license: cc-by-nc-sa-4.0
6
+ ---
7
+ # The Dataset Presented Here is NOT Ready, please download from the [website](https://diplomat-dataset.github.io)
8
+ # DiPlomat
9
+
10
+ <!-- Provide a quick summary of the dataset. -->
11
+
12
+ Pragmatic reasoning plays a pivotal role in deciphering implicit meanings that frequently arise in real-life
13
+ conversations and is essential for the development of communicative social agents.
14
+ In this paper, we introduce a novel challenge, **DiPlomat**, aiming at benchmarking machines’ capabilities
15
+ on pragmatic reasoning and situated conversational understanding.
16
+ Compared with previous works that treat different figurative expressions
17
+ (e.g. metaphor, sarcasm) as individual tasks, **DiPlomat** provides a cohesive framework
18
+ towards general pragmatic understanding.
19
+ ## Dataset Details
20
+ The **DiPlomat** dataset owns 4,177 data and covers a vocabulary of 48,900 words.
21
+ More than that, human-annotated answers reach an amount of 6,494,
22
+ hold a vocabulary size of 20,000, and cover 5 types of reasoning.
23
+ Along with the dataset, we propose two tasks:
24
+ Pragmatic Identification and Reasoning (PIR) and Conversational Question Answering. Furthermore, we provide the
25
+ data that we use for zero-NLI in the [paper](https://arxiv.org/abs/2306.09030).
26
+
27
+
28
+ - **Language(s) (NLP):** [English]
29
+ - **License:** [CC BY-NC-SA (Attribution-NonCommercial-ShareAlike)](https://creativecommons.org/licenses/by-nc-sa/4.0/)
30
+
31
+ ### Dataset Sources
32
+
33
+ <!-- Provide the basic links for the dataset. -->
34
+
35
+ - **[Repository](https://github.com/diplomat-dataset/diplomat)**
36
+ - **Paper:** [DiPlomat: A Dialogue Dataset for Situated Pragmatic Reasoning](https://arxiv.org/abs/2306.09030)
37
+
38
+
39
+ ## Dataset Structure
40
+
41
+ <!-- This section provides a description of the dataset fields, and additional information about the dataset structure such as criteria used to create the splits, relationships between data points, etc. -->
42
+ We provide 5 fields. ``PIR_first_subtask_dataset``, ``PIR_second_subtask_dataset``is for the pragmatic
43
+ identification and reasoning (PIR) task, and ``CQA_task_dataset`` is for the conversational question answering (CQA)
44
+ task. As for ``NLI_task_dataset`` and ``NLI_dataset_without_context``, they are data for zero-NLI, while the latter
45
+ is a context-removed version.
46
+
47
+
48
+
49
+
50
+ ## Dataset Creation
51
+
52
+
53
+ ### Source Data
54
+ We leverage the data of [INTERVIEW dataset](https://www.kaggle.com/datasets/shuyangli94/interview-npr-media-dialog-transcripts) collected by
55
+ Majumder et al as our source.
56
+ <!-- This section describes the source data (e.g. news text and headlines, social media posts, translated sentences, ...). -->
57
+
58
+ ### Annotating Process
59
+
60
+ <!-- This section describes the data collection and processing process such as data selection criteria, filtering and normalization methods, tools and libraries used, etc. -->
61
+ #### Step I. Automatic Selection:
62
+ The extensive size of the source dataset introduces redundancy,
63
+ and thus requires automatic measures to alleviate the burden of human annotation.
64
+ Therefore, we employ algorithms and models to perform an initial filtering process.
65
+ #### Step II. Fine-grained Annotation:
66
+ We leverage Amazon Mechanical Turk to conduct detailed annotations of pragmatic turns within our dialogues.
67
+ Workers participating in the annotation task are instructed to select
68
+ all turns that exhibit a divergence between their literal meaning and their intended meaning.
69
+ Due to the subjective nature of pragmatic reasoning, we request the workers to provide confidence scores
70
+ along with reasons for their choices.
71
+ #### Step III. Human Refinement:
72
+ In this process, tasks for workers are formulated as multiple-choice questions.
73
+ Previously collected human-annotated reasons are transformed into choices, utilizing a template format:
74
+ [turn {turn_id}: {reason}]. In addition, to mitigate the impact of careless workers,
75
+ we introduce a distractor choice for each gold choice.
76
+
77
+
78
+
79
+
80
+ ## Citation
81
+
82
+ <!-- If there is a paper or blog post introducing the dataset, the APA and Bibtex information for that should go in this section. -->
83
+ ```
84
+ @inproceedings{li2023diplomat,
85
+ title={DiPlomat: A Dialogue Dataset for Situated Pragmatic Reasoning},
86
+ author={Hengli Li, Song-Chun Zhu, Zilong Zheng},
87
+ booktitle={Thirty-seventh Conference on Neural Information Processing Systems Datasets and Benchmarks Track},
88
+ year={2023}
89
+ }
90
+ ```
91
+
92
+ ## Dataset Card Contact
93
+
94
+ If there is any problem with the dataset, please email [lihengli@stu.pku.edu.cn](mailto: 2000017754@stu.pku.edu.cn).
diplomat-dataset.py ADDED
@@ -0,0 +1,242 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ # TODO: Address all TODOs and remove all explanatory comments
15
+
16
+
17
+ import csv
18
+ import json
19
+ import os
20
+
21
+ import datasets
22
+
23
+
24
+ # Find for instance the citation on arxiv or on the dataset repo/website
25
+ _CITATION = """\
26
+ @inproceedings{li2023diplomat,
27
+ title={DiPlomat: A Dialogue Dataset for Situated Pragmatic Reasoning},
28
+ author={Hengli Li, Song-Chun Zhu, Zilong Zheng},
29
+ booktitle={Thirty-seventh Conference on Neural Information Processing Systems Datasets and Benchmarks Track},
30
+ year={2023}
31
+ }
32
+
33
+ """
34
+
35
+ # TODO: Add description of the dataset here
36
+ # You can copy an official description
37
+ _DESCRIPTION = """\
38
+ Pragmatic reasoning plays a pivotal role in deciphering implicit meanings that frequently arise in real-life conversations and is essential for the development of communicative social agents. In this paper, we introduce a novel challenge, DiPlomat, aiming at benchmarking machines’ capabilities on pragmatic reasoning and situated conversational understanding. Compared with previous works that treat different figurative expressions (e.g. metaphor, sarcasm) as individual tasks, DiPlomat provides a cohesive framework towards general pragmatic understanding.
39
+ """
40
+
41
+ # TODO: Add a link to an official homepage for the dataset here
42
+ _HOMEPAGE = "https://diplomat-dataset.github.io"
43
+
44
+ # TODO: Add the licence for the dataset here if you can find it
45
+ _LICENSE = "CC BY-NC-SA (Attribution-NonCommercial-ShareAlike)"
46
+
47
+ # TODO: Add link to the official dataset URLs here
48
+ # The HuggingFace Datasets library doesn't host the datasets but only points to the original files.
49
+ # This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
50
+ _URLS = {
51
+ "PIR_first": "https://huggingface.co/great-new-dataset-first_domain.zip",
52
+ "second_domain": "https://huggingface.co/great-new-dataset-second_domain.zip",
53
+ }
54
+
55
+
56
+ # TODO: Name of the dataset usually matches the script name with CamelCase instead of snake_case
57
+ class Diplomat(datasets.GeneratorBasedBuilder):
58
+ """This is the DiPlomat Dataset focusing on pragmatic reasoning."""
59
+
60
+ VERSION = datasets.Version("1.1.0")
61
+
62
+ # This is an example of a dataset with multiple configurations.
63
+ # If you don't want/need to define several sub-sets in your dataset,
64
+ # just remove the BUILDER_CONFIG_CLASS and the BUILDER_CONFIGS attributes.
65
+
66
+ # If you need to make complex sub-parts in the datasets with configurable options
67
+ # You can create your own builder configuration class to store attribute, inheriting from datasets.BuilderConfig
68
+ # BUILDER_CONFIG_CLASS = MyBuilderConfig
69
+
70
+ # You will be able to load one or the other configurations in the following list with
71
+ # data = datasets.load_dataset('my_dataset', 'first_domain')
72
+ # data = datasets.load_dataset('my_dataset', 'second_domain')
73
+ BUILDER_CONFIGS = [
74
+ datasets.BuilderConfig(name="PIR_first", version=VERSION, description="This part of dataset covers the Pragmatic Identification and Reasoning Task Subtask 1"),
75
+ datasets.BuilderConfig(name="PIR_second", version=VERSION, description="This part of dataset covers the Pragmatic Identification and Reasoning Task Subtask 2"),
76
+ datasets.BuilderConfig(name="CQA", version=VERSION, description="This part of dataset covers the Conversational Question Answering Task"),
77
+ datasets.BuilderConfig(name="NLI_without_context", version=VERSION, description="This part of dataset covers the Zero-Shot Natural Language Inference Task"),
78
+ datasets.BuilderConfig(name="NLI_with_context", version=VERSION, description="This part of dataset covers the Zero-Shot Natural Language Inference Task")
79
+ ]
80
+ DEFAULT_CONFIG_NAME = "PIR_first" # It's not mandatory to have a default configuration. Just use one if it make sense.
81
+
82
+ def _info(self):
83
+ # TODO: This method specifies the datasets.DatasetInfo object which contains informations and typings for the dataset
84
+ # This is the name of the configuration selected in BUILDER_CONFIGS above
85
+ print("======================================")
86
+ print(os.getcwd())
87
+ if self.config.name == "PIR_first":
88
+ features = datasets.Features(
89
+ {
90
+ "text": datasets.Sequence(datasets.Value("string")),
91
+ "speaker": datasets.Sequence(datasets.Value("string")),
92
+ "correct_turn_number":datasets.Sequence(datasets.Value("int64")),
93
+ }
94
+ )
95
+ elif self.config.name == "PIR_second":
96
+ features = datasets.Features(
97
+ {
98
+ "text": datasets.Sequence(datasets.Value("string")),
99
+ "speaker": datasets.Sequence(datasets.Value("string")),
100
+ "correct_turn_number":datasets.Value("int64"),
101
+ "label": datasets.Value("int64"),
102
+ "choice": datasets.Sequence(datasets.Value("string")),
103
+ }
104
+ )
105
+ elif self.config.name == "CQA":
106
+ features = datasets.Features(
107
+ {
108
+ "text": datasets.Sequence(datasets.Value("string")),
109
+ "speaker": datasets.Sequence(datasets.Value("string")),
110
+ "gold_statement": datasets.Value("string"),
111
+ "questions": datasets.Value("string"),
112
+ "answer": datasets.Value("string"),
113
+ }
114
+ )
115
+ elif self.config.name == "NLI_without_context":
116
+ features = datasets.Features(
117
+ {
118
+ "text": datasets.Value("string"),
119
+ "hypothesis": datasets.Value("string"),
120
+ }
121
+ )
122
+
123
+ elif self.config.name == "NLI_with_context":
124
+ features = datasets.Features(
125
+ {
126
+ "dialogue": datasets.Sequence(datasets.Value("string")),
127
+ "speaker": datasets.Sequence(datasets.Value("string")),
128
+ "human answer": datasets.Value("string"),
129
+ }
130
+ )
131
+ else:
132
+ raise ValueError("Unknown configuration name selected")
133
+
134
+
135
+ return datasets.DatasetInfo(
136
+ description=_DESCRIPTION,
137
+ features=features, # Here we define them above because they are different between the two configurations
138
+ homepage=_HOMEPAGE,
139
+ license=_LICENSE,
140
+ citation=_CITATION,
141
+ )
142
+
143
+ def _split_generators(self, dl_manager):
144
+ urls = _URLS[self.config.name]
145
+
146
+ if self.config.name == "PIR_first":
147
+ data_dir = "./diplomat-dataset/PIR_first_subtask_dataset"
148
+ elif self.config.name == "PIR_second":
149
+ data_dir = "./diplomat-dataset/PIR_second_subtask_dataset"
150
+ elif self.config.name == "CQA":
151
+ data_dir = "./diplomat-dataset/CQA_task_dataset"
152
+ elif self.config.name == "NLI_without_context":
153
+ data_dir = "./diplomat-dataset/NLI_dataset_without_context"
154
+ elif self.config.name == "NLI_with_context":
155
+ data_dir = "./diplomat-dataset/NLI_task_dataset"
156
+ else:
157
+ raise ValueError("Unknown configuration name selected")
158
+
159
+ if "NLI" not in self.config.name:
160
+ return [
161
+ datasets.SplitGenerator(
162
+ name=datasets.Split.TRAIN,
163
+ # These kwargs will be passed to _generate_examples
164
+ gen_kwargs={
165
+ "filepath": os.path.join(data_dir, "train.json"),
166
+ "split": "train",
167
+ },
168
+ ),
169
+ datasets.SplitGenerator(
170
+ name=datasets.Split.VALIDATION,
171
+ # These kwargs will be passed to _generate_examples
172
+ gen_kwargs={
173
+ "filepath": os.path.join(data_dir, "val.json"),
174
+ "split": "val",
175
+ },
176
+ ),
177
+ datasets.SplitGenerator(
178
+ name=datasets.Split.TEST,
179
+ # These kwargs will be passed to _generate_examples
180
+ gen_kwargs={
181
+ "filepath": os.path.join(data_dir, "test.json"),
182
+ "split": "test"
183
+ },
184
+ ),
185
+ ]
186
+ else:
187
+ return [
188
+ datasets.SplitGenerator(
189
+ name=datasets.Split.TRAIN,
190
+ # These kwargs will be passed to _generate_examples
191
+ gen_kwargs={
192
+ "filepath": os.path.join(data_dir, "dataset.json"),
193
+ "split": "train",
194
+ },
195
+ ),
196
+ ]
197
+
198
+ # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
199
+ def _generate_examples(self, filepath, split):
200
+ # TODO: This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
201
+ # The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
202
+ print(os.getcwd())
203
+ with open(filepath, encoding="utf-8") as f:
204
+ for key, row in enumerate(f):
205
+ data = json.loads(row)
206
+ if self.config.name == "PIR_first":
207
+ yield key,{
208
+ "text": data['text'],
209
+ "speaker": data['speaker'],
210
+ "correct_turn_number":data['correct_turn_number'],
211
+ }
212
+ elif self.config.name == "PIR_second":
213
+ yield key, {
214
+ "text": data['text'],
215
+ "speaker": data['speaker'],
216
+ "correct_turn_number":data['correct_turn_number'],
217
+ "label": data['label'],
218
+ "choice": data['choice'],
219
+ }
220
+ elif self.config.name == "CQA":
221
+ yield key,{
222
+ "text": data['text'],
223
+ "speaker": data['speaker'],
224
+ "gold_statement": data['gold_statement'],
225
+ "questions": data['questions'],
226
+ "answer": data['answer'],
227
+ }
228
+ elif self.config.name == "NLI_without_context":
229
+ yield key,{
230
+ "text": data['text'],
231
+ "hypothesis": data['hypothesis'],
232
+ }
233
+ elif self.config.name == "NLI_with_context":
234
+ yield key,{
235
+ "dialogue": data['dialogue'],
236
+ "speaker": data['speaker'],
237
+ "human answer": data['human answer'],
238
+ }
239
+ else:
240
+ raise ValueError("Unknown configuration name selected")
241
+
242
+