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

Why does displacy only support showing one span key? #13474

Open
jianlins opened this issue May 3, 2024 · 0 comments
Open

Why does displacy only support showing one span key? #13474

jianlins opened this issue May 3, 2024 · 0 comments
Labels
enhancement Feature requests and improvements feat / doc Feature: Doc, Span and Token objects feat / visualizers Feature: Built-in displaCy and other visualizers

Comments

@jianlins
Copy link

jianlins commented May 3, 2024

As the span group is meant to support different groups of spans, would be more useful to enable displacy supporting other span keys at the same time?

import spacy
from spacy import displacy
from spacy.tokens import Span

text = "Welcome to the Bank of China."

nlp = spacy.blank("en")
doc = nlp(text)

doc.spans["dc"] = [
    Span(doc, 3, 6, "ORG")
]
doc.spans["sc"] = [
    Span(doc, 5, 6, "GPE"),
]

displacy.render(doc, style="span")
@jianlins jianlins changed the title Why does displacy only support showing the 'sc' span key? Why does displacy only support showing one span key? May 3, 2024
@svlandeg svlandeg added enhancement Feature requests and improvements feat / visualizers Feature: Built-in displaCy and other visualizers feat / doc Feature: Doc, Span and Token objects labels May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature requests and improvements feat / doc Feature: Doc, Span and Token objects feat / visualizers Feature: Built-in displaCy and other visualizers
Projects
None yet
Development

No branches or pull requests

2 participants