Spancat Visualization with displacy #10249
-
I was able to build a pipeline with spancat. When I attempted to "evaluate" the model using the CLI I did not get any HTML output. I am assuming this is because the spancat feature is experimental and displacy only supports "ent" and "dep" styles Any direction or guidance on how I can get spancat visualizations similar to "ent" with displacy or other tool would be greatly appreciated. This is the CLI command that I ran to attempt to get some html output. python -m spacy evaluate "E:\projectdir\spancatout\model-best" "E:\projectdir\spancat\dev.spacy" --output spancat-eval.json --displacy-path spancat-eval-html |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @adidonatocda , You're correct, as it's experimental, Spans aren't supported in displacy. However, if you still wish to render them, a hacky way might be to copy the spans from However, if you have overlapping spans within the same span type, this hacky way will not work. |
Beta Was this translation helpful? Give feedback.
Hi @adidonatocda ,
You're correct, as it's experimental, Spans aren't supported in displacy. However, if you still wish to render them, a hacky way might be to copy the spans from
doc.spans[spans_key]
todoc.ents
while being careful of the overlaps, and render each entity one-by-one. This assumes that there are no overlaps within a span type. Once you've rendered each span type, you can combine them manually into a single HTML output.However, if you have overlapping spans within the same span type, this hacky way will not work.