Skip to main content

Component for annotating text for Argument Mining and NLP resolution

Project description

st-annotator

PyPI version

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.

Demo on Streamlit Cloud

Open in Streamlit

New Features

  • Key parameter to text_annotator function
  • A special button to show all the annotations together

Animated Examples

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.2.tar.gz (420.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

st_annotator-0.0.2-py3-none-any.whl (429.5 kB view details)

Uploaded Python 3

File details

Details for the file st_annotator-0.0.2.tar.gz.

File metadata

  • Download URL: st_annotator-0.0.2.tar.gz
  • Upload date:
  • Size: 420.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.8

File hashes

Hashes for st_annotator-0.0.2.tar.gz
Algorithm Hash digest
SHA256 36f151af8d6ec1efe9a0219268ed0c7e1f0d234bbd65e83a55bdd342b35ad1a0
MD5 91c5355a564c5e34d245a73a4a33a2de
BLAKE2b-256 041f3aff3be70fa276cede7c443d4a6d868fe1cb924c4766622e60083ca071b5

See more details on using hashes here.

File details

Details for the file st_annotator-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: st_annotator-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 429.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.8

File hashes

Hashes for st_annotator-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 085e8cbd47f0324b1162c742c1c6d9a79fbe83ddff6acfb9a6e77541896250f9
MD5 b7c0ead4c2dd88ea26d5e4725c963173
BLAKE2b-256 f58fe94b8ab0a62fa1ee95a9f9f8927a99547131074c1edb94119d8eecd87af4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page