Last active
June 24, 2020 03:54
-
-
Save ajayjapan/56c270aaa9bf266860268433d30336ad to your computer and use it in GitHub Desktop.
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
import spacy | |
nlp = spacy.load("en_core_web_sm") | |
article = "I have lived in Philadelphia for most of my life. I went to school in New York City." | |
doc = nlp(article) | |
[sent for sent in doc.ents] | |
# Output: [Philadelphia, New York City] | |
[sent.label_ for sent in doc.ents] | |
# Output: [‘GPE’, ‘GPE’] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment