Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spacy nlp = spacy.load("en_core_web_lg")

Tags:

python

nlp

spacy

I already have spaCy downloaded, but everytime I try the nlp = spacy.load("en_core_web_lg"), command, I get this error:

OSError: [E050] Can't find model 'en_core_web_lg'. It doesn't seem to be a shortcut link, a Python package or a valid path to a data directory.

I already tried

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

and this does not work like it would on my personal computer.

My question is how do I work around this? What directory specifically do I need to drop the spacy en model into on my computer so that it is found?

like image 546
acodejdatam Avatar asked Jun 06 '19 03:06

acodejdatam


People also ask

What is spaCy load (' En_core_web_lg ')?

Spacy is an advanced natural language library for text processing in python. Using it you can easily find the context of the text therefore very helpful for extracting meaningful information from the text. As the text can be of different languages and spacy is trained according to that.

What does NLP () do in spaCy?

NLP helps you extract insights from unstructured text and has several use cases, such as: Automatic summarization. Named entity recognition. Question answering systems.

What is En_core_web_lg?

The model (en_core_web_lg) is the largest English model of spaCy with size 788 MB.


1 Answers

For a Linux system run the below code in terminal if you would be using a virtual environment else skip first and second command :

python -m venv .env
source .env/bin/activate
pip install -U spacy
python -m spacy download en_core_web_lg

The downloaded language model can be found at :

/usr/local/lib/python3.6/dist-packages/en_core_web_lg -->
/usr/local/lib/python3.6/dist-packages/spacy/data/en_core_web_lg

For more documentation information refer https://spacy.io/usage

Hope it was helpful.

like image 63
Ajay Alex Avatar answered Sep 30 '22 18:09

Ajay Alex