spaCy icon indicating copy to clipboard operation
spaCy copied to clipboard

Why does displacy only support showing one span key?

Open jianlins opened this issue 1 year ago • 0 comments

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 avatar May 03 '24 01:05 jianlins