tvst / st-annotated-text

A simple component to display annotated text in Streamlit apps.
Apache License 2.0
525 stars 41 forks source link

Feature request: handle overlapping annotations #18

Open swartchris8 opened 3 years ago

swartchris8 commented 3 years ago

I would love it if overlapping annotations could be handled though this would require substantial changes to annotation

tvst commented 3 years ago

Hmmm... yeah, that's a tough one API-wise. Any thoughts on how the API should look?

swartchris8 commented 3 years ago

The way that would be most natural to me is if annotations could be nested

lowest_level_annotation_tuple = ("is", "verb", "#8ef")
overlapping_annotation = (["This", lowest_level_annotation_tuple, "annotated"], "example", "#afa")

So annotations could be constructed from a list of space separated tokens and annotations instead of just constructing them from strings.

I know it complicates things quite a bit but would be nice for my use case!