Skip to content

Instantly share code, notes, and snippets.

@julien-c
Created August 30, 2017 15:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save julien-c/56c79cdcca6b7730b66d2462b0afcb64 to your computer and use it in GitHub Desktop.
Save julien-c/56c79cdcca6b7730b66d2462b0afcb64 to your computer and use it in GitHub Desktop.
Spacy NER
import spacy
nlp = spacy.load('en')
doc = nlp(text)
# At this point entity annotations are in `doc.ents`
for token in doc:
print tok.ent_iob_ + '-' + mapping[tok.ent_type_] # `I-PER`, etc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment