Last active
November 30, 2020 02:33
-
-
Save chiefastro/6cb13720e92ab8031d2912f333e7785f to your computer and use it in GitHub Desktop.
Visualize a parsed dependency tree with displaCy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from spacy import displacy | |
import spacy | |
# load pre-trained model pipeline | |
nlp = spacy.load('en_core_web_sm') | |
# text document | |
text = 'spaCy is pretty cool.' | |
# apply pipeline | |
doc = nlp(text) | |
# display parsed dependency tree | |
displacy.render(doc, style='dep', jupyter=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment