Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Displacy render: Spans are overlapped when rendered. #13056

Closed
mchlsam opened this issue Oct 10, 2023 · 2 comments · Fixed by #13068
Closed

Displacy render: Spans are overlapped when rendered. #13056

mchlsam opened this issue Oct 10, 2023 · 2 comments · Fixed by #13068
Labels
bug Bugs and behaviour differing from documentation feat / visualizers Feature: Built-in displaCy and other visualizers

Comments

@mchlsam
Copy link

mchlsam commented Oct 10, 2023

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.
image

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 :)

@rmitsch rmitsch added bug Bugs and behaviour differing from documentation feat / visualizers Feature: Built-in displaCy and other visualizers labels Oct 11, 2023
@rmitsch
Copy link
Contributor

rmitsch commented Oct 17, 2023

Hi @mchlsam, thanks for reporting this! This looks like a bug - we'll look into it and update this thread.

Copy link
Contributor

github-actions bot commented Dec 3, 2023

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Bugs and behaviour differing from documentation feat / visualizers Feature: Built-in displaCy and other visualizers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants