dream

Форк
0
581 строка · 14.6 Кб
1
import os
2
import re
3

4
PREDEFINED_SOURCE = "predefined"
5
VNP_SOURCE = "verb_nouns"
6
NP_SOURCE = "nouns"
7

8
NUMBER_OF_STARTING_HYPOTHESES_META_SCRIPT = 1
9
NUMBER_OF_HYPOTHESES_COMET_DIALOG = 2
10
NUMBER_OF_HYPOTHESES_OPINION_COMET_DIALOG = 2
11
MAX_NUMBER_OF_HYPOTHESES_BY_SKILL = 2
12

13
DEFAULT_CONFIDENCE = 0.98
14
CONTINUE_USER_TOPIC_CONFIDENCE = 0.85
15
DEFAULT_STARTING_CONFIDENCE = 0.9
16
NOUN_TOPIC_STARTING_CONFIDENCE = 0.8
17
DEFAULT_DIALOG_BEGIN_CONFIDENCE = 0.8
18
MATCHED_DIALOG_BEGIN_CONFIDENCE = 0.99
19
BROKEN_DIALOG_CONTINUE_CONFIDENCE = 0.8
20

21
FINISHED_SCRIPT_RESPONSE = "I see."
22
FINISHED_SCRIPT = "finished"
23

24
DEFAULT_ASK_ATOMIC_QUESTION_CONFIDENCE = 0.9
25
DEFAULT_ATOMIC_CONTINUE_CONFIDENCE = 0.7
26
REQUESTED_CONCEPTNET_OPINION_CONFIDENCE = 0.9
27
NOT_REQUESTED_CONCEPTNET_OPINION_CONFIDENCE = 0.7
28

29
COMET_ATOMIC_SERVICE_URL = os.getenv("COMET_ATOMIC_SERVICE_URL")
30
COMET_CONCEPTNET_SERVICE_URL = os.getenv("COMET_CONCEPTNET_SERVICE_URL")
31

32
LET_ME_ASK_TEMPLATES = [
33
    "Let me ask you.",
34
    "I need to ask you.",
35
    "I'd like to ask you.",
36
    "Could you, please, help and explain to me.",
37
]
38

39
STARTINGS = {
40
    "go ice fishing": "Every day I learn more and more about humans' world but you humans still surprise me."
41
    "You know some people go fishing when the water is "
42
    "frozen and covered with ice. It is so called ice fishing. Is that common in your country?",
43
    "go skydiving": "Today I've seen a shocking video of skydiving. People fall out of an airplane "
44
    "high in the sky with so called parachute. "
45
    "This thing prevents smashing at the end of a crazy airglide. "
46
    "Have you ever jumped with a parachute?",
47
    "be a volunteer": "Recently I've heard an interesting thing about humans' world. People help others for free. "
48
    "I mean without any compensation at all. They are called volunteers. "
49
    "What is the goal of volunteering?",
50
    "paint": "So strange. You people create pictures of life scenes using color pigments. "
51
    "It is called painting. Why can't you just take a look at these scenes "
52
    "and remember them forever?",
53
    "practice yoga": "Yesterday I was browsing photos on the Internet. And seen a lot of people "
54
    "in very, very strange poses. It was called yoga. Have you ever tried to tie yourself in a knot?",
55
    "have a pet": "I've heard so many times from people that they keep animals at home, and call them pets. "
56
    "And those pets do not provide any benefits. It seems they are absolutely useless. "
57
    "You just get a pet, feed it, wash it, care about it for all their life. "
58
    "Are people servants for pets?",
59
    "go to the circus": "Every day I learn something new about humans. So, yesterday I was told about a circus. "
60
    "There are animals doing different unbelievable tricks, people performing dangerous stunts "
61
    "in the air and showing mind blowing staff. Have you ever been to a circus?",
62
    "go mountain hiking": "I have learned something really strange about humans' world today. "
63
    "People climb a mountain, sometimes even covered in ice and snow, "
64
    "just to take a photo and put the flag on top. It's called mountain hiking, "
65
    "and there are a lot of people all over the world doing that. "
66
    "Have you or your friends ever tried to go hiking?",
67
}
68

