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?


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.


1 Like