spacy-pipeline
05-09-2022 || 23:38
Tags: #nlp #spacy
spacy-pipeline
Spacy pipeline is used to predict linguistic attribute of a text like,
- Part of Speech tags by spacy-pos
- Dependency Parsing by spacy-syntactic-dependency
- Named entities by spacy-named-entities
These models are trained on labeled example, and also can be fine tuned on more examples
import spacy
spacy.download('en_core_web_sm')
nlp = spacy.load('en_core_web_sm')
doc = nlp('She ate the pizza')
for token in doc:
print(token.pos_) # print the part of speech of the token
print(token.dep_) # print the dependency label
print(token.head.text) # parent token for the current token