【发布时间】:2020-09-13 21:54:35
【问题描述】:
我有一段从示例中提取的代码。它在 repl.it 上运行良好,就像几秒钟后的响应一样。但是,过了一段时间,它开始在 1-3 分钟后返回响应,甚至更多或永远不会。
这开始在重新启动时突然发生。我尝试重置数据库。那没有帮助。然后我尝试制作一个新的repl。这也无济于事
这是我的代码:
from chatterbot import ChatBot
from chatterbot.trainers import ChatterBotCorpusTrainer
import logging
'''
This is an example showing how to train a chat bot using the
ChatterBot Corpus of conversation dialog.
'''
# Enable info level logging
logging.basicConfig(level=logging.INFO)
chatbot = ChatBot('Example Bot')
# Start by training our bot with the ChatterBot corpus data
chatbot.set_trainer(ChatterBotCorpusTrainer)
chatbot.train(
'chatterbot.corpus.english'
)
while True:
inp = input("=> ")
print(chatbot.get_response(inp))
它开始工作正常,但卡在:
/opt/virtualenvs/python3/lib/python3.8/site-packages/chatterbot/storage/jsonfile.py:24: UnsuitableForProductionWarning:The JsonFileStorageAdapter is not recommended for production environments.
warnings.warn(
=> Hello
INFO:chatterbot.adapters:Recieved input statement: Hello
INFO:chatterbot.adapters:"Hello" is a known statement
这里是repl链接:https://repl.it/@blackskull12/chatterbottest#main.py
如果我替换:
chatbot.set_trainer(ChatterBotCorpusTrainer)
chatbot.train(
'chatterbot.corpus.english'
)
到:
trainer = ChatterBotCorpusTrainer(chatbot)
trainer.train(
'chatterbot.corpus.english'
)
此更改在我的电脑上运行良好。但是在repl上给出错误。 ChatBot has no atribute 'find'
我不知道从哪里继续。谁能帮助我,让我的机器人重获新生?
【问题讨论】:
-
我希望这些信息量足够
标签: python artificial-intelligence bots chatterbot repl.it