-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchatterbot_bot.py
53 lines (43 loc) · 1.22 KB
/
chatterbot_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
#supress all warnings
import warnings
warnings.filterwarnings("ignore")
from chatterbot import ChatBot
#bot = ChatBot('fan')
bot = ChatBot(
'Default Response Example Bot',
storage_adapter='chatterbot.storage.SQLStorageAdapter',
logic_adapters=[
{
'import_path': 'chatterbot.logic.BestMatch'
},
{
'import_path': 'chatterbot.logic.BestMatch',
'threshold': 0.90,
'default_response': 'I am sorry, but I do not understand.'
}
],
trainer='chatterbot.trainers.ListTrainer'
)
#import ListTrainer
from chatterbot.trainers import ListTrainer
trainer = ListTrainer(bot)
trainer.train(
"chatterbot.corpus.english"
)
trainer.train([
'Hi',
'Hello',
'I need your assistance regarding my order',
'Please, Provide me with your order id',
'I have a complaint.',
'Please elaborate, your concern',
'How long it will take to receive an order ?',
'An order takes 3-5 Business days to get delivered.',
'Okay Thanks',
'No Problem! Have a Good Day!'
])
while(1):
input_text = input("you: ")
response = bot.get_response(input_text)
print("fanbot: ", response)
# not working properly at all.