Component for annotating text for NLP resolution
Project description
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.
New Features
- Custom colors to the labels
- Input textbox visible or hidden
Removed Features
- Highlighter tool
Annotator with input textbox (default)
Annotator without input textbox and custom colors
Annotator with custom colors
Install
pip install st-annotator
Quick Use
Text Annotator
Create an example.py file
from st_annotator import text_labeler
text = "Effects of globalization During the history of the world , every change has its own positive and negative sides . Globalization as a gradual change affecting all over the world is not an exception . Although it has undeniable effects on the economics of the world ; it has side effects which make it a controversial issue . <AC0> Some people prefer to recognize globalization as a threat to ethnic and religious values of people of their country </AC0> . They think that <AC1> the idea of globalization put their inherited culture in danger of uncontrolled change and make them vulnerable against the attack of imperialistic governments </AC1> . Those who disagree , believe that <AC2> globalization contribute effectively to the global improvement of the world in many aspects </AC2> . <AC3> Developing globalization , people can have more access to many natural resources of the world and it leads to increasing the pace of scientific and economic promotions of the entire world </AC3> . In addition , <AC4> they admit that globalization can be considered a chance for people of each country to promote their lifestyle through the stuffs and services imported from other countries </AC4> . Moreover , the proponents of globalization idea point out <AC5> globalization results in considerable decrease in global tension </AC5> due to <AC6> convergence of benefits of people of the world which is a natural consequence of globalization </AC6> . In conclusion , <AC7> I would rather classify myself in the proponents of globalization as a speeding factor of global progress </AC7> . I think it is more likely to solve the problems of the world rather than intensifying them ."
labels = text_annotator(text, labels, in_snake_case=False, show_label_input=True, colors={"label_input":"#ff9500", "Major Claim": "#a457d7", "Claim": "#3478f6", "Premise": "#5ac4be"})
Run:
streamlit run example.py
Output:
{
"Major Claim": [
{"start": 1467, "end": 1572, "label": "I would rather classify myself in the proponents of globalization as a speeding factor of global progress"}
],
"Claim": [
{"start": 330, "end": 445, "label": "Some people prefer to recognize globalization as a threat to ethnic and religious values of people of their country"},
{"start": 686, "end": 777, "label": "globalization contribute effectively to the global improvement of the world in many aspects"},
{"start": 1256, "end": 1320, "label": "globalization results in considerable decrease in global tension"}
],
"Premise": [
{"start": 477, "end": 636, "label": "the idea of globalization put their inherited culture in danger of uncontrolled change and make them vulnerable against the attack of imperialistic governments"},
{"start": 793, "end": 980, "label": "Developing globalization , people can have more access to many natural resources of the world and it leads to increasing the pace of scientific and economic promotions of the entire world"},
{"start": 1010, "end": 1182, "label": "they admit that globalization can be considered a chance for people of each country to promote their lifestyle through the stuffs and services imported from other countries"},
{"start": 1341, "end": 1435, "label": "convergence of benefits of people of the world which is a natural consequence of globalization"}
],
}
Development
Install
git clone <your-repository-url>
cd st-annotator
pip install -e .
Run
streamlit run example.py
License
MIT
Author
Ettore Caputo
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
st_annotator-0.0.1.tar.gz
(418.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
st_annotator-0.0.1-py3-none-any.whl
(428.0 kB
view details)
File details
Details for the file st_annotator-0.0.1.tar.gz.
File metadata
- Download URL: st_annotator-0.0.1.tar.gz
- Upload date:
- Size: 418.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc67a90b13e24f7cddb8d6469c8006954531cc428fd9f49db3461af0f78cd2ac
|
|
| MD5 |
1d72cb2eacd59a39568c1ade5c793bfc
|
|
| BLAKE2b-256 |
4c1101c0a56763b47be2ce1d0b96efe260c94b6e525b58d0c2f189d830811a91
|
File details
Details for the file st_annotator-0.0.1-py3-none-any.whl.
File metadata
- Download URL: st_annotator-0.0.1-py3-none-any.whl
- Upload date:
- Size: 428.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9581efc91bdb1019229b8047664aaf45f09dde1cc00839b69b3427c67eb5bccc
|
|
| MD5 |
0e7db68a6069800f869bc8b41a7ccfc8
|
|
| BLAKE2b-256 |
b5763e59898cc7feb05a968089e8890751dd1dcbcdeecaae47dee822cd1cee3c
|