Skip to content

Commit

Permalink
I've changed line 26
Browse files Browse the repository at this point in the history
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.
```
  • Loading branch information
Pencoding1 authored Sep 20, 2021
1 parent 4ff8af2 commit 05467fd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion chatterbot/tagging.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ def __init__(self, language=None):

self.punctuation_table = str.maketrans(dict.fromkeys(string.punctuation))

self.nlp = spacy.load(self.language.ISO_639_1.lower())
if self.language.ISO_639_1.lower() == 'en':
self.nlp = spacy.load('en_core_web_sm')
else:
self.nlp = spacy.load(self.language.ISO_639_1.lower())

def get_text_index_string(self, text):
"""
Expand Down

0 comments on commit 05467fd

Please sign in to comment.