How to visualize entities in spaCy
You can use the displacy visualization suite to visualize entities in spaCy.
In addition, you can use the render method to get HTML output for the visualization.
Sample code:
import spacy
from spacy import displacy
nlp = spacy.load("en_core_web_sm")
doc = nlp("Dialogflow, previously known as api.ai, is a chatbot framework provided by Google. Google acquired API.AI in 2016.")
html = displacy.render([doc], style="ent", page=True)
print(html)
Here is the HTML output:
Dialogflow, previously known as api.ai, is a chatbot framework provided by
Google
ORG
.
Google
ORG
acquired API.AI in
2016
DATE
.