system HF staff commited on
Commit
88c0185
0 Parent(s):

Update files from the datasets library (from 1.2.0)

Browse files

Release notes: https://github.com/huggingface/datasets/releases/tag/1.2.0

.gitattributes ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bin.* filter=lfs diff=lfs merge=lfs -text
5
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.model filter=lfs diff=lfs merge=lfs -text
12
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
13
+ *.onnx filter=lfs diff=lfs merge=lfs -text
14
+ *.ot filter=lfs diff=lfs merge=lfs -text
15
+ *.parquet filter=lfs diff=lfs merge=lfs -text
16
+ *.pb filter=lfs diff=lfs merge=lfs -text
17
+ *.pt filter=lfs diff=lfs merge=lfs -text
18
+ *.pth filter=lfs diff=lfs merge=lfs -text
19
+ *.rar filter=lfs diff=lfs merge=lfs -text
20
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
21
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
22
+ *.tflite filter=lfs diff=lfs merge=lfs -text
23
+ *.tgz filter=lfs diff=lfs merge=lfs -text
24
+ *.xz filter=lfs diff=lfs merge=lfs -text
25
+ *.zip filter=lfs diff=lfs merge=lfs -text
26
+ *.zstandard filter=lfs diff=lfs merge=lfs -text
27
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,546 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ annotations_creators:
3
+ - expert-generated
4
+ language_creators:
5
+ - found
6
+ languages:
7
+ - en
8
+ licenses:
9
+ - cc-by-3-0
10
+ multilinguality:
11
+ - monolingual
12
+ size_categories:
13
+ - 1K<n<10K
14
+ source_datasets:
15
+ - original
16
+ task_categories:
17
+ - question-answering
18
+ task_ids:
19
+ - closed-domain-qa
20
+ ---
21
+
22
+ # Dataset Card for doc2dial
23
+
24
+ ## Table of Contents
25
+ - [Dataset Description](#dataset-description)
26
+ - [Dataset Summary](#dataset-summary)
27
+ - [Supported Tasks](#supported-tasks-and-leaderboards)
28
+ - [Languages](#languages)
29
+ - [Dataset Structure](#dataset-structure)
30
+ - [Data Instances](#data-instances)
31
+ - [Data Fields](#data-instances)
32
+ - [Data Splits](#data-instances)
33
+ - [Dataset Creation](#dataset-creation)
34
+ - [Curation Rationale](#curation-rationale)
35
+ - [Source Data](#source-data)
36
+ - [Annotations](#annotations)
37
+ - [Personal and Sensitive Information](#personal-and-sensitive-information)
38
+ - [Considerations for Using the Data](#considerations-for-using-the-data)
39
+ - [Social Impact of Dataset](#social-impact-of-dataset)
40
+ - [Discussion of Biases](#discussion-of-biases)
41
+ - [Other Known Limitations](#other-known-limitations)
42
+ - [Additional Information](#additional-information)
43
+ - [Dataset Curators](#dataset-curators)
44
+ - [Licensing Information](#licensing-information)
45
+ - [Citation Information](#citation-information)
46
+
47
+ ## Dataset Description
48
+
49
+ - **Homepage:** https://doc2dial.github.io/file/doc2dial/
50
+ - **Repository:** [Needs More Information]
51
+ - **Paper:** https://www.aclweb.org/anthology/2020.emnlp-main.652.pdf
52
+ - **Leaderboard:**
53
+ - **Point of Contact:** kmfoda@gmai.com
54
+
55
+ ### Dataset Summary
56
+
57
+ Doc2dial is dataset of goal-oriented dialogues that are grounded in the associated documents. It includes over 4500 annotated conversations with an average of 14 turns that are grounded in over 450 documents from four domains. Compared to the prior document-grounded dialogue datasets this dataset covers a variety of dialogue scenes in information-seeking conversations.
58
+
59
+ ### Supported Tasks and Leaderboards
60
+
61
+ [More Information Needed]
62
+
63
+ ### Languages
64
+
65
+ English
66
+
67
+ ## Dataset Structure
68
+
69
+ ### Data Instances
70
+
71
+ Sample data instance for `dialogue_domain` :
72
+
73
+ ```
74
+ {
75
+ "dial_id": "9f44c1539efe6f7e79b02eb1b413aa43",
76
+ "doc_id": "Top 5 DMV Mistakes and How to Avoid Them#3_0",
77
+ "domain": "dmv",
78
+ "turns": [
79
+ {
80
+ "da": "assert/provide/precondition_pos",
81
+ "reference": [
82
+ {
83
+ "keys": "4",
84
+ "values": "['precondition']"
85
+ }
86
+ ],
87
+ "role": "user",
88
+ "turn_id": 1,
89
+ "utterance": "Hello, I forgot o update my address, can you help me with that?"
90
+ },
91
+ {
92
+ "da": "respond/reply/open",
93
+ "reference": [
94
+ {
95
+ "keys": "6",
96
+ "values": "['solution']"
97
+ },
98
+ {
99
+ "keys": "7",
100
+ "values": "['solution']"
101
+ },
102
+ {
103
+ "keys": "4",
104
+ "values": "['reference']"
105
+ }
106
+ ],
107
+ "role": "agent",
108
+ "turn_id": 2,
109
+ "utterance": "hi, you have to report any change of address to DMV within 10 days after moving. You should do this both for the address associated with your license and all the addresses associated with all your vehicles."
110
+ },
111
+ {
112
+ "da": "request/query/open",
113
+ "reference": [
114
+ {
115
+ "keys": "56",
116
+ "values": "['solution']"
117
+ },
118
+ {
119
+ "keys": "48",
120
+ "values": "['reference']"
121
+ }
122
+ ],
123
+ "role": "user",
124
+ "turn_id": 3,
125
+ "utterance": "Can I do my DMV transactions online?"
126
+ },
127
+ {
128
+ "da": "respond/reply/open",
129
+ "reference": [
130
+ {
131
+ "keys": "56",
132
+ "values": "['solution']"
133
+ },
134
+ {
135
+ "keys": "48",
136
+ "values": "['reference']"
137
+ }
138
+ ],
139
+ "role": "agent",
140
+ "turn_id": 4,
141
+ "utterance": "Yes, you can sign up for MyDMV for all the online transactions needed."
142
+ },
143
+ {
144
+ "da": "request/query/open",
145
+ "reference": [
146
+ {
147
+ "keys": "48",
148
+ "values": "['precondition']"
149
+ }
150
+ ],
151
+ "role": "user",
152
+ "turn_id": 5,
153
+ "utterance": "Thanks, and in case I forget to bring all of the documentation needed to the DMV office, what can I do?"
154
+ },
155
+ {
156
+ "da": "respond/reply/open",
157
+ "reference": [
158
+ {
159
+ "keys": "49",
160
+ "values": "['solution']"
161
+ },
162
+ {
163
+ "keys": "50",
164
+ "values": "['solution']"
165
+ },
166
+ {
167
+ "keys": "52",
168
+ "values": "['solution']"
169
+ },
170
+ {
171
+ "keys": "48",
172
+ "values": "['reference']"
173
+ }
174
+ ],
175
+ "role": "agent",
176
+ "turn_id": 6,
177
+ "utterance": "This happens often with our customers so that's why our website and MyDMV are so useful for our customers. Just check if you can make your transaction online so you don't have to go to the DMV Office."
178
+ },
179
+ {
180
+ "da": "request/query/follow-up",
181
+ "reference": [
182
+ {
183
+ "keys": "6",
184
+ "values": "['solution']"
185
+ },
186
+ {
187
+ "keys": "7",
188
+ "values": "['solution']"
189
+ },
190
+ {
191
+ "keys": "4",
192
+ "values": "['reference']"
193
+ }
194
+ ],
195
+ "role": "user",
196
+ "turn_id": 7,
197
+ "utterance": "Ok, and can you tell me again where should I report my new address?"
198
+ },
199
+ {
200
+ "da": "respond/reply/open",
201
+ "reference": [
202
+ {
203
+ "keys": "6",
204
+ "values": "['solution']"
205
+ },
206
+ {
207
+ "keys": "7",
208
+ "values": "['solution']"
209
+ },
210
+ {
211
+ "keys": "4",
212
+ "values": "['reference']"
213
+ }
214
+ ],
215
+ "role": "agent",
216
+ "turn_id": 8,
217
+ "utterance": "Sure. Any change of address must be reported to the DMV, that's for the address associated with your license and any of your vehicles."
218
+ },
219
+ {
220
+ "da": "request/query/open",
221
+ "reference": [
222
+ {
223
+ "keys": "40",
224
+ "values": "['precondition']"
225
+ }
226
+ ],
227
+ "role": "user",
228
+ "turn_id": 9,
229
+ "utterance": "Can you tell me more about Traffic points and their cost?"
230
+ },
231
+ {
232
+ "da": "respond/reply/open",
233
+ "reference": [
234
+ {
235
+ "keys": "41",
236
+ "values": "['solution']"
237
+ },
238
+ {
239
+ "keys": "43",
240
+ "values": "['solution']"
241
+ },
242
+ {
243
+ "keys": "40",
244
+ "values": "['reference']"
245
+ }
246
+ ],
247
+ "role": "agent",
248
+ "turn_id": 10,
249
+ "utterance": "Traffic points is the system used by DMV to track dangerous drivers. The cost of the traffic points is independent of the DRA, so you get a separate charge based on the total points you accumulate."
250
+ }
251
+ ]
252
+ }
253
+ ```
254
+
255
+
256
+
257
+ Sample data instance for `document_domain` :
258
+
259
+ ```
260
+ {
261
+ "doc_id": "Benefits Planner: Retirement | Online Calculator (WEP Version)#1_0",
262
+ "domain": "ssa",
263
+ "doc_html_raw": "<main class=\"content\" id=\"content\" role=\"main\">\n\n<section>\n\n<div>\n<h2>\nBenefits Planner: Retirement\n</h2>\n</div>\n</section>\n\n\n<section>\n\n<div>\n\n<div>\n\n\n</div>\n\n<article>\n<section>\n\n<h3>Online Calculator (WEP Version)</h3>\n<p>The calculator shown below allows you to estimate your Social Security benefit.\nHowever, for the most accurate estimates, <a>use the Detailed Calculator</a>.</p>\n<p>You need to enter all your past earnings\n, which are shown on your <a>online </a>.</p>\n\n<p>Please Note:</p>\n<ul class=\"browser-default\">\n<li>The Online Calculator is updated periodically<span>*</span> with new benefit increases and other benefit amounts. Therefore, it is likely that your benefit estimates in the future will differ from those calculated today.</li>\n<li>The Online Calculator works on PCs and Macs with Javascript enabled.</li>\n<li>Some browsers may not allow you to print the table below. </li>\n</ul>\n<p></p>\n\n<div>\nThe Online Calculator temporarily stores information on your local computer while your browser is open. To protect your personal information, you should close your browser after you have finished your estimate.\n</div>\n<p></p>\n\n<div>\n<p>Note: If your birthday is on January 1st, we figure your benefit as if your birthday was in the previous year.</p>\n<p>If you qualify for benefits as a Survivor, your <a>full retirement age for survivors benefits</a> may be different.</p></div>\n\n<div>\n</div></section></article></div></section></main>",
264
+ "doc_html_ts": "<main><section><div><h2 sent_id=\"1\" text_id=\"1\">Benefits Planner: Retirement</h2></div></section><section><div><article><section><h3 sent_id=\"2\" text_id=\"2\">Online Calculator (WEP Version)</h3><div tag_id=\"1\"><u sent_id=\"3\" tag_id=\"1\"><u sent_id=\"3\" tag_id=\"1\" text_id=\"3\">The calculator shown below allows you to estimate your Social Security benefit .</u></u><u sent_id=\"4\" tag_id=\"1\"><u sent_id=\"4\" tag_id=\"1\" text_id=\"4\">However ,</u><u sent_id=\"4\" tag_id=\"1\" text_id=\"5\">for the most accurate estimates ,</u><u sent_id=\"4\" tag_id=\"1\" text_id=\"6\">use the Detailed Calculator .</u></u></div><div tag_id=\"2\"><u sent_id=\"5\" tag_id=\"2\"><u sent_id=\"5\" tag_id=\"2\" text_id=\"7\">You need to enter all your past earnings , which are shown on your online .</u></u></div><div tag_id=\"3\"><u sent_id=\"6\" tag_id=\"3\"><u sent_id=\"6\" tag_id=\"3\" text_id=\"8\">Please Note:</u></u></div><ul class=\"browser-default\" tag_id=\"3\"><li tag_id=\"3\"><div tag_id=\"3\"><u sent_id=\"9\" tag_id=\"3\"><u sent_id=\"9\" tag_id=\"3\" text_id=\"9\">The Online Calculator is updated periodically * with new benefit increases and other benefit amounts .</u></u><u sent_id=\"10\" tag_id=\"3\"><u sent_id=\"10\" tag_id=\"3\" text_id=\"10\">Therefore ,</u><u sent_id=\"10\" tag_id=\"3\" text_id=\"11\">it is likely that your benefit estimates in the future will differ from those calculated today .</u></u></div></li><li tag_id=\"3\"><u sent_id=\"11\" tag_id=\"3\"><u sent_id=\"11\" tag_id=\"3\" text_id=\"12\">The Online Calculator works on PCs and Macs with Javascript enabled .</u></u></li><li tag_id=\"3\"><u sent_id=\"12\" tag_id=\"3\"><u sent_id=\"12\" tag_id=\"3\" text_id=\"13\">Some browsers may not allow you to print the table below .</u></u></li></ul><div>The Online Calculator temporarily stores information on your local computer while your browser is open. To protect your personal information, you should close your browser after you have finished your estimate.</div><div><div tag_id=\"4\"><u sent_id=\"13\" tag_id=\"4\"><u sent_id=\"13\" tag_id=\"4\" text_id=\"14\">Note:</u></u><u sent_id=\"14\" tag_id=\"4\"><u sent_id=\"14\" tag_id=\"4\" text_id=\"15\">If your birthday is on January 1st ,</u><u sent_id=\"14\" tag_id=\"4\" text_id=\"16\">we figure your benefit as if your birthday was in the previous year .</u></u></div><div tag_id=\"5\"><u sent_id=\"15\" tag_id=\"5\"><u sent_id=\"15\" tag_id=\"5\" text_id=\"17\">If you qualify for benefits as a Survivor ,</u><u sent_id=\"15\" tag_id=\"5\" text_id=\"18\">your full retirement age for survivors benefits may be different .</u></u></div></div></section></article></div></section></main>",
265
+ "doc_text": "\n\nBenefits Planner: Retirement \n\n\nOnline Calculator (WEP Version) \nThe calculator shown below allows you to estimate your Social Security benefit. However , for the most accurate estimates , use the Detailed Calculator. You need to enter all your past earnings, which are shown on your online. Please Note: The Online Calculator is updated periodically * with new benefit increases and other benefit amounts. Therefore , it is likely that your benefit estimates in the future will differ from those calculated today. The Online Calculator works on PCs and Macs with Javascript enabled. Some browsers may not allow you to print the table below. Note: If your birthday is on January 1st , we figure your benefit as if your birthday was in the previous year. If you qualify for benefits as a Survivor , your full retirement age for survivors benefits may be different. ",
266
+ "title": "Benefits Planner: Retirement | Online Calculator (WEP Version)#1",
267
+ "spans": [
268
+ {
269
+ "end_sec": 32,
270
+ "end_sp": 32,
271
+ "id_sec": "t_0",
272
+ "id_sp": "1",
273
+ "parent_titles": "[]",
274
+ "start_sec": 0,
275
+ "start_sp": 0,
276
+ "tag": "h2",
277
+ "text_sec": "\n\nBenefits Planner: Retirement \n",
278
+ "text_sp": "\n\nBenefits Planner: Retirement \n",
279
+ "title": "Benefits Planner: Retirement"
280
+ },
281
+ {
282
+ "end_sec": 67,
283
+ "end_sp": 67,
284
+ "id_sec": "t_1",
285
+ "id_sp": "2",
286
+ "parent_titles": "[{'id_sp': '1', 'text': 'Benefits Planner: Retirement', 'level': 'h2'}]",
287
+ "start_sec": 32,
288
+ "start_sp": 32,
289
+ "tag": "h3",
290
+ "text_sec": "\n\nOnline Calculator (WEP Version) \n",
291
+ "text_sp": "\n\nOnline Calculator (WEP Version) \n",
292
+ "title": "Online Calculator (WEP Version)"
293
+ },
294
+ {
295
+ "end_sec": 220,
296
+ "end_sp": 147,
297
+ "id_sec": "1",
298
+ "id_sp": "3",
299
+ "parent_titles": "[]",
300
+ "start_sec": 67,
301
+ "start_sp": 67,
302
+ "tag": "u",
303
+ "text_sec": "The calculator shown below allows you to estimate your Social Security benefit. However , for the most accurate estimates , use the Detailed Calculator. ",
304
+ "text_sp": "The calculator shown below allows you to estimate your Social Security benefit. ",
305
+ "title": "Online Calculator (WEP Version)"
306
+ }
307
+ ]
308
+ }
309
+ ```
310
+
311
+ Sample data instance for `doc2dial_rc` :
312
+
313
+ ```
314
+ {
315
+ "id": "78f72b08b43791a4a70363fe62b8de08_1",
316
+ "is_impossible": false,
317
+ "question": "Hello, I want to know about the retirement plan.",
318
+ "answers": {
319
+ "sp_id": [
320
+ [
321
+ "1",
322
+ "2"
323
+ ]
324
+ ],
325
+ "answer_end": [
326
+ 67
327
+ ],
328
+ "answer_start": [
329
+ 0
330
+ ],
331
+ "text": [
332
+ "\n\nBenefits Planner: Retirement \n\n\nOnline Calculator (WEP Version) \n"
333
+ ]
334
+ },
335
+ "doc_context": "\n\nBenefits Planner: Retirement \n\n\nOnline Calculator (WEP Version) \nThe calculator shown below allows you to estimate your Social Security benefit. However , for the most accurate estimates , use the Detailed Calculator. You need to enter all your past earnings, which are shown on your online. Please Note: The Online Calculator is updated periodically * with new benefit increases and other benefit amounts. Therefore , it is likely that your benefit estimates in the future will differ from those calculated today. The Online Calculator works on PCs and Macs with Javascript enabled. Some browsers may not allow you to print the table below. Note: If your birthday is on January 1st , we figure your benefit as if your birthday was in the previous year. If you qualify for benefits as a Survivor , your full retirement age for survivors benefits may be different. ",
336
+ "dial_context": {
337
+ "da": [
338
+ "request/query/open"
339
+ ],
340
+ "references": [
341
+ {
342
+ "sp_id": [
343
+ [
344
+ "1"
345
+ ]
346
+ ],
347
+ "answer_end": [
348
+ 32
349
+ ],
350
+ "answer_start": [
351
+ 0
352
+ ],
353
+ "text": [
354
+ "\n\nBenefits Planner: Retirement \n"
355
+ ]
356
+ }
357
+ ],
358
+ "role": [
359
+ "user"
360
+ ],
361
+ "turn_id": [
362
+ 1
363
+ ],
364
+ "utterance": [
365
+ "Hello, I want to know about the retirement plan."
366
+ ]
367
+ },
368
+ "end_candidates": [
369
+ 32,
370
+ 67,
371
+ 147,
372
+ 157,
373
+ 191,
374
+ 220,
375
+ 294,
376
+ 307,
377
+ 409,
378
+ 421,
379
+ 517,
380
+ 586,
381
+ 644,
382
+ 650,
383
+ 687,
384
+ 756,
385
+ 800,
386
+ 866
387
+ ],
388
+ "start_candidates": [
389
+ 0,
390
+ 32,
391
+ 67,
392
+ 147,
393
+ 157,
394
+ 191,
395
+ 220,
396
+ 294,
397
+ 307,
398
+ 409,
399
+ 421,
400
+ 517,
401
+ 586,
402
+ 644,
403
+ 650,
404
+ 687,
405
+ 756,
406
+ 800
407
+ ],
408
+ "title": "Benefits Planner: Retirement | Online Calculator (WEP Version)#1_0",
409
+ "domain": "ssa"
410
+ }
411
+ ```
412
+
413
+
414
+
415
+
416
+
417
+
418
+
419
+ ### Data Fields
420
+
421
+ For `document_domain`,
422
+
423
+ - `doc_id`: the ID of a document;
424
+ - `title`: the title of the document;
425
+ - `domain`: the domain of the document;
426
+ - `doc_text`: the text content of the document (without HTML markups);
427
+ - `doc_html_ts`: the document content with HTML markups and the annotated spans that are indicated by `text_id` attribute, which corresponds to `id_sp`.
428
+ - `doc_html_raw`: the document content with HTML markups and without span annotations.
429
+ - `spans`: key-value pairs of all spans in the document, with `id_sp` as key. Each span includes the following,
430
+ - `id_sp`: the id of a span as noted by `text_id` in `doc_html_ts`;
431
+ - `start_sp`/ `end_sp`: the start/end position of the text span in `doc_text`;
432
+ - `text_sp`: the text content of the span.
433
+ - `id_sec`: the id of the (sub)section (e.g. `<p>`) or title (`<h2>`) that contains the span.
434
+ - `start_sec` / `end_sec`: the start/end position of the (sub)section in `doc_text`.
435
+ - `text_sec`: the text of the (sub)section.
436
+ - `title`: the title of the (sub)section.
437
+ - `parent_titles`: the parent titles of the `title`.
438
+
439
+
440
+
441
+ For `dialogue_domain`:
442
+
443
+ - `dial_id`: the ID of a dialogue;
444
+ - `doc_id`: the ID of the associated document;
445
+ - `domain`: domain of the document;
446
+ - `turns`: a list of dialogue turns. Each turn includes,
447
+ - `turn_id`: the time order of the turn;
448
+ - `role`: either "agent" or "user";
449
+ - `da`: dialogue act;
450
+ - `reference`: the grounding span (`id_sp`) in the associated document. If a turn is an irrelevant turn, i.e., `da` ends with "ood", `reference` is empty. **Note** that spans with labels "*precondition*"/"*solution*" are the actual grounding spans. Spans with label "*reference*" are the related titles or contextual reference, which is used for the purpose of describing a dialogue scene better to crowd contributors.
451
+ - `utterance`: the human-generated utterance based on the dialogue scene.
452
+
453
+
454
+
455
+ For `doc2dial_rc`,
456
+
457
+ - `id`: the ID of a QA instance;
458
+ - `question`: user query;
459
+ - `is_impossible`: if the question is answerable;
460
+ - `answers`: the answers that are grounded in the associated document;
461
+ - `sp_id`: the ID of a document span as the grounding of an answer;
462
+ - `answer_start` / `answer_end`: the start / end position of the grounding span in the associated document (`doc_context`);
463
+ - `text`: the text content of the grounding span;
464
+ - `dial_context`: the dialogue history;
465
+ - `turn_id`: the time order of the turn;
466
+ - `role`: either "agent" or "user";
467
+ - `da`: dialogue act;
468
+ - `utterance`: the human-generated utterance based on the dialogue scene.
469
+ - `references`: the grounding spans (same as `answers`).
470
+ - `title`: the title of the associated document;
471
+ - `domain`: the domain of the associated document;
472
+ - `doc_context`: the text content of the associated document (without HTML markups);
473
+ - `start_candidates` / `end_candidates`: the candidates of the start / end positions of the grounding spans.
474
+
475
+
476
+
477
+ ### Data Splits
478
+
479
+ Training & dev split for dialogue domain
480
+ Training split only for document domain
481
+
482
+ ## Dataset Creation
483
+
484
+ ### Curation Rationale
485
+
486
+ [More Information Needed]
487
+
488
+ ### Source Data
489
+
490
+ #### Initial Data Collection and Normalization
491
+
492
+ [More Information Needed]
493
+
494
+ #### Who are the source language producers?
495
+
496
+ [More Information Needed]
497
+
498
+ ### Annotations
499
+
500
+ #### Annotation process
501
+
502
+ [More Information Needed]
503
+
504
+ #### Who are the annotators?
505
+
506
+ [More Information Needed]
507
+
508
+ ### Personal and Sensitive Information
509
+
510
+ [More Information Needed]
511
+
512
+ ## Considerations for Using the Data
513
+
514
+ ### Social Impact of Dataset
515
+
516
+ [More Information Needed]
517
+
518
+ ### Discussion of Biases
519
+
520
+ [More Information Needed]
521
+
522
+ ### Other Known Limitations
523
+
524
+ [More Information Needed]
525
+
526
+ ## Additional Information
527
+
528
+ ### Dataset Curators
529
+
530
+ Song Feng, Hui Wan, Chulaka Gunasekara, Siva Sankalp Patel,Sachindra Joshi. Luis A. Lastras
531
+
532
+ ### Licensing Information
533
+
534
+ Creative Commons Attribution 3.0 Unported
535
+
536
+ ### Citation Information
537
+
538
+ @inproceedings{feng-etal-2020-doc2dial,
539
+ title = "doc2dial: A Goal-Oriented Document-Grounded Dialogue Dataset",
540
+ author = "Feng, Song and Wan, Hui and Gunasekara, Chulaka and Patel, Siva and Joshi, Sachindra and Lastras, Luis",
541
+ booktitle = "Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP)",
542
+ month = nov,
543
+ year = "2020",
544
+ publisher = "Association for Computational Linguistics",
545
+ url = "https://www.aclweb.org/anthology/2020.emnlp-main.652",
546
+ }
dataset_infos.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"dialogue_domain": {"description": "Doc2dial is dataset of goal-oriented dialogues that are grounded in the associated documents. It includes over 4500 annotated conversations with an average of 14 turns that are grounded in over 450 documents from four domains. Compared to the prior document-grounded dialogue datasets this dataset covers a variety of dialogue scenes in information-seeking conversations.\n", "citation": "@inproceedings{feng-etal-2020-doc2dial,\n title = \"doc2dial: A Goal-Oriented Document-Grounded Dialogue Dataset\",\n author = \"Feng, Song and Wan, Hui and Gunasekara, Chulaka and Patel, Siva and Joshi, Sachindra and Lastras, Luis\",\n booktitle = \"Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP)\",\n month = nov,\n year = \"2020\",\n publisher = \"Association for Computational Linguistics\",\n url = \"https://www.aclweb.org/anthology/2020.emnlp-main.652\",\n}\n", "homepage": "https://doc2dial.github.io/file/doc2dial/", "license": "", "features": {"dial_id": {"dtype": "string", "id": null, "_type": "Value"}, "doc_id": {"dtype": "string", "id": null, "_type": "Value"}, "domain": {"dtype": "string", "id": null, "_type": "Value"}, "turns": [{"turn_id": {"dtype": "int32", "id": null, "_type": "Value"}, "role": {"dtype": "string", "id": null, "_type": "Value"}, "da": {"dtype": "string", "id": null, "_type": "Value"}, "reference": [{"keys": {"dtype": "string", "id": null, "_type": "Value"}, "values": {"dtype": "string", "id": null, "_type": "Value"}}], "utterance": {"dtype": "string", "id": null, "_type": "Value"}}]}, "post_processed": null, "supervised_keys": null, "builder_name": "doc2dial", "config_name": "dialogue_domain", "version": {"version_str": "1.1.0", "description": null, "major": 1, "minor": 1, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 8274818, "num_examples": 3471, "dataset_name": "doc2dial"}, "validation": {"name": "validation", "num_bytes": 1548873, "num_examples": 661, "dataset_name": "doc2dial"}}, "download_checksums": {"https://doc2dial.github.io/file/doc2dial.zip": {"num_bytes": 8228534, "checksum": "9143efd9d12ca30b1c772f65102b1c3e77d625fca03e69d316773acea5406786"}}, "download_size": 8228534, "post_processing_size": null, "dataset_size": 9823691, "size_in_bytes": 18052225}, "document_domain": {"description": "Doc2dial is dataset of goal-oriented dialogues that are grounded in the associated documents. It includes over 4500 annotated conversations with an average of 14 turns that are grounded in over 450 documents from four domains. Compared to the prior document-grounded dialogue datasets this dataset covers a variety of dialogue scenes in information-seeking conversations.\n", "citation": "@inproceedings{feng-etal-2020-doc2dial,\n title = \"doc2dial: A Goal-Oriented Document-Grounded Dialogue Dataset\",\n author = \"Feng, Song and Wan, Hui and Gunasekara, Chulaka and Patel, Siva and Joshi, Sachindra and Lastras, Luis\",\n booktitle = \"Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP)\",\n month = nov,\n year = \"2020\",\n publisher = \"Association for Computational Linguistics\",\n url = \"https://www.aclweb.org/anthology/2020.emnlp-main.652\",\n}\n", "homepage": "https://doc2dial.github.io/file/doc2dial/", "license": "", "features": {"domain": {"dtype": "string", "id": null, "_type": "Value"}, "doc_id": {"dtype": "string", "id": null, "_type": "Value"}, "title": {"dtype": "string", "id": null, "_type": "Value"}, "doc_text": {"dtype": "string", "id": null, "_type": "Value"}, "spans": [{"id_sp": {"dtype": "string", "id": null, "_type": "Value"}, "tag": {"dtype": "string", "id": null, "_type": "Value"}, "start_sp": {"dtype": "int32", "id": null, "_type": "Value"}, "end_sp": {"dtype": "int32", "id": null, "_type": "Value"}, "text_sp": {"dtype": "string", "id": null, "_type": "Value"}, "title": {"dtype": "string", "id": null, "_type": "Value"}, "parent_titles": {"dtype": "string", "id": null, "_type": "Value"}, "id_sec": {"dtype": "string", "id": null, "_type": "Value"}, "start_sec": {"dtype": "int32", "id": null, "_type": "Value"}, "text_sec": {"dtype": "string", "id": null, "_type": "Value"}, "end_sec": {"dtype": "int32", "id": null, "_type": "Value"}}], "doc_html_ts": {"dtype": "string", "id": null, "_type": "Value"}, "doc_html_raw": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "builder_name": "doc2dial", "config_name": "document_domain", "version": {"version_str": "1.1.0", "description": null, "major": 1, "minor": 1, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 204873921, "num_examples": 3416, "dataset_name": "doc2dial"}}, "download_checksums": {"https://doc2dial.github.io/file/doc2dial.zip": {"num_bytes": 8228534, "checksum": "9143efd9d12ca30b1c772f65102b1c3e77d625fca03e69d316773acea5406786"}}, "download_size": 8228534, "post_processing_size": null, "dataset_size": 204873921, "size_in_bytes": 213102455}}
doc2dial.py ADDED
@@ -0,0 +1,402 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ """Doc2dial: A Goal-Oriented Document-Grounded Dialogue Dataset v0.9.0"""
18
+
19
+ from __future__ import absolute_import, division, print_function
20
+
21
+ import json
22
+ import logging
23
+ import os
24
+
25
+ import datasets
26
+
27
+
28
+ _CITATION = """\
29
+ @inproceedings{feng-etal-2020-doc2dial,
30
+ title = "doc2dial: A Goal-Oriented Document-Grounded Dialogue Dataset",
31
+ author = "Feng, Song and Wan, Hui and Gunasekara, Chulaka and Patel, Siva and Joshi, Sachindra and Lastras, Luis",
32
+ booktitle = "Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP)",
33
+ month = nov,
34
+ year = "2020",
35
+ publisher = "Association for Computational Linguistics",
36
+ url = "https://www.aclweb.org/anthology/2020.emnlp-main.652",
37
+ }
38
+ """
39
+
40
+ _DESCRIPTION = """\
41
+ Doc2dial is dataset of goal-oriented dialogues that are grounded in the associated documents. \
42
+ It includes over 4500 annotated conversations with an average of 14 turns that are grounded \
43
+ in over 450 documents from four domains. Compared to the prior document-grounded dialogue datasets \
44
+ this dataset covers a variety of dialogue scenes in information-seeking conversations.
45
+ """
46
+
47
+ _HOMEPAGE = "https://doc2dial.github.io/file/doc2dial/"
48
+
49
+ # TODO: Add the licence for the dataset here if you can find it
50
+ _LICENSE = ""
51
+
52
+ _URLs = "https://doc2dial.github.io/file/doc2dial.zip"
53
+
54
+
55
+ class Doc2dial(datasets.GeneratorBasedBuilder):
56
+ "Doc2dial: A Goal-Oriented Document-Grounded Dialogue Dataset v0.9"
57
+
58
+ VERSION = datasets.Version("1.1.0")
59
+
60
+ # You will be able to load one or the other configurations in the following list with
61
+ # data = datasets.load_dataset("my_dataset", "first_domain")
62
+ # data = datasets.load_dataset("my_dataset", "second_domain")
63
+ BUILDER_CONFIGS = [
64
+ datasets.BuilderConfig(
65
+ name="dialogue_domain",
66
+ version=VERSION,
67
+ description="This part of the dataset covers the dialgoue domain that has questions, answers and the associated doc ids",
68
+ ),
69
+ datasets.BuilderConfig(
70
+ name="document_domain",
71
+ version=VERSION,
72
+ description="This part of the dataset covers the document domain which details all the documents in the various domains",
73
+ ),
74
+ datasets.BuilderConfig(
75
+ name="doc2dial_rc",
76
+ version=VERSION,
77
+ description="Load Doc2Dial dataset for machine reading comprehension tasks",
78
+ ),
79
+ ]
80
+
81
+ DEFAULT_CONFIG_NAME = "dialogue_domain"
82
+
83
+ def _info(self):
84
+
85
+ if self.config.name == "dialogue_domain":
86
+ features = datasets.Features(
87
+ {
88
+ "dial_id": datasets.Value("string"),
89
+ "doc_id": datasets.Value("string"),
90
+ "domain": datasets.Value("string"),
91
+ "turns": [
92
+ {
93
+ "turn_id": datasets.Value("int32"),
94
+ "role": datasets.Value("string"),
95
+ "da": datasets.Value("string"),
96
+ "reference": [
97
+ {
98
+ "keys": datasets.Value("string"),
99
+ "values": datasets.Value("string"),
100
+ }
101
+ ],
102
+ "utterance": datasets.Value("string"),
103
+ }
104
+ ],
105
+ }
106
+ )
107
+ elif self.config.name == "document_domain":
108
+ features = datasets.Features(
109
+ {
110
+ "domain": datasets.Value("string"),
111
+ "doc_id": datasets.Value("string"),
112
+ "title": datasets.Value("string"),
113
+ "doc_text": datasets.Value("string"),
114
+ "spans": [
115
+ {
116
+ "id_sp": datasets.Value("string"),
117
+ "tag": datasets.Value("string"),
118
+ "start_sp": datasets.Value("int32"),
119
+ "end_sp": datasets.Value("int32"),
120
+ "text_sp": datasets.Value("string"),
121
+ "title": datasets.Value("string"),
122
+ "parent_titles": datasets.Value("string"),
123
+ "id_sec": datasets.Value("string"),
124
+ "start_sec": datasets.Value("int32"),
125
+ "text_sec": datasets.Value("string"),
126
+ "end_sec": datasets.Value("int32"),
127
+ }
128
+ ],
129
+ "doc_html_ts": datasets.Value("string"),
130
+ "doc_html_raw": datasets.Value("string"),
131
+ }
132
+ )
133
+ elif self.config.name == "doc2dial_rc":
134
+ features = datasets.Features(
135
+ {
136
+ "id": datasets.Value("string"),
137
+ "question": datasets.Value("string"),
138
+ "answers": datasets.features.Sequence(
139
+ {
140
+ "text": datasets.Value("string"),
141
+ "answer_start": datasets.Value("int32"),
142
+ "answer_end": datasets.Value("int32"),
143
+ "sp_id": datasets.features.Sequence(datasets.Value("string")),
144
+ }
145
+ ),
146
+ "is_impossible": datasets.Value("bool"),
147
+ "dial_context": datasets.features.Sequence(
148
+ {
149
+ "turn_id": datasets.Value("int32"),
150
+ "role": datasets.Value("string"),
151
+ "da": datasets.Value("string"),
152
+ "utterance": datasets.Value("string"),
153
+ "references": datasets.features.Sequence(
154
+ {
155
+ "text": datasets.Value("string"),
156
+ "answer_start": datasets.Value("int32"),
157
+ "answer_end": datasets.Value("int32"),
158
+ "sp_id": datasets.features.Sequence(datasets.Value("string")),
159
+ }
160
+ ),
161
+ }
162
+ ),
163
+ "doc_context": datasets.Value("string"),
164
+ "title": datasets.Value("string"),
165
+ "domain": datasets.Value("string"),
166
+ "start_candidates": datasets.features.Sequence(datasets.Value("int32")),
167
+ "end_candidates": datasets.features.Sequence(datasets.Value("int32")),
168
+ }
169
+ )
170
+
171
+ return datasets.DatasetInfo(
172
+ description=_DESCRIPTION,
173
+ features=features,
174
+ supervised_keys=None,
175
+ homepage=_HOMEPAGE,
176
+ citation=_CITATION,
177
+ )
178
+
179
+ def _split_generators(self, dl_manager):
180
+
181
+ my_urls = _URLs
182
+ data_dir = dl_manager.download_and_extract(my_urls)
183
+
184
+ if self.config.name == "dialogue_domain":
185
+ return [
186
+ datasets.SplitGenerator(
187
+ name=datasets.Split.TRAIN,
188
+ gen_kwargs={
189
+ "filepath": os.path.join(data_dir, "doc2dial/v0.9/data/woOOD/doc2dial_dial_train.json"),
190
+ },
191
+ ),
192
+ datasets.SplitGenerator(
193
+ name=datasets.Split.VALIDATION,
194
+ gen_kwargs={
195
+ "filepath": os.path.join(data_dir, "doc2dial/v0.9/data/woOOD/doc2dial_dial_dev.json"),
196
+ },
197
+ ),
198
+ ]
199
+ elif self.config.name == "document_domain":
200
+ return [
201
+ datasets.SplitGenerator(
202
+ name=datasets.Split.TRAIN,
203
+ gen_kwargs={
204
+ "filepath": os.path.join(data_dir, "doc2dial/v0.9/data/doc2dial_doc.json"),
205
+ },
206
+ )
207
+ ]
208
+ elif self.config.name == "doc2dial_rc":
209
+ return [
210
+ datasets.SplitGenerator(
211
+ name=datasets.Split.VALIDATION,
212
+ gen_kwargs={
213
+ "filepath": os.path.join(
214
+ data_dir, "doc2dial", "v0.9", "data", "woOOD", "doc2dial_dial_dev.json"
215
+ ),
216
+ },
217
+ ),
218
+ datasets.SplitGenerator(
219
+ name=datasets.Split.TRAIN,
220
+ gen_kwargs={
221
+ "filepath": os.path.join(
222
+ data_dir,
223
+ "doc2dial",
224
+ "v0.9",
225
+ "data",
226
+ "woOOD",
227
+ "doc2dial_dial_train.json",
228
+ ),
229
+ },
230
+ ),
231
+ ]
232
+
233
+ def _load_doc_data_rc(self, filepath):
234
+ doc_filepath = os.path.join(os.path.dirname(filepath), "..", "doc2dial_doc.json")
235
+ with open(doc_filepath, encoding="utf-8") as f:
236
+ data = json.load(f)["doc_data"]
237
+ return data
238
+
239
+ def _get_start_end_candidates_rc(self, spans):
240
+ """Get the start and end positions of all the spans"""
241
+ start_candidates, end_candidates = [], []
242
+ for _, sp in spans.items():
243
+ start_candidates.append(sp["start_sp"])
244
+ end_candidates.append(sp["end_sp"])
245
+ return start_candidates, end_candidates
246
+
247
+ def _create_answers_merging_text_ref_rc(self, refs, spans, doc_text):
248
+ """Combine the consecutive spans. Create answers with the start and end position of merged spans and corresponding text content in the document."""
249
+ output = []
250
+ if not refs:
251
+ return output
252
+ all_consecutive_spans = []
253
+ consecutive_spans = []
254
+ for id_, _ in sorted(refs.items(), key=lambda x: int(x[0])):
255
+ if not consecutive_spans or int(id_) == int(consecutive_spans[-1]) + 1:
256
+ consecutive_spans.append(id_)
257
+ else:
258
+ all_consecutive_spans.append(consecutive_spans)
259
+ consecutive_spans = [id_]
260
+ all_consecutive_spans.append(consecutive_spans)
261
+ if len(all_consecutive_spans) > 1:
262
+ all_consecutive_spans.reverse()
263
+ for con_spans in all_consecutive_spans:
264
+ answer = {
265
+ "answer_start": spans[con_spans[0]]["start_sp"],
266
+ "answer_end": spans[con_spans[-1]]["end_sp"],
267
+ "text": doc_text[spans[con_spans[0]]["start_sp"] : spans[con_spans[-1]]["end_sp"]],
268
+ "sp_id": con_spans,
269
+ }
270
+ output.append(answer)
271
+ return output
272
+
273
+ def _generate_examples(self, filepath):
274
+ """This function returns the examples in the raw (text) form."""
275
+
276
+ if self.config.name == "dialogue_domain":
277
+ logging.info("generating examples from = %s", filepath)
278
+ with open(filepath, encoding="utf-8") as f:
279
+ data = json.load(f)
280
+ for domain in data["dial_data"]:
281
+ for doc_id in data["dial_data"][domain]:
282
+ for dialogue in data["dial_data"][domain][doc_id]:
283
+
284
+ x = {
285
+ "dial_id": dialogue["dial_id"],
286
+ "domain": domain,
287
+ "doc_id": doc_id,
288
+ "turns": [
289
+ {
290
+ "turn_id": i["turn_id"],
291
+ "role": i["role"],
292
+ "da": i["da"],
293
+ "reference": [
294
+ {
295
+ "keys": ref,
296
+ "values": str(i["reference"][ref]),
297
+ }
298
+ for ref in i["reference"]
299
+ ],
300
+ "utterance": i["utterance"],
301
+ }
302
+ for i in dialogue["turns"]
303
+ ],
304
+ }
305
+
306
+ yield dialogue["dial_id"], x
307
+
308
+ elif self.config.name == "document_domain":
309
+
310
+ logging.info("generating examples from = %s", filepath)
311
+ with open(filepath, encoding="utf-8") as f:
312
+ data = json.load(f)
313
+ for domain in data["doc_data"]:
314
+ for doc_id in data["doc_data"][domain]:
315
+ for dialogue in data["doc_data"][domain][doc_id]:
316
+
317
+ yield doc_id, {
318
+ "domain": domain,
319
+ "doc_id": doc_id,
320
+ "title": data["doc_data"][domain][doc_id]["title"],
321
+ "doc_text": data["doc_data"][domain][doc_id]["doc_text"],
322
+ "spans": [
323
+ {
324
+ "id_sp": data["doc_data"][domain][doc_id]["spans"][i]["id_sp"],
325
+ "tag": data["doc_data"][domain][doc_id]["spans"][i]["tag"],
326
+ "start_sp": data["doc_data"][domain][doc_id]["spans"][i]["start_sp"],
327
+ "end_sp": data["doc_data"][domain][doc_id]["spans"][i]["end_sp"],
328
+ "text_sp": data["doc_data"][domain][doc_id]["spans"][i]["text_sp"],
329
+ "title": data["doc_data"][domain][doc_id]["spans"][i]["title"],
330
+ "parent_titles": str(
331
+ data["doc_data"][domain][doc_id]["spans"][i]["parent_titles"]
332
+ ),
333
+ "id_sec": data["doc_data"][domain][doc_id]["spans"][i]["id_sec"],
334
+ "start_sec": data["doc_data"][domain][doc_id]["spans"][i]["start_sec"],
335
+ "text_sec": data["doc_data"][domain][doc_id]["spans"][i]["text_sec"],
336
+ "end_sec": data["doc_data"][domain][doc_id]["spans"][i]["end_sec"],
337
+ }
338
+ for i in data["doc_data"][domain][doc_id]["spans"]
339
+ ],
340
+ "doc_html_ts": data["doc_data"][domain][doc_id]["doc_html_ts"],
341
+ "doc_html_raw": data["doc_data"][domain][doc_id]["doc_html_raw"],
342
+ }
343
+ elif self.config.name == "doc2dial_rc":
344
+ """Load dialog data in the reading comprehension task setup, where context is the grounding document,
345
+ input query is dialog history in reversed order, and output to predict is the next agent turn."""
346
+
347
+ logging.info("generating examples from = %s", filepath)
348
+
349
+ doc_data = self._load_doc_data_rc(filepath)
350
+ with open(filepath, encoding="utf-8") as f:
351
+ dial_data = json.load(f)["dial_data"]
352
+ for domain, d_doc_dials in dial_data.items():
353
+ for doc_id, dials in d_doc_dials.items():
354
+ doc = doc_data[domain][doc_id]
355
+ (
356
+ start_pos_char_candidates,
357
+ end_pos_char_candidates,
358
+ ) = self._get_start_end_candidates_rc(doc["spans"])
359
+ for dial in dials:
360
+ all_prev_utterances = []
361
+ all_prev_turns = []
362
+ for idx, turn in enumerate(dial["turns"]):
363
+ all_prev_utterances.append(turn["utterance"])
364
+ if "references" not in turn:
365
+ turn["references"] = self._create_answers_merging_text_ref_rc(
366
+ turn["reference"], doc["spans"], doc["doc_text"]
367
+ )
368
+ turn.pop("reference", None)
369
+ all_prev_turns.append(turn)
370
+ if turn["role"] == "agent":
371
+ continue
372
+ if idx + 1 < len(dial["turns"]):
373
+ if dial["turns"][idx + 1]["role"] == "agent":
374
+ turn_to_predict = dial["turns"][idx + 1]
375
+ else:
376
+ continue
377
+ question = " ".join(list(reversed(all_prev_utterances)))
378
+ id_ = dial["dial_id"] + "_" + str(turn["turn_id"])
379
+ qa = {
380
+ "id": id_,
381
+ "question": question,
382
+ "answers": [],
383
+ "dial_context": all_prev_turns,
384
+ "doc_context": doc["doc_text"],
385
+ "title": doc_id,
386
+ "domain": domain,
387
+ "start_candidates": start_pos_char_candidates,
388
+ "end_candidates": end_pos_char_candidates,
389
+ }
390
+ if "references" not in turn_to_predict:
391
+ turn_to_predict["references"] = self._create_answers_merging_text_ref_rc(
392
+ turn_to_predict["reference"], doc["spans"], doc["doc_text"]
393
+ )
394
+ if not turn_to_predict["references"]:
395
+ qa["is_impossible"] = True
396
+ else:
397
+ qa["is_impossible"] = False
398
+ qa["answers"] = turn_to_predict["references"]
399
+ assert (
400
+ len((qa["answers"])) >= 1
401
+ ), "Ensure the answers are not empty if the question is answerable"
402
+ yield id_, qa
dummy/dialogue_domain/1.1.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b9798815890f170ef0e8340411786b62871a937fb86e1e4c93ecee8bb352f7de
3
+ size 12543
dummy/doc2dial_rc/1.1.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:97a862d79710a952f32db15a7365fb2f555e378625ffd095efb431359a4de057
3
+ size 28145
dummy/document_domain/1.1.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d00be8fde52bcbc7b75db842b89255ed382943f45c382353a7f279f537b4e4ef
3
+ size 15435