explosion / explosion/spacy-streamlit
Visualization of nested spans
- Dominant language
- Python
- Stars
- 863
- Forks
- 113
- PR merge metrics
- No merged PRs in 30d
Description
Dear all,
I'm trying to use the new span visualizer to display some custom, nested spans predicted by spancat.
This is my code:
```
MODEL_PATH = # ...
DEFAULT_TEXT = """Cetuximab ist ein monoklonaler Antikörper, der gegen den epidermalen Wachstumsfaktorrezeptor (EGFR) gerichtet ist und \
dient zur Therapie des fortgeschrittenen kolorektalen Karzinoms zusammen mit Irinotecan oder in Kombination mit FOLFOX bzw. \
allein nach Versagen einer Behandlung mit Oxaliplatin und Irinotecan."""
st.set_page_config(layout="wide")
text = st.text_area("Text to analyze", DEFAULT_TEXT)
doc = process_text(MODEL_PATH, text)
visualize_spans(doc, spans_key="snomed", displacy_options=
{"colors": {
"Clinical_Drug": "#99FF99", "External_Substance" : "#CCFFCC", "Nutrient_or_Body_Substance" : "#E5FFCC",
"Therapeutic" : "#66B2FF", "Diagnostic" : "#CCE5FF",
"Other_Finding" : "#FFE5CC", "Diagnosis_or_Pathology" : "#FFCCCC"}} )
```

The nested spans are all shown on the same line, which makes it very hard to read.
I learned from the feature on LinkedIn, where a video was shown with nested spans nicely displayed.

How can I achieve this behavior? Do I need to pass some other options?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.