Sadra
Sadra

Reputation: 2822

Move spacy NER entity labels to top or bottom

I am using a spacy visualizer to show labels of each span. I am trying to put the NER labels to the top or bottom of the text for better visualization and comparison. At the moment, I can visualize them with:

nlp=spacy.load("en_core_web_sm")
doc = nlp("This is from Texas Written by Ryan on sunday")
displacy.render(doc,style="ent",jupyter=True)

as: enter image description here

How can I move these entity labels to the top or bottom or left of the span?

The documentation on setting options is here; there is no explanation on how to do this.

Upvotes: 2

Views: 167

Answers (1)

Hiren Namera
Hiren Namera

Reputation: 424

You can not do it using options but if you want to do it any way then clone Spacy from here and go to this file. There is one function render_ents There is HTML Formatting of Renderer there make changes in that Function and Build to test.

Upvotes: 2

Related Questions