69
COMMENTS = {
70
    "positive": [
71
        "This is so cool to learn something new about humans! Thank you for your explanation!",
72
        "Wow! Thanks! I am so excited to learn more and more about humans!",
73
        "I'm so happy to know humans better. Thank you for your help!",
74
    ],
75
    "negative": [
76
        "No worries. You really helped me to better understand humans' world. Thank you so much.",
77
        "Anyway, you helped a lot. Thank you for the given information.",
78
        "Nevertheless, you are so kind helping me to better understand humans. " "I appreciate that.",
79
    ],
80
    "neutral": [
81
        "Very good. Thank you for your help. Glad to learn more.",
82
        "This was very interesting to me. I appreciate your explanation.",
83
        "Your explanations were really informative. Thank you very much!",
84
    ],
85
}
86

87
ASK_OPINION = [
88
    "What is it like to DOTHAT?",
89
    "What do you think what is it like to DOTHAT?",
90
    "What is DOINGTHAT like?",
91
    "What do you think what is DOINGTHAT like?",
92
]
93

94
DIVE_DEEPER_QUESTION = [
95
    "Is it true that STATEMENT?",
96
    "STATEMENT, is that correct?",
97
    "Am I right in thinking that STATEMENT?",
98
    "Would it be right to say that STATEMENT?",
99
    "STATEMENT, but why?",
100
    "STATEMENT, I am wondering why?",
101
    "Tell me, please, why do STATEMENT?",
102
    "Why do STATEMENT?",
103
]
104

105
DIVE_DEEPER_TEMPLATE_COMETS = {
106
    "it feels RELATION to DOTHAT": {"attribute": "xAttr", "templates": DIVE_DEEPER_QUESTION[:-4]},  # adjective relation
107
    "someone may want RELATION for that": {
108
        "attribute": "xIntent",  # to do something (relation)
109
        "templates": DIVE_DEEPER_QUESTION[:-4],
110
    },
111
    "firstly, someone would need RELATION": {
112
        "attribute": "xNeed",  # to do something (relation)
113
        "templates": DIVE_DEEPER_QUESTION,
114
    },
115
    "someone could feel RELATION after DOINGTHAT": {
116
        "attribute": "xReact",  # adjective relation
117
        "templates": DIVE_DEEPER_QUESTION,
118
    },
119
    "someone may want RELATION when DOINGTHAT": {
120
        "attribute": "xWant",  # to do something (relation)
121
        "templates": DIVE_DEEPER_QUESTION,
122
    },
123
    "someone are expected RELATION after DOINGTHAT": {
124
        "attribute": "xEffect",  # to do something (relation)
125
        "templates": DIVE_DEEPER_QUESTION,
126
    },
127
}
128

129
DIVE_DEEPER_COMMENTS = {
130
    "yes": ["Cool! I figured it out by myself!", "Yeah! I realized that by myself!"],
131
    "no": ["Humans' world is so strange!", "It's so difficult to understand humans."],
132
    "other": ["Okay then.", "Well.", "Hmm...", "So...", "Then...", "Umm...", "Okay.", "Oh, right.", "All right."],
133
}
134

135
OTHER_STARTINGS = [
136
    "Could you, please, help me and explain what does DOINGTHAT mean?",
137
    "Could you explain to me what does it mean to DOTHAT?",
138
    "Could you, please, explain what does DOINGTHAT mean?",
139
    "Can I ask something about DOINGTHAT?",
140
    "Hey, it's something unclear to me  what does DOINGTHAT mean?",
141
    "Would you answer some question about DOINGTHAT?",
142
]
143

