NER-tagging with spaCy

We've discussed the incredible power and simplicity of spaCy before when we talked about POS-tagging and we will cite the same reasons when using spaCy for NER-tagging. In practice, if you've followed the previous chapter on POS-tagging, we have already finished our POS-tagging; since NER-tagging is part of spaCy's natural pipeline, simply processing a document with the pipeline means that along with being tokenized and POS-tagged, it has already been NER-tagged (not to mention dependency parsed too!).

Setting up our model involves the same steps we saw before.

import spacy
nlp = spacy.load('en')

Let's now decide some sentences we would like to NER-tag.

sent_0 = nlp(u'Donald Trump visited at the government headquarters ...

Get Natural Language Processing and Computational Linguistics now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.