-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Closed
Labels
bugBugs and behaviour differing from documentationBugs and behaviour differing from documentationfeat / visualizersFeature: Built-in displaCy and other visualizersFeature: Built-in displaCy and other visualizers
Description
Hello,
I'm trying to display spans with displacy render where I built the span manually.
Several spans can be overlapped.
Sometimes when there are more than 3 spans overlapping, the rendering fails to render properly.
In the following image spans on the second line have 1 token in common so the render should have done 3 lines, instead it overlapped them.

How to reproduce the behaviour
doc_rendering = {
"text": "Welcome to the Bank of China.",
"spans": [
{"start_token": 2, "end_token": 5, "label": "SkillNC"},
{"start_token": 0, "end_token": 2, "label": "Skill"},
{"start_token": 1, "end_token": 3, "label": "Skill"},
],
"tokens": ["Welcome", "to", "the", "Bank", "of", "China", "."],
}
from spacy import displacy
html = displacy.render(
doc_rendering,
style="span",
manual=True,
options={"colors": {"Skill": "#56B4E9", "SkillNC": "#FF5733"}},
)
Your Environment
- Operating System: linux
- Python Version Used: 3.10
- spaCy Version Used: 3.6.1
- Environment Information: conda 23.5.2
Thanks for your help :)
Metadata
Metadata
Assignees
Labels
bugBugs and behaviour differing from documentationBugs and behaviour differing from documentationfeat / visualizersFeature: Built-in displaCy and other visualizersFeature: Built-in displaCy and other visualizers