Reputation: 9
# load the model
nlp = spacy.load('en_core_web_sm')
# check the same string with spaCy
string = "Our Deeds are the Reason of this #earthquake May ALLAH Forgive us all"
print([(token.text, token.pos_) for token in nlp(string) if token.pos_=='PROPN'])
I am trying to run this code and I am getting below error.
OSError Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_17348\4216200013.py in <module>
1 # load the model
----> 2 nlp = spacy.load('en_core_web_sm')
3
4 # check the same string with spaCy
5 string = "Our Deeds are the Reason of this #earthquake May ALLAH Forgive us all"
~\anaconda3\lib\site-packages\spacy\__init__.py in load(name, vocab, disable, enable, exclude, config)
52 RETURNS (Language): The loaded nlp object.
53 """
---> 54 return util.load_model(
55 name,
56 vocab=vocab,
~\anaconda3\lib\site-packages\spacy\util.py in load_model(name, vocab, disable, enable, exclude, config)
437 if name in OLD_MODEL_SHORTCUTS:
438 raise IOError(Errors.E941.format(name=name, full=OLD_MODEL_SHORTCUTS[name])) # type: ignore[index]
--> 439 raise IOError(Errors.E050.format(name=name))
440
441
OSError: [E050] Can't find model 'en_core_web_sm'. It doesn't seem to be a Python package or a valid path to a data directory.
How can I resolve this issue?
Upvotes: 0
Views: 252
Reputation: 15623
You haven't downloaded the English pipeline. Try running:
spacy download en_core_web_sm
Upvotes: 0