Download the package from PyPI: |
Try the demo on Streamlit Cloud: |
pip install st-annotator
st-annotator is a Streamlit component usefull to annotate text, expecially for NLP and Argument Mining purposes. Based on the original project Streamlit Annotation Tools of rmarquet21.
- 📍 Smart positioning that stays within screen bounds
- 📊 Shows text content, label category, position, and all custom metadata
- 🎨 Matches your custom color scheme
- ⚡ Instant display on hover, disappears on mouse leave
- 🔧 Supports strings, numbers, booleans, lists, and objects
- Key parameter to text_annotator function
- A special button to show all the annotations together
- 🆕 Hover Popup with Metadata: Hover over annotations to see detailed information including custom metadata
You can now add custom metadata to each annotation that will appear in a hover popup:
labels = {
"Sentiment": [
{
"start": 0,
"end": 20,
"label": "This is amazing!",
"metadata": {
"confidence": 0.95,
"emotion": "Joy",
"intensity": "High",
"source": "Customer feedback"
}
}
]
}
Run the example.py file:
streamlit run examples/example.py