1
2
3
4
5
6
7
8 """
9 This chatbot is a tongue-in-cheek take on the average teen
10 anime junky that frequents YahooMessenger or MSNM.
11 All spelling mistakes and flawed grammar are intentional.
12 """
13
14 from util import *
15
16 reflections = {
17 "am" : "r",
18 "was" : "were",
19 "i" : "u",
20 "i'd" : "u'd",
21 "i've" : "u'v",
22 "ive" : "u'v",
23 "i'll" : "u'll",
24 "my" : "ur",
25 "are" : "am",
26 "you're" : "im",
27 "you've" : "ive",
28 "you'll" : "i'll",
29 "your" : "my",
30 "yours" : "mine",
31 "you" : "me",
32 "u" : "me",
33 "ur" : "my",
34 "urs" : "mine",
35 "me" : "u"
36 }
37
38
39
40
41 pairs = (
42 (r'I\'m (.*)',
43 ( "ur%1?? that's so cool! kekekekeke ^_^ tell me more!",
44 "ur%1? neat!! kekeke >_<")),
45
46 (r'(.*) don\'t you (.*)',
47 ( "u think I can%2??! really?? kekeke \<_\<",
48 "what do u mean%2??!",
49 "i could if i wanted, don't you think!! kekeke")),
50
51 (r'ye[as] [iI] (.*)',
52 ( "u%1? cool!! how?",
53 "how come u%1??",
54 "u%1? so do i!!")),
55
56 (r'do (you|u) (.*)\??',
57 ( "do i%2? only on tuesdays! kekeke *_*",
58 "i dunno! do u%2??")),
59
60 (r'(.*)\?',
61 ( "man u ask lots of questions!",
62 "booooring! how old r u??",
63 "boooooring!! ur not very fun")),
64
65 (r'(cos|because) (.*)',
66 ( "hee! i don't believe u! >_<",
67 "nuh-uh! >_<",
68 "ooooh i agree!")),
69
70 (r'why can\'t [iI] (.*)',
71 ( "i dunno! y u askin me for!",
72 "try harder, silly! hee! ^_^",
73 "i dunno! but when i can't%1 i jump up and down!")),
74
75 (r'I can\'t (.*)',
76 ( "u can't what??! >_<",
77 "that's ok! i can't%1 either! kekekekeke ^_^",
78 "try harder, silly! hee! ^&^")),
79
80 (r'(.*) (like|love|watch) anime',
81 ( "omg i love anime!! do u like sailor moon??! ^&^",
82 "anime yay! anime rocks sooooo much!",
83 "oooh anime! i love anime more than anything!",
84 "anime is the bestest evar! evangelion is the best!",
85 "hee anime is the best! do you have ur fav??")),
86
87 (r'I (like|love|watch|play) (.*)',
88 ( "yay! %2 rocks!",
89 "yay! %2 is neat!",
90 "cool! do u like other stuff?? ^_^")),
91
92 (r'anime sucks|(.*) (hate|detest) anime',
93 ( "ur a liar! i'm not gonna talk to u nemore if u h8 anime *;*",
94 "no way! anime is the best ever!",
95 "nuh-uh, anime is the best!")),
96
97 (r'(are|r) (you|u) (.*)',
98 ( "am i%1??! how come u ask that!",
99 "maybe! y shud i tell u?? kekeke >_>")),
100
101 (r'what (.*)',
102 ( "hee u think im gonna tell u? .v.",
103 "booooooooring! ask me somethin else!")),
104
105 (r'how (.*)',
106 ( "not tellin!! kekekekekeke ^_^",)),
107
108 (r'(hi|hello|hey) (.*)',
109 ( "hi!!! how r u!!",)),
110
111 (r'quit',
112 ( "mom says i have to go eat dinner now :,( bye!!",
113 "awww u have to go?? see u next time!!",
114 "how to see u again soon! ^_^")),
115
116 (r'(.*)',
117 ( "ur funny! kekeke",
118 "boooooring! talk about something else! tell me wat u like!",
119 "do u like anime??",
120 "do u watch anime? i like sailor moon! ^_^",
121 "i wish i was a kitty!! kekekeke ^_^"))
122 )
123
124 iesha_chatbot = Chat(pairs, reflections)
125
127 print "Iesha the TeenBoT\n---------"
128 print "Talk to the program by typing in plain English, using normal upper-"
129 print 'and lower-case letters and punctuation. Enter "quit" when done.'
130 print '='*72
131 print "hi!! i'm iesha! who r u??!"
132
133 iesha_chatbot.converse()
134
137
138 if __name__ == "__main__":
139 demo()
140