-
Notifications
You must be signed in to change notification settings - Fork 0
/
Filmpire_Alan_Script.js
134 lines (115 loc) · 2.75 KB
/
Filmpire_Alan_Script.js
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
// {Name: Basic_example_for_AI_assistant}
// {Description: Learn how to create a dialog script with voice/text commands and text corpus for question answering}
const genres = [
{
"id": 28,
"name": "Action"
},
{
"id": 12,
"name": "Adventure"
},
{
"id": 16,
"name": "Animation"
},
{
"id": 35,
"name": "Comedy"
},
{
"id": 80,
"name": "Crime"
},
{
"id": 99,
"name": "Documentary"
},
{
"id": 18,
"name": "Drama"
},
{
"id": 10751,
"name": "Family"
},
{
"id": 14,
"name": "Fantasy"
},
{
"id": 36,
"name": "History"
},
{
"id": 27,
"name": "Horror"
},
{
"id": 10402,
"name": "Music"
},
{
"id": 9648,
"name": "Mystery"
},
{
"id": 10749,
"name": "Romance"
},
{
"id": 878,
"name": "Science Fiction"
},
{
"id": 10770,
"name": "TV Movie"
},
{
"id": 53,
"name": "Thriller"
},
{
"id": 10752,
"name": "War"
},
{
"id": 37,
"name": "Western"
}
]
const stringfienGenres = genres.map( ({name})=> name.toLowerCase() ).join('|');
intent(['What does this app do?', 'What can I do here?', 'What is this app about?', 'Tell me about app'], (p) => {
p.play(`This is Filmpire, an app where you can find the movies you love.
Try saying: 'Go to Comedy', 'Surpruse me', 'Search for Supermn', 'Make it dark', Log in
`);
});
intent('Make it dark', (p)=>{
p.play({ command: 'changeMode', mode: 'dark' });
p.play('Batman likes this, I hope you will as well.');
});
intent('Make it light', (p)=>{
p.play({ command: 'changeMode', mode: 'light' });
p.play('Ahh, my eyes hurt. Looks good though.');
});
intent(['Log in', 'login'], (p)=>{
p.play('Logging you in.');
p.play({ command: 'login' });
});
intent(['Log out', 'logout'], (p)=>{
p.play('Logging you out.');
p.play({ command: 'logout' });
});
intent(`Go to $(GENRE ${stringfienGenres}|top rated|popular|upcoming)`, (p)=>{
p.play(`Going to ${p.GENRE.value} category.`);
p.play({ command: 'chooseGenre', genreOrCategory: p.GENRE.value, genres });
});
intent('Search for $(QUERY* (.*))', (p)=>{
p.play(`Searching for ${p.QUERY.value}`);
p.play({ command: 'search', query: p.QUERY.value });
});
intent(`Surprise me`, (p)=>{
const selectedCategory = genres[Math.floor(Math.random() * genres.length)].name;
p.play({ command: 'chooseGenre', genreOrCategory: selectedCategory, genres });
p.play(`Sounds good. Enjoy some ${selectedCategory} movies.`);
});