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

Visualization of nested spans #42

Open
phlobo opened this issue Sep 14, 2022 · 0 comments
Open

Visualization of nested spans #42

phlobo opened this issue Sep 14, 2022 · 0 comments

Comments

@phlobo
Copy link

phlobo commented Sep 14, 2022

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"}} )

myapp

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.

demo

How can I achieve this behavior? Do I need to pass some other options?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant