-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchattest.py
29 lines (25 loc) · 894 Bytes
/
chattest.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
from chatterbot import ChatBot
# Uncomment the following line to enable verbose logging
# logging.basicConfig(level=logging.INFO)
# Create a new ChatBot instance
chatbot = ChatBot('Terminal',
storage_adapter="chatterbot.adapters.storage.JsonFileStorageAdapter",
database="./database.json",
silence_performance_warning=True,
logic_adapters=[
'chatterbot.adapters.logic.ClosestMatchAdapter'
],
filters=[
'chatterbot.filters.RepetitiveResponseFilter'
],
read_only=True,
input_adapter='chatterbot.adapters.input.TerminalAdapter',
output_adapter='chatterbot.adapters.output.TerminalAdapter',
trainer='chatterbot.trainers.ChatterBotCorpusTrainer'
)
while True:
try:
bot_input = chatbot.get_response(None)
# Press ctrl-c or ctrl-d on the keyboard to exit
except (KeyboardInterrupt, EOFError, SystemExit):
break