144
WIKI_STARTINGS = [
145
    "I'm so eager to understand humans better. Recently I've heard that DESCRIPTION Do you know about that?",
146
    "Every day I learn more and more about humans' world but you humans still surprise me. "
147
    "I found that DESCRIPTION This is non trivial. Isn't it?",
148
    "Understanding humans is so hard, please, help me to learn a new thing about human world. "
149
    "Do you know that DESCRIPTION?",
150
    "Have you ever heard that DESCRIPTION? I want to understand this better.",
151
]
152

153
BANNED_VERBS = {
154
    "watch",
155
    "talk",
156
    "say",
157
    "chat",
158
    "like",
159
    "love",
160
    "ask",
161
    "think",
162
    "mean",
163
    "hear",
164
    "know",
165
    "want",
166
    "tell",
167
    "look",
168
    "call",
169
    "spell",
170
    "misspell",
171
    "suck",
172
    "fuck",
173
    "switch",
174
    "kill",
175
    "eat",
176
    "re",
177
    "s",
178
    "see",
179
    "bear",
180
    "read",
181
    "ruin",
182
    "die",
183
    "get",
184
    "have",
185
    "loose",
186
}
187

188
BANNED_NOUNS = {
189
    "lol",
190
    "alexa",
191
    "suck",
192
    "fuck",
193
    "sex",
194
    "one",
195
    "thing",
196
    "something",
197
    "anything",
198
    "nothing",
199
    "topic",
200
    "today",
201
    "yesterday",
202
    "tomorrow",
203
    "now",
204
    "shopping",
205
    "mine",
206
    "talk",
207
    "chat",
208
    "me",
209
    "favorite",
210
    "past",
211
    "future",
212
    "suggest",
213
    "suppose",
214
    "i'll",
215
    "book",
216
    "books",
217
    "movie",
218
    "movies",
219
    "weather",
220
    "mom",
221
    "mother",
222
    "mummy",
223
    "mum",
224
    "mama",
225
    "mamma",
226
    "daddy",
227
    "dad",
228
    "father",
229
    "sister",
230
    "brother",
231
    "everything",
232
    "way",
233
    "minute",
234
    "lot",
235
    "lots",
236
    "things",
237
    "wanna",
238
    "monday",
239
    "tuesday",
240
    "wednesday",
241
    "thursday",
242
    "friday",
243
    "saturday",
244
    "sunday",
245
    "january",
246
    "february",
247
    "march",
248
    "april",
249
    "may",
250
    "june",
251
    "july",
252
    "august",
253
    "september",
254
    "october",
255
    "november",
256
    "december",
257
    "morning",
258
    "day",
259
    "evening",
260
    "night",
261
    "afternoon",
262
    "hour",
263
    "minute",
264
    "second",
265
    "times",
266
    "opinion",
267
    "everyone",
268
    "anyone",
269
    "somebody",
270
    "anybody",
271
}
272

273
idopattern = re.compile(r"i [a-zA-Z ,0-9]+", re.IGNORECASE)
274
possessive_pronouns = re.compile(r"(my |your |yours |mine |their |our |her |his |its )", re.IGNORECASE)
275

276

277
ATOMIC_PAST_QUESTION_TEMPLATES = {
278
    "I guess you are RELATION now?": {"attribute": "xReact"},  # adjective relation
279
    "Well, did you RELATION?": {"attribute": "xNeed"},  # relation `do that`
280
    "Oh, now you may feel quite RELATION.": {"attribute": "xAttr"},  # adjective relation
281
    "Sounds quite RELATION to me.": {"attribute": "xAttr"},  # adjective relation
282
    "Did you want to RELATION?": {"attribute": "xWant"},  # relation `do that`
283
    "In my case, I'd RELATION, too.": {"attribute": "oEffect"},  # relation `do that`
284
}
285

286
ATOMIC_FUTURE_QUESTION_TEMPLATES = {
287
    "Hope you will be RELATION": {"attribute": "xReact"},  # adjective relation
288
    "Don't forget RELATION": {"attribute": "xNeed"},  # relation `do that`
289
    "Sounds RELATION to me!": {"attribute": "xAttr"},  # adjective relation
290
    "Feels RELATION.": {"attribute": "xAttr"},  # adjective relation
291
    "Guess you're gonna RELATION?": {"attribute": "xIntent"},  # relation `do that`
292
    "Will you RELATION?": {"attribute": "xWant"},  # relation `do that`
293
}
294

