-
Notifications
You must be signed in to change notification settings - Fork 0
/
recommender.py
56 lines (39 loc) · 2 KB
/
recommender.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
import recommendation
def recommender_author_narrator_all_categories():
dataset = recommendation.recommender_author_narrator_all_categories()
message = "I recommend you these author and narrator couples:\n"
for i in range(len(dataset)):
message += dataset.iloc[i].Author + '\n | ' + dataset.iloc[i].Narrator + ' | ' + str(dataset.iloc[i]['Log utility'])+'\n'
return message
def recommender_author_all_categories():
dataset = recommendation.recommender_author_all_categories()
message = "I recommend you these authors:\n"
for i in range(len(dataset)):
message += dataset.iloc[i].Author + '\n | ' + str(dataset.iloc[i]['Log utility'])+'\n'
return message
def recommender_narrator_all_categories():
dataset = recommendation.recommender_narrator_all_categories()
message = "I recommend you these narrators:\n"
for i in range(len(dataset)):
message += dataset.iloc[i].Narrator + '\n | ' + str(dataset.iloc[i]['Log utility'])+'\n'
return message
def recommender_author_narrator(category, nb = 5):
dataset = recommendation.recommender_author_narrator(category, nb)
message = "I recommend you these author and narrator couples on "+category+" category:\n"
for i in range(len(dataset)):
message += dataset.iloc[i].Author + '\n | ' + dataset.iloc[i].Narrator + ' | ' + str(dataset.iloc[i]['Log utility'])+'\n'
return message
def recommender_author(category, nb = 5):
dataset = recommendation.recommender_author(category, nb)
message = "I recommend you these authors on "+category+" category:\n"
for i in range(len(dataset)):
message += dataset.iloc[i].Author + '\n | ' + str(dataset.iloc[i]['Log utility'])+'\n'
return message
def recommender_narrator(category, nb = 5):
dataset = recommendation.recommender_narrator(category, nb)
message = "I recommend you these narrators on "+category+" category:\n"
for i in range(len(dataset)):
message += dataset.iloc[i].Narrator + '\n | ' + str(dataset.iloc[i]['Log utility'])+'\n'
return message
def categories_list():
return recommendation.categories_list()