为什么聊天机器人不能在这段代码中工作?

问题描述 投票:1回答:1

我有一个导入chatterbot的代码。我运行python -m spacy download en python terminal1.py。

terminal1.py''''导入spacy

from chatterbot import ChatBot

# Uncomment the following lines to enable verbose logging
# import logging
# logging.basicConfig(level=logging.INFO)

# Create a new instance of a ChatBot
bot = ChatBot(
    'Terminal',
     storage_adapter='chatterbot.storage.SQLStorageAdapter',
     logic_adapters=[
        'chatterbot.logic.MathematicalEvaluation',
        'chatterbot.logic.TimeLogicAdapter',
        'chatterbot.logic.BestMatch'
    ],
    database_uri='sqlite:///database.db'
)

print('Type something to begin...')

# The following loop will execute each time the user enters input
while True:
    try:
        user_input = input()

        bot_response = bot.get_response(user_input)

        print(bot_response)

    # Press ctrl-c or ctrl-d on the keyboard to exit
    except (KeyboardInterrupt, EOFError, SystemExit):
        break

''''

我收到了错误

OSErrror:[E050]无法找到型号'en'。它似乎不是快捷方式链接,Python包或数据目录的有效路径。

有人可以帮助我解决这个问题,并在此过程中运行代码。我将非常感激。

spacy chatterbot
1个回答
0
投票

尝试运行此命令pip install spacy && python -m spacy download en这将链接到模型。

© www.soinside.com 2019 - 2024. All rights reserved.