Last active
November 30, 2020 02:33
-
-
Save chiefastro/e187105dd743af32691747bb8c9bd745 to your computer and use it in GitHub Desktop.
Visualizing named entity recognition with spaCy and 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') | |
# sentence with entities | |
text = """In 2015, independent researchers from Emory University and Yahoo! Labs showed that spaCy offered the fastest syntactic parser in the world and that its accuracy was within 1% of the best available.""" | |
# apply pipeline | |
doc = nlp(text) | |
# visualize | |
displacy.render(doc, style='ent', jupyter=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment