-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathchatterBot.py
21 lines (21 loc) · 933 Bytes
/
chatterBot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from chatterbot import ChatBot
from chatterbot.trainers import ChatterBotCorpusTrainer
from chatterbot.trainers import ListTrainer
# bot = ChatBot(
# 'Sakura',
# storage_adapter='chatterbot.storage.MongoDatabaseAdapter'
# )
# trainer = ChatterBotCorpusTrainer(bot)
# trainer.train("chatterbot.corpus.chinese")
# trainer.train("chatterbot.corpus.english")
def bot():
bot = ChatBot("Zadis",logic_adapters=[{
'import_path': 'chatterbot.logic.BestMatch',
"statement_comparision_function": "chatterbot.comparisions.levenshtein_distance",
"response_selection_method": "chatterbot.response_selection.get_first_response"
}])
# bot.set_trainer(ListTrainer)
trainer=ChatterBotCorpusTrainer(bot)
# bot.set_trainer(ChatterBotCorpusTrainer)
trainer.train("chatterbot.corpus.chinese")
return bot