mcamac / react-text-annotate

React components for interactively highlighting parts of text.
https://mcamac.github.io/react-text-annotate
MIT License
134 stars 52 forks source link

How do I draw annotations for a simple sentence #3

Closed jloveric closed 4 years ago

jloveric commented 6 years ago

I'm trying to use this just to draw annotations on text from an NER tagger. I have span, offset, and tag for text - which would just be rendered by this tool. There are multiple tags, (person, location...) and they would all be rendered on the same line. I believe I would be using your TextAnnotator as opposed to the token annotator as the spans and offsets are for the original text. It's not clear how to use this tool for that. I think it could be quite useful, but there are not enough examples or documentation.

Could you show how I would use this to render this simple text.

text="Mary lives in Oklahoma and works at Kaiser" with span and offsets a=[{start :0 ,end:4, tag : "Person"},{start :15, end:22, tag: "Location"},{start:37,end:42,tag:"Organization"}]

all 3 tags would be rendered in the same sentence (possibly with different colors). Again, I believe this would be using the TextAnnotator.

Thanks!

mcamac commented 4 years ago

Sorry for the delay. In case still relevant, new docs are live. Going to close but feel free to reopen.