|
from chatterbot import ChatBot |
|
from chatterbot.trainers import ChatterBotCorpusTrainer |
|
|
|
|
|
|
|
class Tron(): |
|
def __init__(self): |
|
|
|
self.bot = ChatBot( |
|
'Norman', |
|
storage_adapter='chatterbot.storage.SQLStorageAdapter', |
|
logic_adapters=['chatterbot.logic.MathematicalEvaluation','chatterbot.logic.BestMatch'], |
|
database_uri='sqlite:///database.sqlite3' |
|
) |
|
|
|
trainer = ChatterBotCorpusTrainer(self.bot) |
|
trainer.train("chatterbot.corpus.english") |
|
trainer.train("chatterbot.corpus.english.greetings") |
|
trainer.train("chatterbot.corpus.english.conversations") |
|
|
|
|
|
|
|
|
|
def reply(self, msg): |
|
if msg: |
|
bot_out = self.bot.get_response(msg) |
|
return bot_out |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|