最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

python 3.x - Trying to create chatbot on M1, vscode. Using chatterbot but getting errors with spacy - Stack Overflow

programmeradmin1浏览0评论

Hi I am trying to create a chatbot using chatterbot, any ideas on what I should do regarding the error?

my code:

///this is to just train the bot///


from chatterbot import ChatBot 
from chatterbot.trainers import ListTrainer 

bot = ChatBot("chatbot", read_only = False, logic_adapters = ["chaetterbot.logic.BestMatch"])

list_to_train = [
                "Hi ",
                "Hi there ",
                "How are you? ",
                "Fine, thank you for asking ",
                "what's your name? ",
                "My name is chatbot ",
                "Who created you? ",
                "Ahh, good question, Majid is who created me ",
                "How old are you ",
                "I am ageless ",
                
]

list_trainer = ListTrainer(bot)

list_trainer.train(list_to_train)

error I am getting:

python3 -u "/Users/majid/Desktop/sampleB/chattt.py" majid@MAJIDs-MacBook-Air sampleB % python3 -u "/Users/majid/Desktop/sampleB/chattt.py" Traceback (most recent call last): File "/Users/majid/Desktop/sampleB/chattt.py", line 5, in bot = ChatBot("chatbot", read_only = False, logic_adapters = ["chaetterbot.logic.BestMatch"]) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chatterbot/chatterbot.py", line 28, in init self.storage = utils.initialize_class(storage_adapter, **kwargs) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chatterbot/utils.py", line 33, in initialize_class return Class(*args, **kwargs) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chatterbot/storage/sql_storage.py", line 20, in init super().init(**kwargs) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chatterbot/storage/storage_adapter.py", line 20, in init self.tagger = PosLemmaTagger(language=kwargs.get( File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chatterbot/tagging.py", line 13, in init self.nlp = spacy.load(self.language.ISO_639_1.lower()) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/spacy/init.py", line 50, in load return util.load_model( File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/spacy/util.py", line 330, in load_model raise IOError(Errors.E941.format(name=name, full=OLD_MODEL_SHORTCUTS[name])) OSError: [E941] Can't find model 'en'. It looks like you're trying to load a model from a shortcut, which is obsolete as of spaCy v3.0. To load the model, use its full name instead:

nlp = spacy.load("en_core_web_sm")

For more details on the available models, see the models directory: . If you want to create a blank model, use spacy.blank: nlp = spacy.blank("en")

currently running python 3.8.0, I've had issues installing spacy but managed at the end 'I think'. I've downloaded chatterbot, chatterbot-corpus, Jupyter, flask, pyyaml, but when I tried to download: python -m space download en, it says command not found. im new to this and could use help please

Hi I am trying to create a chatbot using chatterbot, any ideas on what I should do regarding the error?

my code:

///this is to just train the bot///


from chatterbot import ChatBot 
from chatterbot.trainers import ListTrainer 

bot = ChatBot("chatbot", read_only = False, logic_adapters = ["chaetterbot.logic.BestMatch"])

list_to_train = [
                "Hi ",
                "Hi there ",
                "How are you? ",
                "Fine, thank you for asking ",
                "what's your name? ",
                "My name is chatbot ",
                "Who created you? ",
                "Ahh, good question, Majid is who created me ",
                "How old are you ",
                "I am ageless ",
                
]

list_trainer = ListTrainer(bot)

list_trainer.train(list_to_train)

error I am getting:

python3 -u "/Users/majid/Desktop/sampleB/chattt.py" majid@MAJIDs-MacBook-Air sampleB % python3 -u "/Users/majid/Desktop/sampleB/chattt.py" Traceback (most recent call last): File "/Users/majid/Desktop/sampleB/chattt.py", line 5, in bot = ChatBot("chatbot", read_only = False, logic_adapters = ["chaetterbot.logic.BestMatch"]) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chatterbot/chatterbot.py", line 28, in init self.storage = utils.initialize_class(storage_adapter, **kwargs) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chatterbot/utils.py", line 33, in initialize_class return Class(*args, **kwargs) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chatterbot/storage/sql_storage.py", line 20, in init super().init(**kwargs) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chatterbot/storage/storage_adapter.py", line 20, in init self.tagger = PosLemmaTagger(language=kwargs.get( File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chatterbot/tagging.py", line 13, in init self.nlp = spacy.load(self.language.ISO_639_1.lower()) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/spacy/init.py", line 50, in load return util.load_model( File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/spacy/util.py", line 330, in load_model raise IOError(Errors.E941.format(name=name, full=OLD_MODEL_SHORTCUTS[name])) OSError: [E941] Can't find model 'en'. It looks like you're trying to load a model from a shortcut, which is obsolete as of spaCy v3.0. To load the model, use its full name instead:

nlp = spacy.load("en_core_web_sm")

For more details on the available models, see the models directory: https://spacy.io/models. If you want to create a blank model, use spacy.blank: nlp = spacy.blank("en")

currently running python 3.8.0, I've had issues installing spacy but managed at the end 'I think'. I've downloaded chatterbot, chatterbot-corpus, Jupyter, flask, pyyaml, but when I tried to download: python -m space download en, it says command not found. im new to this and could use help please

Share Improve this question edited Nov 16, 2024 at 20:20 Anna Andreeva Rogotulka 1,6909 gold badges19 silver badges23 bronze badges asked Nov 16, 2024 at 16:18 majidmajid 11 bronze badge 1
  • You've explicitly tagged apple-m1 here - does that mean you're not facing the same problem when using any other system? – Nico Haase Commented Jan 17 at 10:47
Add a comment  | 

1 Answer 1

Reset to default 0

To fix the error, install the SpaCy model with this command:

python -m spacy download en_core_web_sm

Then, update your code to:

import spacy
nlp = spacy.load("en_core_web_sm")

This should resolve the issue!

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论