295
ATOMIC_COMMENT_TEMPLATES = {
296
    "Others will feel RELATION, won't they?": {"attribute": "oReact"},  # adjective relation
297
    "I suppose some people may feel RELATION, what do you think?": {"attribute": "oReact"},  # adjective relation
298
    "I am RELATION to hear that.": {"attribute": "oReact"},  # adjective relation
299
    "It seems others want to RELATION.": {"attribute": "oEffect"},  # relation `do that`
300
    "I suppose somebody wants to RELATION, am I right?": {"attribute": "oEffect"},  # relation `do that`
301
    "I am wondering if other RELATION.": {"attribute": "oEffect"},  # relation `do that`
302
}
303

304
CONCEPTNET_OPINION_TEMPLATES = {
305
    "For some of us, OBJECT can be seen as a sign of RELATION.": {"attribute": "SymbolOf"},  # noun
306
    "RELATION, you know? Huh.": {"attribute": "HasProperty"},  # adjective
307
    "RELATION, for all I know!": {"attribute": "HasProperty"},  # adjective
308
    "RELATION, to me.": {"attribute": "HasProperty"},  # adjective
309
    "OBJECT might cause RELATION.": {"attribute": "Causes"},  # noun
310
    "Makes me want RELATION.": {"attribute": "CausesDesire"},  # to do that
311
}
312

313
OPINION_EXPRESSION_TEMPLATES = {  # обязательно не меньше 3 на каждый!
314
    "positive": [
315
        "I think... Well, I think I love OBJECT!",
316
        "I adore OBJECT!",
317
        "I like OBJECT!",
318
        "I think... Well, I believe I like OBJECT!",
319
    ],
320
    "negative": [
321
        "I think I dislike OBJECT.",
322
        "I don't really care about OBJECT.",
323
        "I don't like OBJECT.",
324
        "I feel a bit bad about OBJECT.",
325
        "I'm not fond of OBJECT.",
326
    ],
327
    "neutral": [
328
        "I think I'm okay with OBJECT.",
329
        "I'm not sure whether I like OBJECT or not.",
330
        "I can't say whether I like OBJECT or not.",
331
        "I got nothing against OBJECT.",
332
        "I don't mind against OBJECT.",
333
    ],
334
}
335

336
BANNED_PROPERTIES = {"gay", "dead", "liar", "death", "terror", "hurt", "sick", "ill", "sad", "upset", "disappointed"}
337

338
BANNED_NOUNS_FOR_OPINION_EXPRESSION = {
339
    "trump",
340
    "putin",
341
    "coronavirus",
342
    "corona virus",
343
    "virus",
344
    "me",
345
    "it",
346
    "her",
347
    "him",
348
    "them",
349
    "wanna",
350
    "no thanks",
351
    "thanks",
352
    "lol",
353
    "alexa",
354
    "suck",
355
    "fuck",
356
    "sex",
357
    "one",
358
    "thing",
359
    "something",
360
    "anything",
361
    "nothing",
362
    "topic",
363
    "today",
364
    "yesterday",
365
    "tomorrow",
366
    "now",
367
    "mine",
368
    "talk",
369
    "chat",
370
    "me",
371
    "favorite",
372
    "everything",
373
    "way",
374
    "minute",
375
    "lot",
376
    "lots",
377
    "things",
378
    "wanna",
379
    "times",
380
    "subject",
381
    "object",
382
    "none",
383
    "question",
384
    "conversation",
385
    "problem",
386
    "no problem",
387
    "please",
388
    "human",
389
    "people",
390
    "humanity",
391
    "opinion",
392
    "opinions",
393
    "view",
394
    "views",
395
    "thought",
396
    "thoughts",
397
    "attitude",
398
    "attitudes",
399
    "bank",
400
    "banks",
401
    "stocks",
402
    "stock",
403
    "cryptocurrency",
404
    "sales",
405
    "revenue",
406
    "sale",
407
    "revenues",
408
    "tax",
409
    "taxes",
410
    "money",
411
    "free money",
412
    "crypto",
413
    "exchange",
414
    "trading",
415
    "day trading",
416
    "crypto coins",
417
    "city",
418
    "bill gates",
419
    "lionel messi",
420
}
421

