Feature request: receive selected text as user input

Hi Folks,

Thanks a lot for the tool you are building. I like it a lot for its simplicity and nice design.

My use case is visualizing preprocessing in an NLP pipeline. I’m showing some text using st.markdown() and inside the text I’m using HTML tags to e.g. specify different font and background colors, or to strike through text.

However, now I would like to use streamlit to assist with data labeling. I would like to display some text, let the user select a portion of this text, and receive the selected portion as input in my script. Then the user would click r to get a new text, and so on.

Is it somehow possible to achieve that already now? And if not, do you think you could build in such a feature?

Cheers
Konstantin

1 Like

Hi @Konstantin_Miller, thanks for the suggestion. I think I get what you are saying, but is there a public example we could look at? With our upcoming component framework, this might not be too difficult to build, assuming there is a JavaScript library that already has this type of functionality built in.

Hi @randyzwitch,

There are tools such as https://inception-project.github.io/ or https://github.com/doccano/doccano. Here is an overview article: https://dida.do/blog/the-best-free-labeling-tools-for-text-annotation-in-nlp.

Those tools are a bit too heavy for my simple use case. At the same time, they are limited in the way they can present the text. That’s why I wanted to build something myself, if that wouldn’t take more than one or two days.

Cheers
Konstantin

2 Likes

Would love this feature as well, any updates?

Any updates over this feature?

I also would like the same,

GitHub - tvst/st-annotated-text: A simple component to display annotated text in Streamlit apps. made a really great job for displaying tags, but being able to select it with the mouse and click a button or a key to annotate it would be really great for all the nlp community!

Hi, I just created a Streamlit component that does exactly that: GitHub: text-highlighter. If you have any ideas or suggestions for improvement, please let me know!

3 Likes

Just for information, there’s another similar component at GitHub - tvst/st-annotated-text: A simple component to display annotated text in Streamlit apps.

Cheers

That should be marked as the solution.