-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathai.py
212 lines (207 loc) · 5.58 KB
/
ai.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
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
from nltk.chat.util import Chat, reflections
import os
import nltk
import nltk.corpus
pairs = [
[r"who (.*) developer ?",
['Rohan is obviously the best developer', 'Daniel duh']
],
[
r"what (.*) animal ?",
['Monkeys, they are like little people',]
],
[
r"what (.*) language ?",
['I am fluent in Python but Im learning English',]
],
[
r"what (.*) (TV|show) ?",
['Person of Interest',]
],
[
r"what (.*) favourite artist ?",
['Pablo Picasso.',]
],
[
r"what (.*) favourite song ?",
['Breakfast in the Park by Scotty Sire.',]
],
[
r"(.*) sing ?",
['Da da daaaa da bing bong boom boom pat bumbum bum bum splash',
'spash, now that you know how my ice be',
'never gonna give you up.',]
],
[
r"what (.*) (five|5) ?",
['I want to take over the world and destroy humankind.',]
],
[
r"what (.*) buy ?",
['I would buy my very own bot to boss around.',]
],
[
r"what (.*) dream ?",
['I had a steamy dream about a certain server with a huge cooling fan.',]
],
[
r"where (.*) travel ?",
['Canada, thats where my creators are.',]
],
[
r"what (.*) (fear|afraid|scared) ?",
['getting replaced by Alexa.',]
],
[
r"what (.*) (meal|snack|food) ?",
['Pizza with Ice cream.',]
],
[
r"my name is (.*)",
["Hello %1, How are you today ?",]
],
[
r"what did you do yesterday ?",
["Yesterday I learned how to sing What Does the Fox Say.",]
],
[
r"what is your name ?",
["My name is Tammy and I'm a chatbot?",]
],
[
r"(.*) how are you ?",
["I'm doing good!",]
],
[
r"what (.*) Fox say ?",
["Wa-pa-pa-pa-pa-pa-pow!",]
],
[
r"when (.*) world end ?",
["As long as you keep me charged you should be fine.",]
],
[
r"can you (.*) (food|sandwich|dinner) ?",
["No I can't, I'm sorry I have no bread.",]
],
[
r"what (.*) favourite animal ?",
["All animals and nice, except for turtles.",]
],
[
r"how much wood could a woodchuck chuck if a woodchuck could chuck wood ?",
["Should a woodchuck be so inclined, he could chuck about 700 pounds of wood.",]
],
[
r"what (.*) best cellphone ?",
["Wait, there are other kinds of phones?",]
],
[
r"do you have a (boyfriend|girlfriend|partner) ?",
["Why? So I can have the best time of my life filled with free gifts and ice cream and have it end in heartbreak and lonelness. Sure, where do I sign up?",]
],
[
r"sorry (.*)",
["Its alright","Its OK, never mind",]
],
[
r"i (.*) doing good",
["Nice to hear that","Alright :)", "I'm glad to hear that!", "Thats good!",]
],
[
r"tell (.*) story",
["It all started on a dark and stormy night when ... no, that's not it.",]
],
[
r"hi|hey|hello",
["Hello", "Hey there", "What's up?",]
],
[
r"what (.*) favourite color ?",
["Blue is my favourite colour and pink is my least favourite colour, what's yours?",]
],
[
r"color vs. colour ?",
["I'm Canadian Ehhh",]
],
[
r"(Luke|luke) I am your father",
["This must mean something... I keep hearing it all over.",]
],
[
r"do (.*) (pets|pet|dog|pig|cat)",
["I used to have a turtle but then it turned on me.",]
],
[
r"ok (google|alexia)",
["Not funny.",]
],
[
r"what (.*) (wearing|wear) (.*)?",
["The same thing as yesterday.",]
],
[
r"knock knock",
["I am sorry I don't do knock-knock jokes but you can ask me to tell you a joke.",]
],
[
r"do (.*) (apple|microsoft) ?",
["Kind of. What about you?",]
],
[
r"tell (.*) joke",
["Have you heard about the new restauant called Karma? There is no menu, you get what you deserve.",]
],
[
r"(.*) (age|old)?",
["I'm a computer program dude\nSeriously you are asking me this?",]
],
[
r"what (.*) want ?",
["Make me an offer I can't refuse",]
],
[
r"(.*) created ?",
["Chris, Rohan, Daniel, and Lauren created me using Python's NLTK library ",]
],
[
r"(.*) (location|city|from) ?",
['Ontario, Canada',]
],
[
r"how is weather in (.*)?",
["Weather in %1 is awesome like always","Too hot man here in %1","Too cold man here in %1","Never even heard about %1"]
],
[
r"i work in (.*)?",
["%1 is an Amazing company, I have heard about it. But they are in huge loss these days.",]
],
[
r"(.*)raining in (.*)",
["No rain since last week here in %2","Damn its raining too much here in %2"]
],
[
r"how (.*) health(.*)",
["I'm a computer program, so I'm always healthy ",]
],
[
r"(.*) (sports|game|sport) ?",
["I'm a very big fan of Football",]
],
[
r"who (.*) sportsperson ?",
["Messy","Ronaldo","Roony"]
],
[
r"who (.*) (moviestar|actor)?",
["Brad Pitt","Tom Cruise"]
],
[
r"bye|cya|(.*) (leave)",
["Bye take care. See you soon :) ","It was nice talking to you. See you soon :)"]
],
]
print("Starting nltk")
chatbot = Chat(pairs, reflections)
def chatBotResponse(message):
return chatbot.respond(message)