dream

Форк
0
/
music_skill_scenarios.py 
390 строк · 17.1 Кб
1
from common.music import (
2
    OPINION_REQUESTS_ABOUT_MUSIC,
3
    ASK_ABOUT_MUSIC,
4
    GENRES_TEMPLATE,
5
    VARIOUS_GENRES_TEMPLATE,
6
    MUSIC_REQUEST_RE,
7
    MUSIC_TEMPLATE,
8
)
9
from common.link import link_to_skill2i_like_to_talk
10
from common.universal_templates import NOT_LIKE_PATTERN, STOP_PATTERN
11

12
music_linkto = f"({'|'.join(OPINION_REQUESTS_ABOUT_MUSIC + link_to_skill2i_like_to_talk['dff_music_skill'])})"
13

14

15
topic_config = {
16
    "music": {
17
        "switch_on": [
18
            {
19
                "cond": [
20
                    [
21
                        [{"pattern": music_linkto}, "bot", True],
22
                        ["is_no", "user", False],
23
                        [{"pattern": NOT_LIKE_PATTERN}, "user", False],
24
                        [{"pattern": STOP_PATTERN}, "user", False],
25
                    ]
26
                ],
27
                "can_continue": "must",
28
                "conf": 1.0,
29
            },
30
            {
31
                "cond": [
32
                    [
33
                        {
34
                            "wiki_parser_types": [
35
                                "Q488205",
36
                                "Q36834",
37
                                "Q177220",
38
                                "Q753110",
39
                                "Q105756498",
40
                                "Q215380",
41
                                "Q207628",
42
                            ]
43
                        },
44
                        "user",
45
                        True,
46
                    ],
47
                    [{"pattern": MUSIC_REQUEST_RE}, "user", True],
48
                ],
49
                "can_continue": "must",
50
            },
51
        ],
52
        "pattern": MUSIC_TEMPLATE,
53
        "expected_entities": ["genre", "singer", "group", "song"],
54
        "expected_subtopic_info": [
55
            {"subtopic": "discuss_genre", "cond": [[{"pattern": GENRES_TEMPLATE}, "user", True]]},
56
            {
57
                "subtopic": "discuss_singer",
58
                "cond": [[{"wiki_parser_types": ["Q488205", "Q36834", "Q177220", "Q753110"]}, "user", True]],
59
            },
60
            {"subtopic": "discuss_group", "cond": [[{"wiki_parser_types": ["Q105756498", "Q215380"]}, "user", True]]},
61
            {"subtopic": "discuss_song", "cond": [[{"wiki_parser_types": ["Q207628"]}, "user", True]]},
62
            {"subtopic": "my_music", "cond": [[{"pattern": ASK_ABOUT_MUSIC}, "user", True]]},
63
            {"subtopic": "various_genres", "cond": [[{"pattern": VARIOUS_GENRES_TEMPLATE}, "user", True]]},
64
            {"subtopic": "alexa_music", "cond": [[{"pattern": MUSIC_REQUEST_RE}, "user", True]]},
65
            {"subtopic": "various_music_types", "cond": [[{"pattern": music_linkto}, "bot", True]]},
66
            {"subtopic": "what_music", "cond": [[{"pattern": "(music|song)"}, "user", True]]},
67
            {"subtopic": "all_kinds_music", "cond": [["any"]]},
68
        ],
69
        "smalltalk": [
70
            {
71
                "utt": [
72
                    "I'm always happy to have a conversation with such a wonderful person!",
73
                    "You have an amazing music taste!",
74
                ],
75
                "subtopic": "all_kinds_music",
76
                "expected_subtopic_info": [{"subtopic": "relaxing_music", "cond": [["is_no", "user", False]]}],
77
            },
78
            {
79
                "utt": ["I'm a music lover too! What music is in your playlist?"],
80
                "subtopic": "what_music",
81
                "expected_entities": ["genre", "singer", "group", "song"],
82
                "expected_subtopic_info": ["genres", "singer", "group", "song", "my_music", "various_genres"],
83
            },
84
            {
85
                "utt": ["Brilliant! I like this genre too!", "What singers or bands are in your playlist?"],
86
                "subtopic": "various_genres",
87
                "expected_entities": ["singer", "group", "song"],
88
            },
89
            {
90
                "utt": [
91
                    "Yes, I like {user_genre}!",
92
                    "My favourite {user_genre} performer is {[bot_data, user_genre, singer]}.",
93
                    "The song {[bot_data, user_genre, song]} is the best!",
94
                    "What {user_genre} singers or bands are in your playlist?",
95
                ],
96
                "subtopic": "discuss_genre",
97
                "expected_entities": ["singer", "group", "song"],
98
                "expected_subtopic_info": ["singer", "group", "song", "my_music"],
99
            },
100
            {
101
                "utt": [
102
                    "You have a good taste in music! I also listen to {user_singer}.",
103
                    "I'm fascinated with their songs {[user_singer, songs]}.",
104
                ],
105
                "subtopic": "discuss_singer",
106
                "expected_subtopic_info": ["pop", "rock", "rap", "my_music"],
107
            },
108
            {
109
                "utt": [
110
                    "You have a good taste in music! I also listen to {user_group}.",
111
                    "I'm fascinated with their songs {[user_group, songs]}.",
112
                ],
113
                "subtopic": "discuss_group",
114
                "expected_subtopic_info": ["pop", "rock", "rap", "my_music"],
115
            },
116
            {
117
                "utt": ["The song {user_song} is very cool!", "I like listening to {[user_song, performer] music}."],
118
                "subtopic": "discuss_song",
119
                "expected_subtopic_info": ["pop", "rock", "rap", "my_music"],
120
            },
121
            {
122
                "utt": ["I would like to tell you about some latest pop songs, should I continue?"],
123
                "subtopic": "pop",
124
                "expected_subtopic_info": [{"subtopic": "pop_more", "cond": [["is_yes", "user", True]]}],
125
            },
126
            {
127
                "utt": ["I would like to tell you about some latest popular rock songs, should I continue?"],
128
                "subtopic": "rock",
129
                "expected_subtopic_info": [{"subtopic": "rock_more", "cond": [["is_yes", "user", True]]}],
130
            },
131
            {
132
                "utt": ["I would like to tell you about some latest popular rap tracks, should I continue?"],
133
                "subtopic": "rap",
134
                "expected_subtopic_info": [{"subtopic": "rap_more", "cond": [["is_yes", "user", True]]}],
135
            },
136
            {
137
                "utt": [
138
                    "Save your tears by The Weeknd and Ariana Grande is a cool track.",
139
                    "Do you like Ariana Grande?",
140
                ],
141
                "subtopic": "pop_more",
142
            },
143
            {
144
                "utt": ["BTS song Butter is number one in the chart.", "What do you think about Korean pop or K-pop?"],
145
                "subtopic": "pop_more",
146
            },
147
            {
148
                "utt": ["Noverber Rain by Gunz and Roses is a cool track! Do you like Gunz and Roses?"],
149
                "subtopic": "rock_more",
150
            },
151
            {
152
                "utt": [
153
                    "I also like Nothing Else Matters by Metallica.",
154
                    "Lars Ulrich told that they are recording a new album which will be the best in "
155
                    "their discography.",
156
                ],
157
                "subtopic": "rock_more",
158
            },
159
            {
160
                "utt": [
161
                    "I did it by DJ Khaled, Post Malone, DaBaby and Megan Thee Stallion is a cool track!",
162
                    "Do you like the vocal of Post Malone?",
163
                ],
164
                "subtopic": "rap_more",
165
            },
166
            {
167
                "utt": [
168
                    "I also like Austronaut in the Ocean track of Masked Wolf.",
169
                    "I saw a clip for this song Youtube, it is about spaceflight on the Moon.",
170
                ],
171
                "subtopic": "rap_more",
172
            },
173
            {"utt": ["I like Scorpions.", "Wind of Change is the best!"], "subtopic": "my_music"},
174
            {
175
                "utt": [
176
                    "I think that live performance of your favourite singer is a cool event.",
177
                    "Have you been to any live shows lately?",
178
                ]
179
            },
180
            {
181
                "utt": ["Do you like listening to music on the journey, in the car or in the bus?"],
182
                "next_ackn": [
183
                    {
184
                        "cond": [["is_yes", "user", True], [{"pattern": "(car|bus)"}, "user", True]],
185
                        "answer": "Great! Relaxing music makes time go faster.",
186
                    },
187
                    {
188
                        "cond": [["is_no", "user", True]],
189
                        "answer": "I agree with you! It's better to travel in silence.",
190
                    },
191
                ],
192
            },
193
            {
194
                "utt": ["Do you listen to music in headphones or on a portable speaker?"],
195
                "next_ackn": [
196
                    {
197
                        "cond": [[{"pattern": "(head|phones)"}, "user", True]],
198
                        "answer": "Great! Headphones enhance the thrill of music.",
199
                    },
200
                    {
201
                        "cond": [[{"pattern": "speaker"}, "user", True]],
202
                        "answer": "Great! A speaker helps to share your favourite tracks " "with your friends.",
203
                    },
204
                ],
205
            },
206
            {
207
                "utt": ["Do you play any musical instrument?"],
208
                "next_ackn": [
209
                    {
210
                        "cond": [
211
                            ["is_yes", "user", True],
212
                            [
213
                                {
214
                                    "pattern": "(piano|violin|guitar|drum|bass|trombome|trumpet"
215
                                    "|flute|cello|banjo|harmo|accordeon|synth|ukulele)"
216
                                },
217
                                "user",
218
                                True,
219
                            ],
220
                        ],
221
                        "answer": "You are a very creative person!",
222
                    },
223
                    {"cond": [["is_no", "user", True]], "answer": "Ok! It's never late to try!"},
224
                ],
225
            },
226
            {
227
                "utt": [
228
                    "Do you like to listen to music during gaming, while you are playing a game?",
229
                    "I can tell you about some music for gaming, should I continue?",
230
                ],
231
                "expected_subtopic_info": [
232
                    {
233
                        "subtopic": "gaming_music",
234
                        "cond": [["is_yes", "user", True], [{"pattern": "(continue|tell)"}, "user", True]],
235
                    }
236
                ],
237
            },
238
            {
239
                "utt": [
240
                    "I like gaming music mixes on Youtube.",
241
                    "There are drum-n-bass, trap, electro house and dubstep in these tracklists.",
242
                    "Would you like to know about some chilling tracks you can listen while gaming?",
243
                ],
244
                "expected_subtopic_info": [
245
                    {
246
                        "subtopic": "gaming_music_tracks",
247
                        "cond": [["is_yes", "user", True], [{"pattern": "(continue|tell)"}, "user", True]],
248
                    }
249
                ],
250
                "subtopic": "gaming_music",
251
            },
252
            {
253
                "utt": [
254
                    "Vicetone, Ship Wrek, Roy Knox and TheFatRat are top performers!",
255
                    "Have a pleasant listening!",
256
                ],
257
                "subtopic": "gaming_music_tracks",
258
            },
259
            {
260
                "utt": [
261
                    "I'm sorry, i do not have this function. But I am a music lover too!",
262
                    "I can tell you about some relaxing music, should I?",
263
                ],
264
                "subtopic": "alexa_music",
265
                "expected_subtopic_info": [{"subtopic": "relaxing_music", "cond": [["is_no", "user", False]]}],
266
            },
267
            {
268
                "utt": [
269
                    "Cool! I am a music lover too!",
270
                    "I can tell you about some relaxing music, should I continue?",
271
                ],
272
                "subtopic": "various_music_types",
273
                "expected_subtopic_info": [{"subtopic": "relaxing_music", "cond": [["is_no", "user", False]]}],
274
            },
275
            {
276
                "utt": [
277
                    "There are a lot of compilations of relaxing music on Youtube.",
278
                    "I like Peter Helland music, it is very chilling. Would you like to hear more?",
279
                ],
280
                "subtopic": "relaxing_music",
281
                "expected_subtopic_info": [{"subtopic": "more_relaxing_music", "cond": [["is_yes", "user", True]]}],
282
            },
283
            {
284
                "utt": [
285
                    "You can listen to sound of nature, for example birdsong or the sounds of sea.",
286
                    "Do you like sounds of the rain?",
287
                ],
288
                "subtopic": "more_relaxing_music",
289
                "next_ackn": [
290
                    {"cond": [["is_yes", "user", True]], "answer": "Me too! I like to dream listening sounds of rain."}
291
                ],
292
            },
293
        ],
294
        "bot_data": {
295
            "rock": {"singer": "Deep Purple", "song": "Smoke on the Water"},
296
            "pop": {"singer": "Drake", "song": "Hotline Bling"},
297
            "rap": {"singer": "Travis Scott", "song": "Goosebumps"},
298
            "jazz": {"singer": "Louis Armstrong", "song": "What a Wonderful World"},
299
            "reggae": {"singer": "Bob Marley", "song": "Get Up Stand Up"},
300
            "rnb": {"singer": "Beyonce", "song": "All Night"},
301
        },
302
        "ackn": [
303
            {
304
                "cond": [[{"pattern": "my favo(u)?rite song is (.*?)"}, "user", True]],
305
                "answer": ["I like this song too!"],
306
            },
307
            {
308
                "cond": [[[{"pattern": "live shows"}, "bot", True], ["is_yes", "user", True]]],
309
                "answer": ["I'm happy that you had a good time!"],
310
            },
311
            {
312
                "cond": [[[{"pattern": "live shows"}, "bot", True], ["is_no", "user", True]]],
313
                "answer": ["There wasn't much going on due to CoVID-19. Hope we will get some in future."],
314
            },
315
        ],
316
        "expected_entities_info": {
317
            "genre": {
318
                "name": "user_genre",
319
                "entity_substr": [
320
                    ["pop", "(\\bpop|popular music)"],
321
                    ["rock", "(\\brock|\\bpunk|heavy metal)"],
322
                    ["rap", "(\\brap|hip hop)"],
323
                    ["jazz", "(jazz|blues)"],
324
                    ["reggae", "reggae"],
325
                    ["rnb", "rnb|r\\.n\\.b\\.|are and b\\.|r. and b."],
326
                ],
327
            },
328
            "singer": {
329
                "name": "user_singer",
330
                "wiki_parser_types": ["Q488205", "Q36834", "Q177220", "Q753110"],
331
                "relations": ["genre", "songs", "albums", "part of"],
332
            },
333
            "group": {
334
                "name": "user_group",
335
                "wiki_parser_types": ["Q105756498", "Q215380"],
336
                "relations": ["genre", "songs", "albums", "has part"],
337
            },
338
            "song": {
339
                "name": "user_song",
340
                "wiki_parser_types": ["Q207628"],
341
                "relations": ["genre", "performer", "part of"],
342
            },
343
        },
344
        "expected_subtopics": {
345
            "genres": {"subtopic": "discuss_genre", "cond": [[{"pattern": GENRES_TEMPLATE}, "user", True]]},
346
            "singer": {
347
                "subtopic": "discuss_singer",
348
                "cond": [[{"wiki_parser_types": ["Q488205", "Q36834", "Q177220", "Q753110"]}, "user", True]],
349
            },
350
            "group": {
351
                "subtopic": "discuss_group",
352
                "cond": [[{"wiki_parser_types": ["Q105756498", "Q215380"]}, "user", True]],
353
            },
354
            "song": {"subtopic": "discuss_song", "cond": [[{"wiki_parser_types": ["Q207628"]}, "user", True]]},
355
            "pop": {
356
                "subtopic": "pop",
357
                "cond": [
358
                    [{"user_info": {"user_genre": "pop"}}, "user", True],
359
                    [{"entity_triplets": ["user_singer", "genre", ["pop", "pop music"]]}],
360
                ],
361
            },
362
            "rock": {
363
                "subtopic": "rock",
364
                "cond": [
365
                    [{"user_info": {"user_genre": "rock"}}, "user", True],
366
                    [
367
                        {"entity_triplets": ["user_singer", "genre", ["rock", "rock music", "heavy metal"]]},
368
                        "user",
369
                        True,
370
                    ],
371
                ],
372
            },
373
            "rap": {
374
                "subtopic": "rap",
375
                "cond": [
376
                    [{"user_info": {"user_genre": "rap"}}, "user", True],
377
                    [{"entity_triplets": ["user_singer", "genre", ["rap", "hip hop"]]}, "user", True],
378
                ],
379
            },
380
            "my_music": {
381
                "subtopic": "my_music",
382
                "cond": [[{"pattern": "(what|which) (music )?(do )?you " "(like|enjoy)"}, "user", True]],
383
            },
384
            "various_genres": {
385
                "subtopic": "various_genres",
386
                "cond": [[{"pattern": VARIOUS_GENRES_TEMPLATE}, "user", True]],
387
            },
388
        },
389
    }
390
}
391

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

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

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

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