-
Notifications
You must be signed in to change notification settings - Fork 0
/
bot.py
72 lines (56 loc) · 2.11 KB
/
bot.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
import recommender
def greeting(persona, kind, category = None):
return "Hi! we are a chatbot and recommendation system specialized in audiobooks."
def different(persona, kind, category = None):
message = "The categories are:\n"
for category in recommender.category_list():
message += category+'\n'
return message
def all(persona, kind, category = None):
f = globals()[kind]
return f(persona, kind, None)
def specific(persona, kind, category):
f = globals()[kind+'_category']
return f(persona, kind, category)
def author_category(persona, kind, category):
message = ''
if persona.FavoriteCategories == set() or category != None:
if category == None:
message = "Please specify some categories you liked"
else:
persona.addFavoriteCategory(category)
if persona.FavoriteCategories != set():
for category in persona.FavoriteCategories:
message += recommender.recommender_author(category)+'\n\n'
return message
def author(persona, kind, category):
message = recommender.recommender_author_all_categories()
return message
def narrator_category(persona, kind, category):
message = ''
if persona.FavoriteCategories == set() or category != None:
if category == None:
message = "Please specify some categories you liked"
else:
persona.addFavoriteCategory(category)
if persona.FavoriteCategories != set():
for category in persona.FavoriteCategories:
message += recommender.recommender_narrator(category)+'\n\n'
return message
def narrator(persona, kind, category):
message = recommender.recommender_narrator_all_categories()
return message
def author_narrator_category(persona, kind, category):
message = ''
if persona.FavoriteCategories == set() or category != None:
if category == None:
message = "Please specify some categories you liked"
else:
persona.addFavoriteCategory(category)
if persona.FavoriteCategories != set():
for category in persona.FavoriteCategories:
message += recommender.recommender_author_narrator(category)+'\n\n'
return message
def author_narrator(persona, kind, category):
message = recommender.recommender_author_narrator_all_categories()
return message