-
Notifications
You must be signed in to change notification settings - Fork 0
/
bot.py
65 lines (51 loc) · 1.13 KB
/
bot.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
# -*- coding: utf-8 -*-
from chatterbot import ChatBot
from chatterbot.trainers import ListTrainer
top = {'Brand': 'M&S', 'type': 'shirt', 'Size': 'Medium','Color':'Blue','Price':'30$'}
bottom = {'Brand': 'M&S', 'type': 'short', 'Size': 'Medium','Color':'white','Price':'20$'}
var=7
chatbot = ChatBot("luis")
conversation = [
"Hello",
"Hi there!",
"How are you doing?",
"I'm doing great.",
"That is good to hear",
"Thank you.",
"You're welcome.",
"bye",
"See you"
]
chatbot.set_trainer(ListTrainer)
chatbot.train(conversation)
chatbot.train([
"Hi there!",
"Hello",
])
chatbot.train([
"Hi there!",
"Hello",
])
chatbot.train([
"Greetings!",
"Hello",
])
chatbot.train([
"How many people have seen you today?",
var
])
chatbot.train([
"What are you wearing?",
"im wearing a %s %s" %(top['Color'],top['type'])
])
chatbot.train([
"Greetings!",
"Hello",
])
say = raw_input("Ask something : ")
while(say!="bye"):
response = chatbot.get_response(say)
print(response)
say = raw_input("Ask something : ")
response = chatbot.get_response(say)
print(response)