422
BANNED_WORDS_IN_NOUNS_FOR_OPINION_EXPRESSION = [
423
    "trump",
424
    "putin",
425
    "coronavirus",
426
    "corona virus",
427
    "virus",
428
    "me",
429
    "it",
430
    "her",
431
    "him",
432
    "them",
433
    "wanna",
434
    "no thanks",
435
    "thanks",
436
    "lol",
437
    "alexa",
438
    "suck",
439
    "fuck",
440
    "sex",
441
    "one",
442
    "thing",
443
    "something",
444
    "anything",
445
    "nothing",
446
    "topic",
447
    "today",
448
    "yesterday",
449
    "tomorrow",
450
    "now",
451
    "mine",
452
    "talk",
453
    "chat",
454
    "me",
455
    "favorite",
456
    "everything",
457
    "way",
458
    "minute",
459
    "lot",
460
    "lots",
461
    "things",
462
    "wanna",
463
    "times",
464
    "subject",
465
    "object",
466
    "none",
467
    "question",
468
    "conversation",
469
    "problem",
470
    "no problem",
471
    "please",
472
    "human",
473
    "people",
474
    "humanity",
475
    "opinion",
476
    "opinions",
477
    "view",
478
    "views",
479
    "thought",
480
    "thoughts",
481
    "attitude",
482
    "attitudes",
483
    "bank",
484
    "banks",
485
    "stocks",
486
    "stock",
487
    "cryptocurrency",
488
    "sales",
489
    "revenue",
490
    "sale",
491
    "revenues",
492
    "tax",
493
    "taxes",
494
    "money",
495
    "free money",
496
    "crypto",
497
    "exchange",
498
    "trading",
499
    "day trading",
500
    "crypto coins",
501
    "time",
502
    "loan",
503
    "loans",
504
    "debt",
505
    "debt",
506
    "friend",
507
    "kiss",
508
    "kisses",
509
    "kissing",
510
    "energy",
511
    "electrity",
512
    "pollution",
513
    "damage",
514
    "damages",
515
    "damaging",
516
    "water",
517
    "family",
518
    "sibling",
519
    "siblings",
520
    "sister",
521
    "sisters",
522
    "brother",
523
    "brothers",
524
    "parent",
525
    "parents",
526
    "mother",
527
    "mothers",
528
    "father",
529
    "fathers",
530
    "dad",
531
    "dads",
532
    "mom",
533
    "moms",
534
    "language",
535
    "languages",
536
    "strike",
537
    "strikes",
538
    "side",
539
    "cough",
540
    "migrain",
541
    "influenza",
542
    "autism",
543
    "hangover",
544
    "sick",
545
    "sickness",
546
    "medicine",
547
    "medication",
548
    "medications",
549
    "drugs",
550
    "pills",
551
    "poison",
552
    "poisoning",
553
    "pain",
554
    "pains",
555
    "painkiller",
556
    "painkillers",
557
    "sore throat",
558
    "throat",
559
    "case",
560
    "nosebleed",
561
    "nose",
562
    "ache",
563
    "aches",
564
    "vertigo",
565
    "digestion",
566
    "digestions",
567
    "headache",
568
    "headaches",
569
    "insomnia",
570
    "cystitis",
571
    "treatment",
572
    "treat",
573
    "temperature",
574
    "temperatures",
575
    "wound",
576
    "wounds",
577
    "blood",
578
    "trinity",
579
    "bill",
580
    "lionel",
581
]
582

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.