magnetic commited on
Commit
0cd9f79
1 Parent(s): 995eb42

Upload RiSAWOZ.py

Browse files
Files changed (1) hide show
  1. RiSAWOZ.py +489 -0
RiSAWOZ.py ADDED
@@ -0,0 +1,489 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ """RiSAWOZ: A Large-Scale Multi-Domain Wizard-of-Oz Dataset with Rich Semantic Annotations for Task-Oriented Dialogue Modeling"""
16
+
17
+
18
+ import json
19
+ import os
20
+ from typing import Dict
21
+
22
+ import datasets
23
+
24
+
25
+ _CITATION = """\
26
+ @inproceedings{quan-etal-2020-risawoz,
27
+ title = "{R}i{SAWOZ}: A Large-Scale Multi-Domain {W}izard-of-{O}z Dataset with Rich Semantic Annotations for Task-Oriented Dialogue Modeling",
28
+ author = "Quan, Jun and
29
+ Zhang, Shian and
30
+ Cao, Qian and
31
+ Li, Zizhong and
32
+ Xiong, Deyi",
33
+ booktitle = "Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP)",
34
+ month = nov,
35
+ year = "2020",
36
+ address = "Online",
37
+ publisher = "Association for Computational Linguistics",
38
+ url = "https://www.aclweb.org/anthology/2020.emnlp-main.67",
39
+ pages = "930--940",
40
+ }
41
+ """
42
+
43
+
44
+ _DESCRIPTION = """\
45
+ RiSAWOZ contains 11.2K human-to-human (H2H) multiturn semantically annotated dialogues, \
46
+ with more than 150K utterances spanning over 12 domains, \
47
+ which is larger than all previous annotated H2H conversational datasets.\
48
+ Both single- and multi-domain dialogues are constructed, accounting for 65% and 35%, respectively.
49
+ """
50
+
51
+ _HOMEPAGE = "https://github.com/terryqj0107/RiSAWOZ"
52
+
53
+ _LICENSE = "Attribution 4.0 International (CC BY 4.0) license."
54
+
55
+
56
+ class RiSAWOZ(datasets.GeneratorBasedBuilder):
57
+ """RiSAWOZ: A Large-Scale Multi-Domain Wizard-of-Oz Dataset with Rich Semantic Annotations for Task-Oriented Dialogue Modeling"""
58
+
59
+ VERSION = datasets.Version("1.1.0")
60
+
61
+ def _info(self):
62
+ features = datasets.Features(
63
+ {
64
+ "dialogue_id": datasets.Value("string"),
65
+ "goal": datasets.Value("string"),
66
+ "domains": datasets.Sequence(datasets.Value("string")),
67
+ "dialogue": [
68
+ {
69
+ "turn_id": datasets.Value("int32"),
70
+ "turn_domain": datasets.Sequence(datasets.Value("string")),
71
+ "user_utterance": datasets.Value("string"),
72
+ "system_utterance": datasets.Value("string"),
73
+ "belief_state": {
74
+ "inform slot-values": {
75
+ "旅游景点-名称": datasets.Value("string"),
76
+ "旅游景点-区域": datasets.Value("string"),
77
+ "旅游景点-景点类型": datasets.Value("string"),
78
+ "旅游景点-最适合人群": datasets.Value("string"),
79
+ "旅游景点-消费": datasets.Value("string"),
80
+ "旅游景点-是否地铁直达": datasets.Value("string"),
81
+ "旅游景点-门票价格": datasets.Value("string"),
82
+ "旅游景点-电话号码": datasets.Value("string"),
83
+ "旅游景点-地址": datasets.Value("string"),
84
+ "旅游景点-评分": datasets.Value("string"),
85
+ "旅游景点-开放时间": datasets.Value("string"),
86
+ "旅游景点-特点": datasets.Value("string"),
87
+ "餐厅-名称": datasets.Value("string"),
88
+ "餐厅-区域": datasets.Value("string"),
89
+ "餐厅-菜系": datasets.Value("string"),
90
+ "餐厅-价位": datasets.Value("string"),
91
+ "餐厅-是否地铁直达": datasets.Value("string"),
92
+ "餐厅-人均消费": datasets.Value("string"),
93
+ "餐厅-地址": datasets.Value("string"),
94
+ "餐厅-电话号码": datasets.Value("string"),
95
+ "餐厅-评分": datasets.Value("string"),
96
+ "餐厅-营业时间": datasets.Value("string"),
97
+ "餐厅-推荐菜": datasets.Value("string"),
98
+ "酒店-名称": datasets.Value("string"),
99
+ "酒店-区域": datasets.Value("string"),
100
+ "酒店-星级": datasets.Value("string"),
101
+ "酒店-价位": datasets.Value("string"),
102
+ "酒店-酒店类型": datasets.Value("string"),
103
+ "酒店-房型": datasets.Value("string"),
104
+ "酒店-停车场": datasets.Value("string"),
105
+ "酒店-房费": datasets.Value("string"),
106
+ "酒店-地址": datasets.Value("string"),
107
+ "酒店-电话号码": datasets.Value("string"),
108
+ "酒店-评分": datasets.Value("string"),
109
+ "电脑-品牌": datasets.Value("string"),
110
+ "电脑-产品类别": datasets.Value("string"),
111
+ "电脑-分类": datasets.Value("string"),
112
+ "电脑-内存容量": datasets.Value("string"),
113
+ "电脑-屏幕尺寸": datasets.Value("string"),
114
+ "电脑-CPU": datasets.Value("string"),
115
+ "电脑-价格区间": datasets.Value("string"),
116
+ "电脑-系列": datasets.Value("string"),
117
+ "电脑-商品名称": datasets.Value("string"),
118
+ "电脑-系统": datasets.Value("string"),
119
+ "电脑-游戏性能": datasets.Value("string"),
120
+ "电脑-CPU型号": datasets.Value("string"),
121
+ "电脑-裸机重量": datasets.Value("string"),
122
+ "电脑-显卡类别": datasets.Value("string"),
123
+ "电脑-显卡型号": datasets.Value("string"),
124
+ "电脑-特性": datasets.Value("string"),
125
+ "电脑-色系": datasets.Value("string"),
126
+ "电脑-待机时长": datasets.Value("string"),
127
+ "电脑-硬盘容量": datasets.Value("string"),
128
+ "电脑-价格": datasets.Value("string"),
129
+ "火车-出发地": datasets.Value("string"),
130
+ "火车-目的地": datasets.Value("string"),
131
+ "火车-日期": datasets.Value("string"),
132
+ "火车-车型": datasets.Value("string"),
133
+ "火车-坐席": datasets.Value("string"),
134
+ "火车-车次信息": datasets.Value("string"),
135
+ "火车-时长": datasets.Value("string"),
136
+ "火车-出发时间": datasets.Value("string"),
137
+ "火车-到达时间": datasets.Value("string"),
138
+ "火车-票价": datasets.Value("string"),
139
+ "飞机-出发地": datasets.Value("string"),
140
+ "飞机-目的地": datasets.Value("string"),
141
+ "飞机-日期": datasets.Value("string"),
142
+ "飞机-舱位档次": datasets.Value("string"),
143
+ "飞机-航班信息": datasets.Value("string"),
144
+ "飞机-起飞时间": datasets.Value("string"),
145
+ "飞机-到达时间": datasets.Value("string"),
146
+ "飞机-票价": datasets.Value("string"),
147
+ "飞机-准点率": datasets.Value("string"),
148
+ "天气-城市": datasets.Value("string"),
149
+ "天气-日期": datasets.Value("string"),
150
+ "天气-天气": datasets.Value("string"),
151
+ "天气-温度": datasets.Value("string"),
152
+ "天气-风力风向": datasets.Value("string"),
153
+ "天气-紫外线强度": datasets.Value("string"),
154
+ "电影-制片国家/地区": datasets.Value("string"),
155
+ "电影-类型": datasets.Value("string"),
156
+ "电影-年代": datasets.Value("string"),
157
+ "电影-主演": datasets.Value("string"),
158
+ "电影-导演": datasets.Value("string"),
159
+ "电影-片名": datasets.Value("string"),
160
+ "电影-主演名单": datasets.Value("string"),
161
+ "电影-具体上映时间": datasets.Value("string"),
162
+ "电影-片长": datasets.Value("string"),
163
+ "电影-豆瓣评分": datasets.Value("string"),
164
+ "电视剧-制片国家/地区": datasets.Value("string"),
165
+ "电视剧-类型": datasets.Value("string"),
166
+ "电视剧-年代": datasets.Value("string"),
167
+ "电视剧-主演": datasets.Value("string"),
168
+ "电视剧-导演": datasets.Value("string"),
169
+ "电视剧-片名": datasets.Value("string"),
170
+ "电视剧-主演名单": datasets.Value("string"),
171
+ "电视剧-首播时间": datasets.Value("string"),
172
+ "电视剧-集数": datasets.Value("string"),
173
+ "电视剧-单集片长": datasets.Value("string"),
174
+ "电视剧-豆瓣评分": datasets.Value("string"),
175
+ "辅导班-班号": datasets.Value("string"),
176
+ "辅导班-难度": datasets.Value("string"),
177
+ "辅导班-科目": datasets.Value("string"),
178
+ "辅导班-年级": datasets.Value("string"),
179
+ "辅导班-区域": datasets.Value("string"),
180
+ "辅导班-校区": datasets.Value("string"),
181
+ "辅导班-上课方式": datasets.Value("string"),
182
+ "辅导班-开始日期": datasets.Value("string"),
183
+ "辅导班-结束日期": datasets.Value("string"),
184
+ "辅导班-每周": datasets.Value("string"),
185
+ "辅导班-上课时间": datasets.Value("string"),
186
+ "辅导班-下课时间": datasets.Value("string"),
187
+ "辅导班-时段": datasets.Value("string"),
188
+ "辅导班-课次": datasets.Value("string"),
189
+ "辅导班-课时": datasets.Value("string"),
190
+ "辅导班-教室地点": datasets.Value("string"),
191
+ "辅导班-教师": datasets.Value("string"),
192
+ "辅导班-价格": datasets.Value("string"),
193
+ "辅导班-课程网址": datasets.Value("string"),
194
+ "辅导班-教师网址": datasets.Value("string"),
195
+ "汽车-名称": datasets.Value("string"),
196
+ "汽车-车型": datasets.Value("string"),
197
+ "汽车-级别": datasets.Value("string"),
198
+ "汽车-座位数": datasets.Value("string"),
199
+ "汽车-车身尺寸(mm)": datasets.Value("string"),
200
+ "汽车-厂商": datasets.Value("string"),
201
+ "汽车-能源类型": datasets.Value("string"),
202
+ "汽车-发动机排量(L)": datasets.Value("string"),
203
+ "汽车-发动机马力(Ps)": datasets.Value("string"),
204
+ "汽车-驱动方式": datasets.Value("string"),
205
+ "汽车-综合油耗(L/100km)": datasets.Value("string"),
206
+ "汽车-环保标准": datasets.Value("string"),
207
+ "汽车-驾驶辅助影像": datasets.Value("string"),
208
+ "汽车-巡航系统": datasets.Value("string"),
209
+ "汽车-价格(万元)": datasets.Value("string"),
210
+ "汽车-车系": datasets.Value("string"),
211
+ "汽车-动力水平": datasets.Value("string"),
212
+ "汽车-油耗水平": datasets.Value("string"),
213
+ "汽车-倒车影像": datasets.Value("string"),
214
+ "汽车-定速巡航": datasets.Value("string"),
215
+ "汽车-座椅加热": datasets.Value("string"),
216
+ "汽车-座椅通风": datasets.Value("string"),
217
+ "汽车-所属价格区间": datasets.Value("string"),
218
+ "医院-名称": datasets.Value("string"),
219
+ "医院-等级": datasets.Value("string"),
220
+ "医院-类别": datasets.Value("string"),
221
+ "医院-性质": datasets.Value("string"),
222
+ "医院-区域": datasets.Value("string"),
223
+ "医院-地址": datasets.Value("string"),
224
+ "医院-电话": datasets.Value("string"),
225
+ "医院-挂号时间": datasets.Value("string"),
226
+ "医院-门诊时间": datasets.Value("string"),
227
+ "医院-公交线路": datasets.Value("string"),
228
+ "医院-地铁可达": datasets.Value("string"),
229
+ "医院-地铁线路": datasets.Value("string"),
230
+ "医院-重点科室": datasets.Value("string"),
231
+ "医院-CT": datasets.Value("string"),
232
+ "医院-3.0T MRI": datasets.Value("string"),
233
+ "医院-DSA": datasets.Value("string"),
234
+ },
235
+ # "inform slot-values": datasets.Value("string"),
236
+ "turn_inform": {
237
+ "旅游景点-名称": datasets.Value("string"),
238
+ "旅游景点-区域": datasets.Value("string"),
239
+ "旅游景点-景点类型": datasets.Value("string"),
240
+ "旅游景点-最适合人群": datasets.Value("string"),
241
+ "旅游景点-消费": datasets.Value("string"),
242
+ "旅游景点-是否地铁直达": datasets.Value("string"),
243
+ "旅游景点-门票价格": datasets.Value("string"),
244
+ "旅游景点-电话号码": datasets.Value("string"),
245
+ "旅游景点-地址": datasets.Value("string"),
246
+ "旅游景点-评分": datasets.Value("string"),
247
+ "旅游景点-开放时间": datasets.Value("string"),
248
+ "旅游景点-特点": datasets.Value("string"),
249
+ "餐厅-名称": datasets.Value("string"),
250
+ "餐厅-区域": datasets.Value("string"),
251
+ "餐厅-菜系": datasets.Value("string"),
252
+ "餐厅-价位": datasets.Value("string"),
253
+ "餐厅-是否地铁直达": datasets.Value("string"),
254
+ "餐厅-人均消费": datasets.Value("string"),
255
+ "餐厅-地址": datasets.Value("string"),
256
+ "餐厅-电话号码": datasets.Value("string"),
257
+ "餐厅-评分": datasets.Value("string"),
258
+ "餐厅-营业时间": datasets.Value("string"),
259
+ "餐厅-推荐菜": datasets.Value("string"),
260
+ "酒店-名称": datasets.Value("string"),
261
+ "酒店-区域": datasets.Value("string"),
262
+ "酒店-星级": datasets.Value("string"),
263
+ "酒店-价位": datasets.Value("string"),
264
+ "酒店-酒店类型": datasets.Value("string"),
265
+ "酒店-房型": datasets.Value("string"),
266
+ "酒店-停车场": datasets.Value("string"),
267
+ "酒店-房费": datasets.Value("string"),
268
+ "酒店-地址": datasets.Value("string"),
269
+ "酒店-电话号码": datasets.Value("string"),
270
+ "酒店-评分": datasets.Value("string"),
271
+ "电脑-品牌": datasets.Value("string"),
272
+ "电脑-产品类别": datasets.Value("string"),
273
+ "电脑-分类": datasets.Value("string"),
274
+ "电脑-内存容量": datasets.Value("string"),
275
+ "电脑-屏幕尺寸": datasets.Value("string"),
276
+ "电脑-CPU": datasets.Value("string"),
277
+ "电脑-价格区间": datasets.Value("string"),
278
+ "电脑-系列": datasets.Value("string"),
279
+ "电脑-商品名称": datasets.Value("string"),
280
+ "电脑-系统": datasets.Value("string"),
281
+ "电脑-游戏性能": datasets.Value("string"),
282
+ "电脑-CPU型号": datasets.Value("string"),
283
+ "电脑-裸机重量": datasets.Value("string"),
284
+ "电脑-显卡类别": datasets.Value("string"),
285
+ "电脑-显卡型号": datasets.Value("string"),
286
+ "电脑-特性": datasets.Value("string"),
287
+ "电脑-色系": datasets.Value("string"),
288
+ "电脑-待机时长": datasets.Value("string"),
289
+ "电脑-硬盘容量": datasets.Value("string"),
290
+ "电脑-价格": datasets.Value("string"),
291
+ "火车-出发地": datasets.Value("string"),
292
+ "火车-目的地": datasets.Value("string"),
293
+ "火车-日期": datasets.Value("string"),
294
+ "火车-车型": datasets.Value("string"),
295
+ "火车-坐席": datasets.Value("string"),
296
+ "火车-车次信息": datasets.Value("string"),
297
+ "火车-时长": datasets.Value("string"),
298
+ "火车-出发时间": datasets.Value("string"),
299
+ "火车-到达时间": datasets.Value("string"),
300
+ "火车-票价": datasets.Value("string"),
301
+ "飞机-出发地": datasets.Value("string"),
302
+ "飞机-目的地": datasets.Value("string"),
303
+ "飞机-日期": datasets.Value("string"),
304
+ "飞机-舱位档次": datasets.Value("string"),
305
+ "飞机-航班信息": datasets.Value("string"),
306
+ "飞机-起飞时间": datasets.Value("string"),
307
+ "飞机-到达时间": datasets.Value("string"),
308
+ "飞机-票价": datasets.Value("string"),
309
+ "飞机-准点率": datasets.Value("string"),
310
+ "天气-城市": datasets.Value("string"),
311
+ "天气-日期": datasets.Value("string"),
312
+ "天气-天气": datasets.Value("string"),
313
+ "天气-温度": datasets.Value("string"),
314
+ "天气-风力风向": datasets.Value("string"),
315
+ "天气-紫外线强度": datasets.Value("string"),
316
+ "电影-制片国家/地区": datasets.Value("string"),
317
+ "电影-类型": datasets.Value("string"),
318
+ "电影-年代": datasets.Value("string"),
319
+ "电影-主演": datasets.Value("string"),
320
+ "电影-导演": datasets.Value("string"),
321
+ "电影-片名": datasets.Value("string"),
322
+ "电影-主演名单": datasets.Value("string"),
323
+ "电影-具体上映时间": datasets.Value("string"),
324
+ "电影-片长": datasets.Value("string"),
325
+ "电影-豆瓣评分": datasets.Value("string"),
326
+ "电视剧-制片国家/地区": datasets.Value("string"),
327
+ "电视剧-类型": datasets.Value("string"),
328
+ "电视剧-年代": datasets.Value("string"),
329
+ "电视剧-主演": datasets.Value("string"),
330
+ "电视剧-导演": datasets.Value("string"),
331
+ "电视剧-片名": datasets.Value("string"),
332
+ "电视剧-主演名单": datasets.Value("string"),
333
+ "电视剧-首播时间": datasets.Value("string"),
334
+ "电视剧-集数": datasets.Value("string"),
335
+ "电视剧-单集片长": datasets.Value("string"),
336
+ "电视剧-豆瓣评分": datasets.Value("string"),
337
+ "辅导班-班号": datasets.Value("string"),
338
+ "辅导班-难度": datasets.Value("string"),
339
+ "辅导班-科目": datasets.Value("string"),
340
+ "辅导班-年级": datasets.Value("string"),
341
+ "辅导班-区域": datasets.Value("string"),
342
+ "辅导班-校区": datasets.Value("string"),
343
+ "辅导班-上课方式": datasets.Value("string"),
344
+ "辅导班-开始日期": datasets.Value("string"),
345
+ "辅导班-结束日期": datasets.Value("string"),
346
+ "辅导班-每周": datasets.Value("string"),
347
+ "辅导班-上课时间": datasets.Value("string"),
348
+ "辅导班-下课时间": datasets.Value("string"),
349
+ "辅导班-时段": datasets.Value("string"),
350
+ "辅导班-课次": datasets.Value("string"),
351
+ "辅导班-课时": datasets.Value("string"),
352
+ "辅导班-教室地点": datasets.Value("string"),
353
+ "辅导班-教师": datasets.Value("string"),
354
+ "辅导班-价格": datasets.Value("string"),
355
+ "辅导班-课程网址": datasets.Value("string"),
356
+ "辅导班-教师网址": datasets.Value("string"),
357
+ "汽车-名称": datasets.Value("string"),
358
+ "汽车-车型": datasets.Value("string"),
359
+ "汽车-级别": datasets.Value("string"),
360
+ "汽车-座位数": datasets.Value("string"),
361
+ "汽车-车身尺寸(mm)": datasets.Value("string"),
362
+ "汽车-厂商": datasets.Value("string"),
363
+ "汽车-能源类型": datasets.Value("string"),
364
+ "汽车-发动机排量(L)": datasets.Value("string"),
365
+ "汽车-发动机马力(Ps)": datasets.Value("string"),
366
+ "汽车-驱动方式": datasets.Value("string"),
367
+ "汽车-综合油耗(L/100km)": datasets.Value("string"),
368
+ "汽车-环保标准": datasets.Value("string"),
369
+ "汽车-驾驶辅助影像": datasets.Value("string"),
370
+ "汽车-巡航系统": datasets.Value("string"),
371
+ "汽车-价格(万元)": datasets.Value("string"),
372
+ "汽车-车系": datasets.Value("string"),
373
+ "汽车-动力水平": datasets.Value("string"),
374
+ "汽车-油耗水平": datasets.Value("string"),
375
+ "汽车-倒车影像": datasets.Value("string"),
376
+ "汽车-定速巡航": datasets.Value("string"),
377
+ "汽车-座椅加热": datasets.Value("string"),
378
+ "汽车-座椅通风": datasets.Value("string"),
379
+ "汽车-所属价格区间": datasets.Value("string"),
380
+ "医院-名称": datasets.Value("string"),
381
+ "医院-等级": datasets.Value("string"),
382
+ "医院-类别": datasets.Value("string"),
383
+ "医院-性质": datasets.Value("string"),
384
+ "医院-区域": datasets.Value("string"),
385
+ "医院-地址": datasets.Value("string"),
386
+ "医院-电话": datasets.Value("string"),
387
+ "医院-挂号时间": datasets.Value("string"),
388
+ "医院-门诊时间": datasets.Value("string"),
389
+ "医院-公交线路": datasets.Value("string"),
390
+ "医院-地铁可达": datasets.Value("string"),
391
+ "医院-地铁线路": datasets.Value("string"),
392
+ "医院-重点科室": datasets.Value("string"),
393
+ "医院-CT": datasets.Value("string"),
394
+ "医院-3.0T MRI": datasets.Value("string"),
395
+ "医院-DSA": datasets.Value("string"),
396
+ },
397
+ "turn request": datasets.Sequence(datasets.Value("string"))
398
+ },
399
+ "user_actions": datasets.Sequence(datasets.Sequence(datasets.Value("string"))),
400
+ "system_actions": datasets.Sequence(datasets.Sequence(datasets.Value("string"))),
401
+ "db_results": datasets.Sequence(datasets.Value("string")),
402
+ "segmented_user_utterance": datasets.Value("string"),
403
+ "segmented_system_utterance": datasets.Value("string")
404
+ }
405
+ ]
406
+ }
407
+ )
408
+
409
+ return datasets.DatasetInfo(
410
+ # This is the description that will appear on the datasets page.
411
+ description=_DESCRIPTION,
412
+ # This defines the different columns of the dataset and their types
413
+ features=features, # Here we define them above because they are different between the two configurations
414
+ # If there's a common (input, target) tuple from the features,
415
+ # specify them here. They'll be used if as_supervised=True in
416
+ # builder.as_dataset.
417
+ supervised_keys=None,
418
+ # Homepage of the dataset for documentation
419
+ homepage=_HOMEPAGE,
420
+ # License for the dataset if available
421
+ license=_LICENSE,
422
+ # Citation for the dataset
423
+ citation=_CITATION,
424
+ )
425
+
426
+ def _split_generators(self, dl_manager):
427
+ """Returns SplitGenerators."""
428
+
429
+ # dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLs
430
+ # It can accept any type or nested list/dict and will give back the same structure with the url replaced with path to local files.
431
+ # By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
432
+ _URL = {"train": "train.json", "test": "test.json", "dev": "dev.json"}
433
+
434
+ data_dir2 = dl_manager.download_and_extract(_URL)
435
+
436
+ return [
437
+ datasets.SplitGenerator(
438
+ name=datasets.Split.TRAIN,
439
+ # These kwargs will be passed to _generate_examples
440
+ gen_kwargs={
441
+ # "filepath": os.path.join(data_dir, "train.json"),
442
+ "filepath": data_dir2["train"],
443
+ "split": "train",
444
+ },
445
+ ),
446
+ datasets.SplitGenerator(
447
+ name=datasets.Split.TEST,
448
+ # These kwargs will be passed to _generate_examples
449
+ gen_kwargs={
450
+ "filepath": data_dir2["test"],
451
+ "split": "test"
452
+ },
453
+ ),
454
+ datasets.SplitGenerator(
455
+ name=datasets.Split.VALIDATION,
456
+ # These kwargs will be passed to _generate_examples
457
+ gen_kwargs={
458
+ "filepath": data_dir2["dev"],
459
+ "split": "dev",
460
+ },
461
+ ),
462
+ ]
463
+
464
+ def _generate_examples(
465
+ self, filepath, split # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
466
+ ):
467
+ """ Yields examples as (key, example) tuples. """
468
+ # This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
469
+ # The `key` is here for legacy reason (tfds) and is not important in itself.
470
+ empty_belief_state = ["旅游景点-名称", "旅游景点-区域", "旅游景点-景点类型", "旅游景点-最适合人群", "旅游景点-消费", "旅游景点-是否地铁直达", "旅游景点-门票价格", "旅游景点-电话号码", "旅游景点-地址", "旅游景点-评分", "旅游景点-开放时间", "旅游景点-特点", "餐厅-名称", "餐厅-区域", "餐厅-菜系", "餐厅-价位", "餐厅-是否地铁直达", "餐厅-人均消费", "餐厅-地址", "餐厅-电话号码", "餐厅-评分", "餐厅-营业时间", "餐厅-推荐菜", "酒店-名称", "酒店-区域", "酒店-星级", "酒店-价位", "酒店-酒店类型", "酒店-房型", "酒店-停车场", "酒店-房费", "酒店-地址", "酒店-电话号码", "酒店-评分", "电脑-品牌", "电脑-产品类别", "电脑-分类", "电脑-内存容量", "电脑-屏幕尺寸", "电脑-CPU", "电脑-价格区间", "电脑-系列", "电脑-商品名称", "电脑-系统", "电脑-游戏性能", "电脑-CPU型号", "电脑-裸机重量", "电脑-显卡类别", "电脑-显卡型号", "电脑-特性", "电脑-色系", "电脑-待机时长", "电脑-硬盘容量", "电脑-价格", "火车-出发地", "火车-目的地", "火车-日期", "火车-车型", "火车-坐席", "火车-车次信息", "火车-时长", "火车-出发时间", "火车-到达时间", "火车-票价", "飞机-出发地", "飞机-目的地", "飞机-日期", "飞机-舱位档次", "飞机-航班信息", "飞机-起飞时间", "飞机-到达时间", "飞机-票价", "飞机-准点率", "天气-城市", "天气-日期", "天气-天气", "天气-温度", "天气-风力风向", "天气-紫外线强度", "电影-制片国家/地区", "电影-类型", "电影-年代", "电影-主演", "电影-导演", "电影-片名", "电影-主演名单", "电影-具体上映时间", "电影-片长", "电影-豆瓣评分", "电视剧-制片国家/地区", "电视剧-类型", "电视剧-年代", "电视剧-主演", "电视剧-导演", "电视剧-片名", "电视剧-主演名单", "电视剧-首播时间", "电视剧-集数", "电视剧-单集片长", "电视剧-豆瓣评分", "辅导班-班号", "辅导班-难度", "辅导班-科目", "辅导班-年级", "辅导班-区域", "辅导班-校区", "辅导班-上课方式", "辅导班-开始日期", "辅导班-结束日期", "辅导班-每周", "辅导班-上课时间", "辅导班-下课时间", "辅导班-时段", "辅导班-课次", "辅导班-课时", "辅导班-教室地点", "辅导班-教师", "辅导班-价格", "辅导班-课程网址", "辅导班-教师网址", "汽车-名称", "汽车-车型", "汽车-级别", "汽车-座位数", "汽车-车身尺寸(mm)", "汽车-厂商", "汽车-能源类型", "汽车-发动机排量(L)", "汽车-发动机马力(Ps)", "汽车-驱动方式", "汽车-综合油耗(L/100km)", "汽车-环保标准", "汽车-驾驶辅助影像", "汽车-巡航系统", "汽车-价格(万元)", "汽车-车系", "汽车-动力水平", "汽车-油耗水平", "汽车-倒车影像", "汽车-定速巡航", "汽车-座椅加热", "汽车-座椅通风", "汽车-所属价格区间", "医院-名称", "医院-等级", "医院-类别", "医院-性质", "医院-区域", "医院-地址", "医院-电话", "医院-挂号时间", "医院-门诊时间", "医院-公交线路", "医院-地铁可达", "医院-地铁线路", "医院-重点科室", "医院-CT", "医院-3.0T MRI", "医院-DSA"]
471
+
472
+ with open(filepath, encoding="utf-8") as f:
473
+ all_data = json.load(f)
474
+ id_ = 0
475
+ for data in all_data:
476
+ for slot in empty_belief_state:
477
+ for dia in data["dialogue"]:
478
+ if slot not in dia["belief_state"]["inform slot-values"]:
479
+ dia["belief_state"]["inform slot-values"][slot] = ""
480
+ if slot not in dia["belief_state"]["turn_inform"]:
481
+ dia["belief_state"]["turn_inform"][slot] = ""
482
+
483
+ yield id_, {
484
+ "dialogue_id": data["dialogue_id"],
485
+ "goal": data["goal"],
486
+ "domains": data["domains"],
487
+ "dialogue": data["dialogue"]
488
+ }
489
+ id_ += 1