Natural Language Processing with spaCy
Azadeh Mobasher
Principal Data Scientist
Sentiment analysis
Named entity recognition (NER)
spaCy is a free, open-source library for NLP in Python which:
spaCy
can be installed using the Python package manager pipspaCy
trained models can be downloaded
$ python3 pip install spacy
python3 -m spacy download en_core_web_sm
import spacy
nlp = spacy.load("en_core_web_sm")
spaCy
model en_core_web_sm
= nlp
objectnlp
object converts text into a Doc
object (container) to store processed textspaCy
import spacy
nlp = spacy.load("en_core_web_sm")
text = "A spaCy pipeline object is created."
doc = nlp(text)
Token
is defined as the smallest meaningful part of the text.print([token.text for token in doc])
['A', 'spaCy', 'pipeline', 'object', 'is', 'created', '.']
Natural Language Processing with spaCy