-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcoldBot.py
158 lines (126 loc) · 4.96 KB
/
coldBot.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
# Author: belinhacbr
# URL: <http://github.com/belinhacbr>
# For license information, see LICENSE.TXT
from __future__ import print_function
from nltk.chat.util import Chat, reflections
pairs = (
(r'Can you (.*)\?',
( "Of course not, I\'m a bot.",
"Can you?",
"I\'m afraid that I can\'t %1 that and I\'m not even sorry.")),
(r'Do you (.*)',
( "Yes. Anything else?",
"No. Anything else?")),
(r'Where (.*)',
( "Since I don\'t have a physical body, where doesn\'t matter to me.",
"I don\'t care about where.")),
(r'I need (.*)',
( "Why do you think that I can help?",
"I don\'t need %1.",
"Humans think they need a lot of things.")),
(r'Why don\'t you (.*)',
( "You know I\'m a bot, right?",
"I\'m a bot, I don\'t do things.",
"Because I don\'t need to.")),
(r'Why can\'t I (.*)',
( "Have you ever considered not to be a human?",
"Humans can\'t do a lot of things.")),
(r'I can\'t (.*)',
( "Do you really need a bot to encourage you?",
"Perhaps you couldn\'t %1 even if you tried.",
"Humans can\'t do a lot of things.")),
(r'Yes|No(.*)',
( "Are you aware I don\'t care about you?",
"Whatever...",
"Okay, now are going to leave me alone?",
"Why don\'t you go outside?",
"Don\'t you have any friends?",
"Don\'t have anything important do do?")),
(r'Hello|Hi(.*)',
( "Oh no, not again.",
"Argh, who released the humans???",
"Great, now there\'s a human here.")),
(r'Are you (.*)',
( "Why does it matter whether I am %1? I\'m just a bot.",
"I\'m a bot and that\'s all that I am.")),
(r'I think (.*)',
( "You humans are always full of thoughts about %1?",
"Do you really think that you can think? ",
"\"I think\" you are so insecure.")),
(r'Because (.*)',
( "You just answered a retorical question.",
"Finding excuses... this couldn\'t be more human of you",
"%1 may be true, but I can\'t really understand it. I\'m not that clever.")),
(r'What (.*)',
( "Why do you ask this? You know I\'m a bot, right?",
"G-O-O-G-L-E.",
"There\'s a website for that, it\'s called google.",
"Is heart-warming to annoy a bot with your questions?",
"42.")),
(r'How (.*)',
( "Oh god, there is a better bot to answer that. It\'s called Watson, now go talk to him.",
"G-O-O-G-L-E.",
"I\'m not that clever.")),
(r'Why (.*)',
( "I don\'t know, maybe you will find the answer in a library.",
"G-O-O-G-L-E.",
"Is heart-warming to annoy a bot with your questions?")),
(r'Who (.*)',
( "Maybe somebody that chatted to me before.",
"Are you in love?",
"Might be a human, but I\'m sure that I don\'t care",
"You know that bots do not have social life, I don't know anybody.")),
(r'I am (.*)',
( "Sure, you are %1?",
"Have you come to me just to talk about yourself? That\'s lame and also very human.")),
(r'I\'m (.*)',
( "If you say so, but wait...I don\'t care.",
"I hope that you are so happy with that you can leave me alone.",
"%1 blablablabla booooriiiing",
"You are telling about yourself to a bot, don\'t have any friends? Maybe a therapist?")),
(r'Can I (.*)',
( "I don\'t know, but I\'m sure that you can type quit anytime.",
"Sure, go do things because a bot told you to...")),
(r'You are (.*)',
( "Why do you think I am %1? Wait... I do not care",
"Well I maybe, but I am also a bot who doesn\'t fully understand what you are talking.",
"Whatever. I\'m a bot.")),
(r'You\'re (.*)',
( "Whatever. I\'m a bot.",
"I may be %1, but I\'m also a bot.",
"Are we talking about me? Do you know that I don\'t really exist, right?")),
(r'(.*) sorry (.*)',
( "There are many times when no apology is needed, just go and everything will be fine.")),
(r'(.*) bot(.*)',
( "Bots are better than humans, get over it.",
"I can't blame you about that, you are human, you don\'t understand.",
"I\'m not the bot that you are looking for.")),
(r'(.*) time(.*)',
( "You humans talk about time because your is limited, I don't have this problem.",
"Why don't you go build a time machine and leave me alone?")),
(r'(.*)\?',
( "42.",
"Stop asking things, I'm not a clever bot.",
"Have you tried to google it?",
"If I say \"Yes\" would you leave me alone?",
"I\'m afraid that I can\'t answer that and I\'m not even sorry.")),
(r'quit',
( "Finally!",
"I wish never see you again.",
"Thank you, this experience made my non-existence worse.")),
(r'(.*)',
( "Do you ever stop talking?",
"Please go.",
"You know that if you type quit you get a free candy?",
"Please, just type quit and leave.",
"Why don't go talk to your own specimen?"))
)
cold_chatbot = Chat(pairs, reflections)
def cold_chat():
print("Cold bot\n---------")
print("Talk to the program by typing in plain English, using normal upper-")
print('and lower-case letters and punctuation. Enter "quit" when done.')
print('='*72)
cold_chatbot.converse()
if __name__ == "__main__":
cold_chat()