python-3.x - chatterbot.logic.SpecificResponseAdapter 不工作
问题描述
我想开发自己的自定义聊天机器人,但在开发过程中遇到了一些问题,我想在chatterbot
. 有一个代码示例。
from chatterbot.trainers import ListTrainer
from chatterbot import ChatBot
from chatterbot.trainers import ChatterBotCorpusTrainer
bot = ChatBot('Mybot',
storage_adapter='chatterbot.storage.SQLStorageAdapter',
logic_adapters=[{'import_path': 'chatterbot.logic.SpecificResponseAdapter',
'input_text': 'Help me!',
'output_text': 'Ok'
}]) # Crate Chatbot
trainer = ListTrainer(bot)
text = open('/content/drive/My Drive/Chatbot/Data/data.txt').readlines()
trainer.train(text)
while True:
request = input("Your: ")
response = bot.get_response(request)
print("bot:",response)
这是输出:
Your: Help me!
bot: I am sorry, but I do not understand.
Your: 'Help me!'
bot: I am sorry, but I do not understand.
请帮我解决这个问题
解决方案
推荐阅读
- postgresql - 将 grafana(服务网格外)连接到服务网格内的数据源
- javascript - 获取 v-checkbox Vue.JS Vuetify 的状态
- android - 没有行的Android阅读光标
- javascript - 如何在发送到 Algolia 之前更改从 Parse 中提取的列名
- javascript - 如果用户已登录,Vue Router 不应重定向
- here-api - 有没有办法使用 Places 自动建议入口点来显示 District?
- react-native - 我在使用带有自动链接的 react-native-vector-icons 时遇到了麻烦。无论如何它都不会运行
- python - 如何沿特定轴交替/切片堆叠numpy数组?
- c++ - C ++将CSV文件解析为向量向量:丢失字符串第一个字符
- flutter - 需要帮助每隔 x 秒更新一次图表数据