-
Notifications
You must be signed in to change notification settings - Fork 2
/
nlg.py
329 lines (312 loc) · 12 KB
/
nlg.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
class NLG:
def __init__(self):
self._first_templates = {
"intro": [
"Hello, I would like to tell you a story.",
"Hello, would you like to hear a story?",
"Hi, I'm here to tell you a story."
]
}
self._goodbye_templates = {
"goodbye": [
"You can close the windows to proceed or you can write 'yes' to continue with the story.",
"Ok. You can now close the windows or if you changed your mind you can write 'yes' to continue with "
"the story."
]
}
self._intro_templates = {
"greet": [
"Hello again! Ready for the story?",
"Hello hello, shall I begin?",
"Well hello again, would you like to hear the story?",
],
"goodbye": ["Wait, no story? It's short I promise."],
"deny": ["Wait, no story? It's short I promise."],
"exclaim_neg": ["Wait, no story? It's short I promise."],
"clarification_request": ["I will tell you a story that I know. Shall I start?"],
"ask_if_ended": ["It is not started yet. Shall I start?"],
"feedback_prompt": [
"Yes, sorry. Are you here for a story?"
"I'm here. Would you like to hear a story?"
]
}
self._storytelling_templates = {
"greet": ["{text}"],
"goodbye": ["{text}"],
"affirm": ["{text}"],
"deny": ["{text}"],
"whq": ["{text}"],
"ynq": ["{text}"],
"exclaim_neg": ["{text}"],
"exclaim_pos": ["{text}"],
"thanks": ["{text}"],
"request_increment": ["{text}"],
"clarification_request": ["{text}"],
"ask_if_ended": ["{text}"],
"ask_for_story": ["{text}"],
"comment": ["{text}"],
"feedback_prompt": ["{text}"],
}
self._storytelling_s1_templates = {
"sentence1": ["{acknowledge} {text} Do you know why?"],
"sentence2": ["{acknowledge} {text} All clear so far?"],
"sentence3": ["{acknowledge} {text}. Would you like to try and guess why?"],
"sentence4": ["{acknowledge} {text}"],
"sentence5": [
"{acknowledge} {text} Amazing, right?",
"{acknowledge} {text} I think it's amazing!"
],
"sentence6": [
"{acknowledge} {text} Aren't they lovely?",
"{acknowledge} {text} I'm so lucky to have them in the garden, right?"
],
"sentence7": [
"{acknowledge} {text}",
"{acknowledge} {text}"
],
"sentence8pos": ["{acknowledge} {text} He was for sure unlucky"],
"sentence8neg": ["{acknowledge} {text}"],
"sentence9": ["{acknowledge} {text}"],
"sentence10": ["{acknowledge} {text}"]
}
self._closing_templates = {
"intro": [
"The end! Hope you enjoyed the story",
"That's it, hope you enjoyed.",
"And this is my story, I hope you enjoyed."
]
}
self._closing_templates_s1 = {
"intro_pos": [
"The end! I hope you enjoyed the story",
"That's it, I hope you enjoyed.",
"And this is my story, I hope you enjoyed."
]
}
self._link_to_survey_templates_s1 = {
"link": [
"Here you can find the link to a quick survey: https://forms.gle/uTbw629utDPjNWYU6",
"Please find attached the link to a quick survey here: https://forms.gle/uTbw629utDPjNWYU6",
"Thanks for listening. Here you can find the link to a quick survey: https://forms.gle/uTbw629utDPjNWYU6"
],
"thanks": [
"You're welcome. Please fill the survey: https://forms.gle/uTbw629utDPjNWYU6"
],
"smile": [
":)",
"(:"
]
}
self._link_to_survey_templates = {
"link": [
"Here you can find the link to a quick survey: https://forms.gle/ntwGDa3y8nxGG1w57",
"Please find attached the link to a quick survey here: https://forms.gle/ntwGDa3y8nxGG1w57",
"Thanks for listening. Here you can find the link to a quick survey: https://forms.gle/ntwGDa3y8nxGG1w57"
],
"thanks": [
"You're welcome. Please fill the survey: https://forms.gle/ntwGDa3y8nxGG1w57"
],
"smile": [
":)",
"(:"
]
}
self._answering_templates = {
"what_i_do": [
"I am not sure. I just know I have this story to tell you.",
"I am not sure, sorry. But I know this story, would you like to hear it?",
],
"what_you_do": [
"I'm here to tell you a brief story. Ready to hear it?",
"I'm a storyteller. Would you like to hear the story?"
],
"what_we_do": [
"Well, there is this story that I would like to tell you. Ready?",
"Just talk. I have this story to tell."
],
"what_ot_know": [
"Sorry, I can't answer that. Would you like to hear the story?",
"I don't think I know the answer. Would you like to hear the story?"
],
"what_are_you": [
"I am a storyteller bot.",
"I am a storyteller."
],
"story": [
"You'll see in a moment. Shall I start?",
"You'll discover it soon. Shall I start?"
]
}
self._answering_f_templates = {
"what_i_do": [
"You can now take a survey.",
"Please take the survey I will send you."
],
"think": [
"I think the story is funny.",
"I think the story is funny, but poor squirrel."
],
"what_to_know": [
"Sorry, I didn't catch that."
]
}
self._ans_bert_templates = {
"whq": ["{text}"],
"ynq": ["{text}"],
"greet": ["{text}"],
"goodbye": ["{text}"],
"affirm": ["{text}"],
"deny": ["{text}"],
"exclaim_neg": ["{text}"],
"exclaim_pos": ["{text}"],
"thanks": ["{text}"],
"request_increment": ["{text}"],
"clarification_request": ["{text}"],
"ask_if_ended": ["{text}"],
"ask_for_story": ["{text}"],
"comment": ["{text}"],
"feedback_prompt": ["{text}"],
}
self._ans_bert_s1_templates = {
"whq": [
"{text}. Makes sense?",
"{text}. Did I answer you?",
"{text}. Was this the answer you were looking for?",
"{text}. You asked me this, right?",
"{text}"
],
"ynq": [
"{text}. Makes sense?",
"{text}. Did I answer you?",
"{text}. Was this the answer you were looking for?",
"{text}. You asked me this, right?",
"{text}"
],
"greet": [
"{text}. Makes sense?",
"{text}. Did I answer you?",
"{text}. Was this the answer you were looking for?",
"{text}. You asked me this, right?",
"{text}"
],
"goodbye": [
"{text}. Makes sense?",
"{text}. Did I answer you?",
"{text}. Was this the answer you were looking for?",
"{text}. You asked me this, right?",
"{text}"
],
"affirm": [
"{text}. Makes sense?",
"{text}. Did I answer you?",
"{text}. Was this the answer you were looking for?",
"{text}. You asked me this, right?",
"{text}"
],
"deny": [
"{text}. Makes sense?",
"{text}. Did I answer you?",
"{text}. Was this the answer you were looking for?",
"{text}. You asked me this, right?",
"{text}"
],
"exclaim_neg": [
"{text}. Makes sense?",
"{text}. Did I answer you?",
"{text}. Was this the answer you were looking for?",
"{text}. You asked me this, right?",
"{text}"
],
"exclaim_pos": [
"{text}. Makes sense?",
"{text}. Did I answer you?",
"{text}. Was this the answer you were looking for?",
"{text}. You asked me this, right?",
"{text}"
],
"thanks": [
"{text}. Makes sense?",
"{text}. Did I answer you?",
"{text}. Was this the answer you were looking for?",
"{text}. You asked me this, right?",
"{text}"
],
"request_increment": [
"{text}. Makes sense?",
"{text}. Did I answer you?",
"{text}. Was this the answer you were looking for?",
"{text}. You asked me this, right?",
"{text}"
],
"clarification_request": [
"{text}. Makes sense?",
"{text}. Did I answer you?",
"{text}. Was this the answer you were looking for?",
"{text}. You asked me this, right?",
"{text}"
],
"ask_if_ended": [
"{text}. Makes sense?",
"{text}. Did I answer you?",
"{text}. Was this the answer you were looking for?",
"{text}. You asked me this, right?",
"{text}"
],
"ask_for_story": [
"{text}. Makes sense?",
"{text}. Did I answer you?",
"{text}. Was this the answer you were looking for?",
"{text}. You asked me this, right?",
"{text}"
],
"comment": [
"{text}. Makes sense?",
"{text}. Did I answer you?",
"{text}. Was this the answer you were looking for?",
"{text}. You asked me this, right?",
"{text}"
],
"feedback_prompt": [
"{text}. Makes sense?",
"{text}. Did I answer you?",
"{text}. Was this the answer you were looking for?",
"{text}. You asked me this, right?",
"{text}"
],
}
@property
def first_templates(self):
return self._first_templates
@property
def intro_templates(self):
return self._intro_templates
@property
def answering_templates(self):
return self._answering_templates
@property
def answering_f_templates(self):
return self._answering_f_templates
@property
def ans_bert_templates(self):
return self._ans_bert_templates
@property
def ans_bert_s1_templates(self):
return self._ans_bert_s1_templates
@property
def storytelling_templates(self):
return self._storytelling_templates
@property
def storytelling_s1_templates(self):
return self._storytelling_s1_templates
@property
def closing_templates(self):
return self._closing_templates
@property
def link_to_survey_templates(self):
return self._link_to_survey_templates
@property
def link_to_survey_templates_s1(self):
return self._link_to_survey_templates_s1
@property
def goodbye_templates(self):
return self._goodbye_templates