是否可以使用现有数据库训练聊天机器人(使用Chatterbot(?
我有一个相对较大的sqlite3 db文件,其对话价值约为3GB。如果可能只能从该数据库中提取答案,而不是将其转换为JSON,然后创建自己的语料库,我想这样做。
那就是我遵循他们的教程时。
from chatterbot import ChatBot
bot = ChatBot( "Terminal",
storage_adapter="chatterbot.storage.SQLStorageAdapter",
logic_adapters=[
"chatterbot.logic.MathematicalEvaluation",
"chatterbot.logic.TimeLogicAdapter",
"chatterbot.logic.BestMatch"
],
input_adapter="chatterbot.input.TerminalAdapter",
output_adapter="chatterbot.output.TerminalAdapter",
database="database.db"
)
print("Type something to begin...")
while True:
try:
bot_input = bot.get_response(None)
except (KeyboardInterrupt, EOFError, SystemExit):
break
它不会从中提出答案。它忽略它并使用自己的培训数据。
是可能的,但是您需要编写自己的Trainer
类才能阅读SQLite文件的内容,以便可以对其进行培训。
另一种方法是编写脚本以将您的SQLite数据转换为培训语料库格式,以便您可以使用现有方法使用它来训练Bot。
有关语料库格式的更多信息可以在此处找到:http://chatterbot-corpus.readthedocs.io/en/latest/data.html