Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I've changed line 26 #2201

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

Pencoding1
Copy link

I thought it need to be changed because some people (like me) will meet this error when run chatterbot.
traceback like:

Traceback (most recent call last):
  File "c:/Users/cccc0/Documents/GitHub/Mieno/MienoBot/DiscordBot.py", line 3, in <module>
    from ChatterBot import BotCore
  File "c:\Users\cccc0\Documents\GitHub\Mieno\MienoBot\ChatterBot\BotCore.py", line 6, in <module>
    Mieno = ChatBot('Mieno')
  File "C:\Users\cccc0\AppData\Local\Programs\Python\Python37\lib\site-packages\chatterbot\chatterbot.py", line 28, in __init__
    self.storage = utils.initialize_class(storage_adapter, **kwargs)
  File "C:\Users\cccc0\AppData\Local\Programs\Python\Python37\lib\site-packages\chatterbot\utils.py", line 33, in initialize_class
    return Class(*args, **kwargs)
    super().__init__(**kwargs)
  File "C:\Users\cccc0\AppData\Local\Programs\Python\Python37\lib\site-packages\chatterbot\storage\storage_adapter.py", line 21, in __init__
    'tagger_language', languages.ENG
  File "C:\Users\cccc0\AppData\Local\Programs\Python\Python37\lib\site-packages\chatterbot\tagging.py", line 13, in __init__
    self.nlp = spacy.load(self.language.ISO_639_1.lower())
  File "C:\Users\cccc0\AppData\Local\Programs\Python\Python37\lib\site-packages\spacy\__init__.py", line 30, in load
    return util.load_model(name, **overrides)
  File "C:\Users\cccc0\AppData\Local\Programs\Python\Python37\lib\site-packages\spacy\util.py", line 175, in load_model
    raise IOError(Errors.E050.format(name=name))
OSError: [E050] Can't find model 'en'. It doesn't seem to be a shortcut link, a Python package or a valid path to a data directory.

I thought it need to be changed because some people (like me) will meet this error when run chatterbot.
traceback like:
```
Traceback (most recent call last):
  File "c:/Users/cccc0/Documents/GitHub/Mieno/MienoBot/DiscordBot.py", line 3, in <module>
    from ChatterBot import BotCore
  File "c:\Users\cccc0\Documents\GitHub\Mieno\MienoBot\ChatterBot\BotCore.py", line 6, in <module>
    Mieno = ChatBot('Mieno')
  File "C:\Users\cccc0\AppData\Local\Programs\Python\Python37\lib\site-packages\chatterbot\chatterbot.py", line 28, in __init__
    self.storage = utils.initialize_class(storage_adapter, **kwargs)
  File "C:\Users\cccc0\AppData\Local\Programs\Python\Python37\lib\site-packages\chatterbot\utils.py", line 33, in initialize_class
    return Class(*args, **kwargs)
    super().__init__(**kwargs)
  File "C:\Users\cccc0\AppData\Local\Programs\Python\Python37\lib\site-packages\chatterbot\storage\storage_adapter.py", line 21, in __init__
    'tagger_language', languages.ENG
  File "C:\Users\cccc0\AppData\Local\Programs\Python\Python37\lib\site-packages\chatterbot\tagging.py", line 13, in __init__
    self.nlp = spacy.load(self.language.ISO_639_1.lower())
  File "C:\Users\cccc0\AppData\Local\Programs\Python\Python37\lib\site-packages\spacy\__init__.py", line 30, in load
    return util.load_model(name, **overrides)
  File "C:\Users\cccc0\AppData\Local\Programs\Python\Python37\lib\site-packages\spacy\util.py", line 175, in load_model
    raise IOError(Errors.E050.format(name=name))
OSError: [E050] Can't find model 'en'. It doesn't seem to be a shortcut link, a Python package or a valid path to a data directory.
```
Copy link

@BCurbs BCurbs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code solves a problem I had. It seems to work.

Copy link

@Omarzintan Omarzintan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here. Replacing line 26 with these lines solves the same issue in using Chatterbot for me.

@gnovaro
Copy link

gnovaro commented Jan 6, 2024

Before use spacy you need to download base models.
For example:
python3 -m spacy download es_core_news_sm

explosion/spaCy#1721

Copy link

@vignesh1507 vignesh1507 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with the changes, could you add a type hint above your changed code so that everyone could understand what the code does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants