Displacy for Custom NER
import spacy
nlp = spacy.load('en')
from spacy import displacy
def explain_text_entities(text):
doc = nlp(text)
for ent in doc.ents:
print(f'Entity: {ent}, Label: {ent.label_}, {spacy.explain(ent.label_)}')
displacy.render(doc, style='ent', jupyter=True)
t = 'No different than Apple ORG . To play a specific list of music you must have an Amazon of Spotify PRODUCT “plus/prime/etc” account. So you must pay to play “your” music. 3 CARDINAL stars for that reason. Everything else is great .'
explain_text_entities(t)
Entity: Apple ORG, Label: ORG, Companies, agencies, institutions, etc.
Entity: 3, Label: CARDINAL, Numerals that do not fall under another type
No different than
Apple ORG
ORG
. To play a specific list of music you must have an Amazon of Spotify PRODUCT “plus/prime/etc” account. So you must pay to play “your” music.
3
CARDINAL
CARDINAL stars for that reason. Everything else is great .