system HF staff commited on
Commit
11a0637
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

Files changed (5) hide show
  1. .gitattributes +27 -0
  2. README.md +389 -0
  3. dataset_infos.json +1 -0
  4. dummy/1.1.0/dummy_data.zip +3 -0
  5. re_dial.py +161 -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,389 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ annotations_creators:
3
+ - crowdsourced
4
+ language_creators:
5
+ - crowdsourced
6
+ languages:
7
+ - en
8
+ licenses:
9
+ - cc-by-4-0
10
+ multilinguality:
11
+ - monolingual
12
+ size_categories:
13
+ - 10K<n<100K
14
+ source_datasets:
15
+ - original
16
+ task_categories:
17
+ - other
18
+ - text-classification
19
+ task_ids:
20
+ - sentiment-classification
21
+ - text-classification-other-dialogue-sentiment-classification
22
+ ---
23
+
24
+ # Dataset Card Creation Guide
25
+
26
+ ## Table of Contents
27
+ - [Dataset Description](#dataset-description)
28
+ - [Dataset Summary](#dataset-summary)
29
+ - [Supported Tasks](#supported-tasks-and-leaderboards)
30
+ - [Languages](#languages)
31
+ - [Dataset Structure](#dataset-structure)
32
+ - [Data Instances](#data-instances)
33
+ - [Data Fields](#data-instances)
34
+ - [Data Splits](#data-instances)
35
+ - [Dataset Creation](#dataset-creation)
36
+ - [Curation Rationale](#curation-rationale)
37
+ - [Source Data](#source-data)
38
+ - [Annotations](#annotations)
39
+ - [Personal and Sensitive Information](#personal-and-sensitive-information)
40
+ - [Considerations for Using the Data](#considerations-for-using-the-data)
41
+ - [Social Impact of Dataset](#social-impact-of-dataset)
42
+ - [Discussion of Biases](#discussion-of-biases)
43
+ - [Other Known Limitations](#other-known-limitations)
44
+ - [Additional Information](#additional-information)
45
+ - [Dataset Curators](#dataset-curators)
46
+ - [Licensing Information](#licensing-information)
47
+ - [Citation Information](#citation-information)
48
+
49
+ ## Dataset Description
50
+
51
+ - **Homepage:** [ReDial Dataset](https://redialdata.github.io/website/)
52
+ - **Repository:** [ReDialData](https://github.com/ReDialData/website/tree/data)
53
+ - **Paper:** [Towards Deep Conversational Recommendations](https://proceedings.neurips.cc/paper/2018/file/800de15c79c8d840f4e78d3af937d4d4-Paper.pdf)
54
+ - **Point of Contact:** [ReDial Google Group](https://groups.google.com/forum/embed/?place=forum/redial-dataset&showpopout=true#!forum/redial-dataset)
55
+
56
+ ### Dataset Summary
57
+
58
+ ReDial (Recommendation Dialogues) is an annotated dataset of dialogues, where users
59
+ recommend movies to each other. The dataset was collected by a team of researchers working at
60
+ Polytechnique Montréal, MILA – Quebec AI Institute, Microsoft Research Montréal, HEC Montreal, and Element AI.
61
+
62
+ The dataset allows research at the intersection of goal-directed dialogue systems
63
+ (such as restaurant recommendation) and free-form (also called “chit-chat”) dialogue systems.
64
+
65
+ ### Supported Tasks and Leaderboards
66
+
67
+ [More Information Needed]
68
+
69
+ ### Languages
70
+
71
+ The text in the dataset is in English.
72
+
73
+ ## Dataset Structure
74
+
75
+ ### Data Instances
76
+
77
+ JSON-formatted example of a typical instance in the dataset.
78
+
79
+ ```
80
+ {
81
+ "movieMentions":{
82
+ "203371":"Final Fantasy: The Spirits Within (2001)",
83
+ "84779":"The Triplets of Belleville (2003)",
84
+ "122159":"Mary and Max (2009)",
85
+ "151313":"A Scanner Darkly (2006)",
86
+ "191602":"Waking Life (2001)",
87
+ "165710":"The Boss Baby (2017)"
88
+ },
89
+ "respondentQuestions":{
90
+ "203371":{
91
+ "suggested":1,
92
+ "seen":0,
93
+ "liked":1
94
+ },
95
+ "84779":{
96
+ "suggested":0,
97
+ "seen":1,
98
+ "liked":1
99
+ },
100
+ "122159":{
101
+ "suggested":0,
102
+ "seen":1,
103
+ "liked":1
104
+ },
105
+ "151313":{
106
+ "suggested":0,
107
+ "seen":1,
108
+ "liked":1
109
+ },
110
+ "191602":{
111
+ "suggested":0,
112
+ "seen":1,
113
+ "liked":1
114
+ },
115
+ "165710":{
116
+ "suggested":1,
117
+ "seen":0,
118
+ "liked":1
119
+ }
120
+ },
121
+ "messages":[
122
+ {
123
+ "timeOffset":0,
124
+ "text":"Hi there, how are you? I'm looking for movie recommendations",
125
+ "senderWorkerId":0,
126
+ "messageId":1021
127
+ },
128
+ {
129
+ "timeOffset":15,
130
+ "text":"I am doing okay. What kind of movies do you like?",
131
+ "senderWorkerId":1,
132
+ "messageId":1022
133
+ },
134
+ {
135
+ "timeOffset":66,
136
+ "text":"I like animations like @84779 and @191602",
137
+ "senderWorkerId":0,
138
+ "messageId":1023
139
+ },
140
+ {
141
+ "timeOffset":86,
142
+ "text":"I also enjoy @122159",
143
+ "senderWorkerId":0,
144
+ "messageId":1024
145
+ },
146
+ {
147
+ "timeOffset":95,
148
+ "text":"Anything artistic",
149
+ "senderWorkerId":0,
150
+ "messageId":1025
151
+ },
152
+ {
153
+ "timeOffset":135,
154
+ "text":"You might like @165710 that was a good movie.",
155
+ "senderWorkerId":1,
156
+ "messageId":1026
157
+ },
158
+ {
159
+ "timeOffset":151,
160
+ "text":"What's it about?",
161
+ "senderWorkerId":0,
162
+ "messageId":1027
163
+ },
164
+ {
165
+ "timeOffset":207,
166
+ "text":"It has Alec Baldwin it is about a baby that works for a company and gets adopted it is very funny",
167
+ "senderWorkerId":1,
168
+ "messageId":1028
169
+ },
170
+ {
171
+ "timeOffset":238,
172
+ "text":"That seems like a nice comedy",
173
+ "senderWorkerId":0,
174
+ "messageId":1029
175
+ },
176
+ {
177
+ "timeOffset":272,
178
+ "text":"Do you have any animated recommendations that are a bit more dramatic? Like @151313 for example",
179
+ "senderWorkerId":0,
180
+ "messageId":1030
181
+ },
182
+ {
183
+ "timeOffset":327,
184
+ "text":"I like comedies but I prefer films with a little more depth",
185
+ "senderWorkerId":0,
186
+ "messageId":1031
187
+ },
188
+ {
189
+ "timeOffset":467,
190
+ "text":"That is a tough one but I will remember something",
191
+ "senderWorkerId":1,
192
+ "messageId":1032
193
+ },
194
+ {
195
+ "timeOffset":509,
196
+ "text":"@203371 was a good one",
197
+ "senderWorkerId":1,
198
+ "messageId":1033
199
+ },
200
+ {
201
+ "timeOffset":564,
202
+ "text":"Ooh that seems cool! Thanks for the input. I'm ready to submit if you are.",
203
+ "senderWorkerId":0,
204
+ "messageId":1034
205
+ },
206
+ {
207
+ "timeOffset":571,
208
+ "text":"It is animated, sci fi, and has action",
209
+ "senderWorkerId":1,
210
+ "messageId":1035
211
+ },
212
+ {
213
+ "timeOffset":579,
214
+ "text":"Glad I could help",
215
+ "senderWorkerId":1,
216
+ "messageId":1036
217
+ },
218
+ {
219
+ "timeOffset":581,
220
+ "text":"Nice",
221
+ "senderWorkerId":0,
222
+ "messageId":1037
223
+ },
224
+ {
225
+ "timeOffset":591,
226
+ "text":"Take care, cheers!",
227
+ "senderWorkerId":0,
228
+ "messageId":1038
229
+ },
230
+ {
231
+ "timeOffset":608,
232
+ "text":"bye",
233
+ "senderWorkerId":1,
234
+ "messageId":1039
235
+ }
236
+ ],
237
+ "conversationId":"391",
238
+ "respondentWorkerId":1,
239
+ "initiatorWorkerId":0,
240
+ "initiatorQuestions":{
241
+ "203371":{
242
+ "suggested":1,
243
+ "seen":0,
244
+ "liked":1
245
+ },
246
+ "84779":{
247
+ "suggested":0,
248
+ "seen":1,
249
+ "liked":1
250
+ },
251
+ "122159":{
252
+ "suggested":0,
253
+ "seen":1,
254
+ "liked":1
255
+ },
256
+ "151313":{
257
+ "suggested":0,
258
+ "seen":1,
259
+ "liked":1
260
+ },
261
+ "191602":{
262
+ "suggested":0,
263
+ "seen":1,
264
+ "liked":1
265
+ },
266
+ "165710":{
267
+ "suggested":1,
268
+ "seen":0,
269
+ "liked":1
270
+ }
271
+ }
272
+ }
273
+ ```
274
+
275
+ ### Data Fields
276
+
277
+ The dataset is published in the “jsonl” format, i.e., as a text file where each line corresponds to a Dialogue given as a valid JSON document.
278
+
279
+ A Dialogue contains these fields:
280
+
281
+ **conversationId:** an integer
282
+ **initiatorWorkerId:** an integer identifying to the worker initiating the conversation (the recommendation seeker)
283
+ **respondentWorkerId:** an integer identifying the worker responding to the initiator (the recommender)
284
+ **messages:** a list of Message objects
285
+ **movieMentions:** a dict mapping movie IDs mentioned in this dialogue to movie names
286
+ **initiatorQuestions:** a dictionary mapping movie IDs to the labels supplied by the initiator. Each label is a bool corresponding to whether the initiator has said he saw the movie, liked it, or suggested it.
287
+ **respondentQuestions:** a dictionary mapping movie IDs to the labels supplied by the respondent. Each label is a bool corresponding to whether the initiator has said he saw the movie, liked it, or suggested it.
288
+ Each Message contains these fields:
289
+
290
+ **messageId:** a unique ID for this message
291
+ **text:** a string with the actual message. The string may contain a token starting with @ followed by an integer. This is a movie ID which can be looked up in the movieMentions field of the Dialogue object.
292
+ **timeOffset:** time since start of dialogue in seconds
293
+ **senderWorkerId:** the ID of the worker sending the message, either initiatorWorkerId or respondentWorkerId.
294
+
295
+ The labels in initiatorQuestions and respondentQuestions have the following meaning:
296
+ *suggested:* 0 if it was mentioned by the seeker, 1 if it was a suggestion from the recommender
297
+ *seen:* 0 if the seeker has not seen the movie, 1 if they have seen it, 2 if they did not say
298
+ *liked:* 0 if the seeker did not like the movie, 1 if they liked it, 2 if they did not say
299
+
300
+ ### Data Splits
301
+
302
+ The dataset contains a total of 11348 dialogues, 10006 for training and model selection, and 1342 for testing.
303
+
304
+ ## Dataset Creation
305
+
306
+ ### Curation Rationale
307
+
308
+ The dataset allows research at the intersection of goal-directed dialogue systems (such as restaurant recommendation) and free-form (also called “chit-chat”) dialogue systems.
309
+
310
+ In the dataset, users talk about which movies they like and which ones they do not like, which ones they have seen or not etc., and labels which we ensured agree between the two participants. This allows to research how sentiment is expressed in dialogues, which differs a lot from e.g. review websites.
311
+
312
+ The dialogues and the movies they mention form a curious bi-partite graph structure, which is related to how users talk about the movie (e.g. genre information).
313
+
314
+ Ignoring label information, this dataset can also be viewed as a limited domain chit-chat dialogue dataset.
315
+
316
+ ### Source Data
317
+
318
+ #### Initial Data Collection and Normalization
319
+
320
+ Describe the data collection process. Describe any criteria for data selection or filtering. List any key words or search terms used. If possible, include runtime information for the collection process.
321
+
322
+ If data was collected from other pre-existing datasets, link to source here and to their [Hugging Face version](https://huggingface.co/datasets/dataset_name).
323
+
324
+ If the data was modified or normalized after being collected (e.g. if the data is word-tokenized), describe the process and the tools used.
325
+
326
+ #### Who are the source language producers?
327
+
328
+ Here we formalize the setup of a conversation involving recommendations for the purposes of data collection. To provide some additional structure to our data (and models) we define one person in the dialogue as the recommendation seeker and the other as the recommender.
329
+
330
+ To obtain data in this form, we developed an interface and pairing mechanism mediated by Amazon Mechanical Turk (AMT).
331
+
332
+ We pair up AMT workers and give each of them a role. The movie seeker has to explain what kind of movie he/she likes, and asks for movie suggestions. The recommender tries to understand the seeker’s movie tastes, and recommends movies. All exchanges of information and recommendations are made using natural language.
333
+
334
+ We add additional instructions to improve the data quality and guide the workers to dialogue the way we expect them to. Thus we ask to use formal language and that conversations contain roughly ten messages minimum. We also require that at least four different movies are mentioned in every conversation. Finally, we also ask to converse only about movies, and notably not to mention Mechanical Turk or the task itself.
335
+
336
+ In addition, we ask that every movie mention is tagged using the ‘@’ symbol. When workers type ‘@’, the following characters are used to find matching movie names, and workers can choose a movie from that list. This allows us to detect exactly what movies are mentioned and when. We gathered entities from DBpedia that were of type http://dbpedia.org/ontology/Film to obtain a list of movies, but also allow workers to add their own movies to the list if it is not present already. We obtained the release dates from the movie titles (e.g. http://dbpedia.org/page/American_Beauty_(1999_film), or, if the movie title does not contain that information, from an additional SPARQL request. Note that the year or release date of a movie can be essential to differentiate movies with the same name, but released at different dates.
337
+
338
+ We will refer to these additional labels as movie dialogue forms. Both workers have to answer these forms even though it really concerns the seeker’s movie tastes. Ideally, the two participants would give the same answer to every form, but it is possible that their answers do not coincide (because of carelessness, or dialogue ambiguity). The movie dialogue forms therefore allow us to evaluate sub-components of an overall neural dialogue system more systematically, for example one can train and evaluate a sentiment analysis model directly using these labels. %which could produce a reward for the dialogue agent.
339
+
340
+ In each conversation, the number of movies mentioned varies, so we have different numbers of movie dialogue form answers for each conversation. The distribution of the different classes of the movie dialogue form is shown in Table 1a. The liked/disliked/did not say label is highly imbalanced. This is standard for recommendation data, since people are naturally more likely to talk about movies that they like, and the recommender’s objective is to recommend movies that the seeker is likely to like.
341
+
342
+ ### Annotations
343
+
344
+ #### Annotation process
345
+
346
+ Mentioned in above sub-section.
347
+
348
+ #### Who are the annotators?
349
+
350
+ For the AMT HIT we collect data in English and chose to restrict the data collection to countries where English is the main language. The fact that we pair workers together slows down the data collection since we ask that at least two persons are online at the same time to do the task, so a good amount of workers is required to make the collection possible. Meanwhile, the task is quite demanding, and we have to select qualified workers. HIT reward and qualification requirement were decisive to get good conversation quality while still ensuring that people could get paired together. We launched preliminary HITs to find a compromise and finally set the reward to $0.50 per person for each completed conversation (so each conversation costs us $1, plus taxes), and ask that workers meet the following requirements: (1)~Approval percentage greater than 95, (2)~Number of approved HITs greater than 1000, (3)~Their location must be in United States, Canada, United Kingdom, Australia, or New Zealand.
351
+
352
+ ### Personal and Sensitive Information
353
+
354
+ Workers had to confirm a consent form before every task that explains what the data is being collected for and how it is going to be used.
355
+
356
+ ## Considerations for Using the Data
357
+
358
+ ### Social Impact of Dataset
359
+
360
+ [More Information Needed]
361
+
362
+ ### Discussion of Biases
363
+
364
+ [More Information Needed]
365
+
366
+ ### Other Known Limitations
367
+
368
+ [More Information Needed]
369
+
370
+ ## Additional Information
371
+
372
+ ### Dataset Curators
373
+
374
+ The dataset collection was funded by Google, IBM, and NSERC, with editorial support from Microsoft Research.
375
+
376
+ ### Licensing Information
377
+
378
+ The data is published under the CC BY 4.0 License.
379
+
380
+ ### Citation Information
381
+
382
+ ```
383
+ @inproceedings{li2018conversational,
384
+ title={Towards Deep Conversational Recommendations},
385
+ author={Li, Raymond and Kahou, Samira Ebrahimi and Schulz, Hannes and Michalski, Vincent and Charlin, Laurent and Pal, Chris},
386
+ booktitle={Advances in Neural Information Processing Systems 31 (NIPS 2018)},
387
+ year={2018}
388
+ }
389
+ ```
dataset_infos.json ADDED
@@ -0,0 +1 @@
 
1
+ {"default": {"description": "ReDial (Recommendation Dialogues) is an annotated dataset of dialogues, where users\nrecommend movies to each other. The dataset was collected by a team of researchers working at\nPolytechnique Montr\u00e9al, MILA \u2013 Quebec AI Institute, Microsoft Research Montr\u00e9al, HEC Montreal, and Element AI.\n\nThe dataset allows research at the intersection of goal-directed dialogue systems\n(such as restaurant recommendation) and free-form (also called \u201cchit-chat\u201d) dialogue systems.\n", "citation": "@inproceedings{li2018conversational,\n title={Towards Deep Conversational Recommendations},\n author={Li, Raymond and Kahou, Samira Ebrahimi and Schulz, Hannes and Michalski, Vincent and Charlin, Laurent and Pal, Chris},\n booktitle={Advances in Neural Information Processing Systems 31 (NIPS 2018)},\n year={2018}\n}\n", "homepage": "https://redialdata.github.io/website/", "license": "CC BY 4.0 License.", "features": {"movieMentions": [{"movieId": {"dtype": "string", "id": null, "_type": "Value"}, "movieName": {"dtype": "string", "id": null, "_type": "Value"}}], "respondentQuestions": [{"movieId": {"dtype": "string", "id": null, "_type": "Value"}, "suggested": {"dtype": "int32", "id": null, "_type": "Value"}, "seen": {"dtype": "int32", "id": null, "_type": "Value"}, "liked": {"dtype": "int32", "id": null, "_type": "Value"}}], "messages": [{"timeOffset": {"dtype": "int32", "id": null, "_type": "Value"}, "text": {"dtype": "string", "id": null, "_type": "Value"}, "senderWorkerId": {"dtype": "int32", "id": null, "_type": "Value"}, "messageId": {"dtype": "int32", "id": null, "_type": "Value"}}], "conversationId": {"dtype": "int32", "id": null, "_type": "Value"}, "respondentWorkerId": {"dtype": "int32", "id": null, "_type": "Value"}, "initiatorWorkerId": {"dtype": "int32", "id": null, "_type": "Value"}, "initiatorQuestions": [{"movieId": {"dtype": "string", "id": null, "_type": "Value"}, "suggested": {"dtype": "int32", "id": null, "_type": "Value"}, "seen": {"dtype": "int32", "id": null, "_type": "Value"}, "liked": {"dtype": "int32", "id": null, "_type": "Value"}}]}, "post_processed": null, "supervised_keys": null, "builder_name": "re_dial", "config_name": "default", "version": {"version_str": "1.1.0", "description": null, "major": 1, "minor": 1, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 13496125, "num_examples": 10006, "dataset_name": "re_dial"}, "test": {"name": "test", "num_bytes": 1731449, "num_examples": 1342, "dataset_name": "re_dial"}}, "download_checksums": {"https://github.com/ReDialData/website/raw/data/redial_dataset.zip": {"num_bytes": 5765261, "checksum": "b48756681ec6f84e0af36979c5e9baa21ea8d9e7036b8764ea9b787bb0baf69b"}}, "download_size": 5765261, "post_processing_size": null, "dataset_size": 15227574, "size_in_bytes": 20992835}}
dummy/1.1.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8bb3fd96e4b6d4f6f77d2fbe69ecf0c50aaa25bb1ef0bdced4e79e68af9ad6d4
3
+ size 7262
re_dial.py ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ """Annotated dataset of dialogues where users recommend movies to each other."""
16
+
17
+ from __future__ import absolute_import, division, print_function
18
+
19
+ import json
20
+ import os
21
+
22
+ import datasets
23
+
24
+
25
+ _CITATION = """\
26
+ @inproceedings{li2018conversational,
27
+ title={Towards Deep Conversational Recommendations},
28
+ author={Li, Raymond and Kahou, Samira Ebrahimi and Schulz, Hannes and Michalski, Vincent and Charlin, Laurent and Pal, Chris},
29
+ booktitle={Advances in Neural Information Processing Systems 31 (NIPS 2018)},
30
+ year={2018}
31
+ }
32
+ """
33
+
34
+ _DESCRIPTION = """\
35
+ ReDial (Recommendation Dialogues) is an annotated dataset of dialogues, where users
36
+ recommend movies to each other. The dataset was collected by a team of researchers working at
37
+ Polytechnique Montréal, MILA – Quebec AI Institute, Microsoft Research Montréal, HEC Montreal, and Element AI.
38
+
39
+ The dataset allows research at the intersection of goal-directed dialogue systems
40
+ (such as restaurant recommendation) and free-form (also called “chit-chat”) dialogue systems.
41
+ """
42
+
43
+ _HOMEPAGE = "https://redialdata.github.io/website/"
44
+
45
+ _LICENSE = "CC BY 4.0 License."
46
+
47
+ _DATA_URL = "https://github.com/ReDialData/website/raw/data/redial_dataset.zip"
48
+
49
+
50
+ class ReDial(datasets.GeneratorBasedBuilder):
51
+ """Annotated dataset of dialogues where users recommend movies to each other."""
52
+
53
+ VERSION = datasets.Version("1.1.0")
54
+
55
+ def _info(self):
56
+ question_features = {
57
+ "movieId": datasets.Value("string"),
58
+ "suggested": datasets.Value("int32"),
59
+ "seen": datasets.Value("int32"),
60
+ "liked": datasets.Value("int32"),
61
+ }
62
+ features = datasets.Features(
63
+ {
64
+ "movieMentions": [
65
+ {
66
+ "movieId": datasets.Value("string"),
67
+ "movieName": datasets.Value("string"),
68
+ },
69
+ ],
70
+ "respondentQuestions": [question_features],
71
+ "messages": [
72
+ {
73
+ "timeOffset": datasets.Value("int32"),
74
+ "text": datasets.Value("string"),
75
+ "senderWorkerId": datasets.Value("int32"),
76
+ "messageId": datasets.Value("int32"),
77
+ },
78
+ ],
79
+ "conversationId": datasets.Value("int32"),
80
+ "respondentWorkerId": datasets.Value("int32"),
81
+ "initiatorWorkerId": datasets.Value("int32"),
82
+ "initiatorQuestions": [question_features],
83
+ }
84
+ )
85
+ return datasets.DatasetInfo(
86
+ # This is the description that will appear on the datasets page.
87
+ description=_DESCRIPTION,
88
+ # This defines the different columns of the dataset and their types
89
+ features=features, # Here we define them above because they are different between the two configurations
90
+ # If there's a common (input, target) tuple from the features,
91
+ # specify them here. They'll be used if as_supervised=True in
92
+ # builder.as_dataset.
93
+ supervised_keys=None,
94
+ # Homepage of the dataset for documentation
95
+ homepage=_HOMEPAGE,
96
+ # License for the dataset if available
97
+ license=_LICENSE,
98
+ # Citation for the dataset
99
+ citation=_CITATION,
100
+ )
101
+
102
+ def _split_generators(self, dl_manager):
103
+ """Returns SplitGenerators."""
104
+ data_dir = dl_manager.download_and_extract(_DATA_URL)
105
+
106
+ return [
107
+ datasets.SplitGenerator(
108
+ name=datasets.Split.TRAIN,
109
+ # These kwargs will be passed to _generate_examples
110
+ gen_kwargs={
111
+ "filepath": os.path.join(data_dir, "train_data.jsonl"),
112
+ "split": "train",
113
+ },
114
+ ),
115
+ datasets.SplitGenerator(
116
+ name=datasets.Split.TEST,
117
+ # These kwargs will be passed to _generate_examples
118
+ gen_kwargs={"filepath": os.path.join(data_dir, "test_data.jsonl"), "split": "test"},
119
+ ),
120
+ ]
121
+
122
+ def _generate_examples(self, filepath, split):
123
+ """ Yields examples. """
124
+
125
+ with open(filepath, encoding="utf-8") as f:
126
+ examples = f.readlines()
127
+ for id_, row in enumerate(examples):
128
+ data = json.loads(row.strip())
129
+ d = {}
130
+ movieMentions_list = []
131
+ for i in data["movieMentions"]:
132
+ d["movieId"] = i
133
+ d["movieName"] = data["movieMentions"][i]
134
+ movieMentions_list.append(d)
135
+ d = {}
136
+
137
+ respondentQuestions_list = []
138
+ for i in data["respondentQuestions"]:
139
+ d["movieId"] = i
140
+ alpha = data["respondentQuestions"][i]
141
+ z = {**d, **alpha} # merging 2 dictionaries
142
+ respondentQuestions_list.append(z)
143
+ d = {}
144
+
145
+ initiatorQuestions_list = []
146
+ for i in data["initiatorQuestions"]:
147
+ d["movieId"] = i
148
+ alpha = data["initiatorQuestions"][i]
149
+ z = {**d, **alpha} # merging 2 dictionaries
150
+ initiatorQuestions_list.append(z)
151
+ d = {}
152
+
153
+ yield id_, {
154
+ "movieMentions": movieMentions_list,
155
+ "respondentQuestions": respondentQuestions_list,
156
+ "messages": data["messages"],
157
+ "conversationId": data["conversationId"],
158
+ "respondentWorkerId": data["respondentWorkerId"],
159
+ "initiatorWorkerId": data["initiatorWorkerId"],
160
+ "initiatorQuestions": initiatorQuestions_list,
161
+ }