-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot.py
24 lines (19 loc) · 813 Bytes
/
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
from chatterbot import ChatBot
from chatterbot.trainers import ListTrainer
from chatterbot.trainers import UbuntuCorpusTrainer
from chatterbot.logic import logic_adapter
chatbot = ChatBot('Divya',
storage_adapter='chatterbot.storage.MongoDatabaseAdapter',
logic_adapters=['chatterbot.logic.BestMatch', 'chatterbot.logic.MathematicalEvaluation', 'chatterbot.logic.TimeLogicAdapter'],
input_adapter='chatterbot.input.TerminalAdapter',
output_adapter='chatterbot.output.TerminalAdapter',
database='netdb'
)
chatbot.set_trainer(ListTrainer)
chatbot.train(['Hi', 'Hello'])
while True:
try:
response = chatbot.get_response(None)
except(KeyboardInterrupt, EOFError, TimeoutError):
break
print("Bye!")