-
Notifications
You must be signed in to change notification settings - Fork 1
/
SentiBot-demo.py
27 lines (22 loc) · 943 Bytes
/
SentiBot-demo.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
from chatterbot import ChatBot
from chatterbot.trainers import ChatterBotCorpusTrainer
chatbot = ChatBot( 'SentiBot',
storage_adapter='chatterbot.storage.SQLStorageAdapter',
output_adapter='chatterbot.data.TerminalAdapter',
logic_adapters=[
{
"import_path": "chatterbot.logic.BestMatch",
"statement_comparison_function": "chatterbot.comparisons.levenshtein_distance",
"response_selection_method": "chatterbot.response_selection.get_sentiment_response"
}
],
database='./db.sqlite3')
chatbot.set_trainer(ChatterBotCorpusTrainer)
chatbot.train(
"chatterbot.corpus.english"
)
while True:
try:
bot_input = chatbot.get_response( input() )
except(KeyboardInterrupt, EOFError, SystemExit):
break