Skip to main content

Component for annotating text for NLP resolution

Project description

streamlit-annotation

Streamlit Annotation Tools

PyPI version Downloads Downloads Downloads

Streamlit Annotation Tools is a Streamlit component that gives you access to various annotation tools (labeling, annotation, etc.) for text data.

Demo

Try

Open in Streamlit

Text Highlighter

Text Labeler

Install

pip install streamlit-annotation-tools

Quick Use

Text Highlighter

Create an example.py file

from streamlit_annotation_tools import text_highlighter

text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean et hendrerit orci. Praesent auctor malesuada lobortis. Suspendisse ac elit bibendum, congue tellus vel, ornare ipsum. Mauris at tellus in turpis aliquet cursus."

annotations = text_highlighter(text)

Run:

streamlit run example.py

Output:

[
  [
    {"start": 0, "end": 5, "label": "Lorem"},
    {"start": 12, "end": 17, "label": "dolor"},
  ],
  [
    {"start": 6, "end": 11, "label": "ipsum"},
    {"start": 18, "end": 21, "label": "sit"},
  ],
]

Text Labeler

Create an example.py file

from streamlit_annotation_tools import text_labeler

text = "Yesterday, at 3 PM, Emily Johnson and Michael Smith met at the Central Park in New York to discuss the merger between TechCorp and Global Solutions. The deal, worth approximately 500 million dollars, is expected to significantly impact the tech industry. Later, at 6 PM, they joined a conference call with the CEO of TechCorp, David Brown, who was in London for a technology summit. During the call, they discussed the market trends in Asia and Europe and planned for the next quarterly meeting, which is scheduled for January 15th, 2024, in Paris."

labels = text_labeler(text)

Run:

streamlit run example.py

Output:

{
    "Personal names": [
        {"start": 20, "end": 33, "label": "Emily Johnson"},
        {"start": 38, "end": 51, "label": "Michael Smith"},
        {"start": 327, "end": 338, "label": "David Brown"},
    ],
    "Organizations": [
        {"start": 118, "end": 126, "label": "TechCorp"},
        {"start": 131, "end": 147, "label": "Global Solutions"},
    ],
    "Locations": [
        {"start": 63, "end": 75, "label": "Central Park"},
        {"start": 79, "end": 87, "label": "New York"},
        {"start": 351, "end": 357, "label": "London"},
        {"start": 436, "end": 440, "label": "Asia"},
        {"start": 445, "end": 451, "label": "Europe"},
        {"start": 542, "end": 547, "label": "Paris"},
    ],
    "Time": [
        {"start": 0, "end": 9, "label": "Yesterday"},
        {"start": 14, "end": 18, "label": "3 PM"},
        {"start": 265, "end": 269, "label": "6 PM"},
        {"start": 519, "end": 531, "label": "January 15th"},
        {"start": 533, "end": 537, "label": "2024"},
    ],
    "Money": [{"start": 179, "end": 198, "label": "500 million dollars"}],
}

Development

Install

git clone git@github.com:rmarquet21/streamlit-annotation-tools.git
cd streamlit-annotation-tools
pip install -e .

Run

streamlit run example.py

License

MIT

Author

Robin Marquet

Contributors

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

streamlit_annotation_tools-1.0.1.tar.gz (418.5 kB view details)

Uploaded Source

Built Distribution

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

streamlit_annotation_tools-1.0.1-py3-none-any.whl (429.9 kB view details)

Uploaded Python 3

File details

Details for the file streamlit_annotation_tools-1.0.1.tar.gz.

File metadata

  • Download URL: streamlit_annotation_tools-1.0.1.tar.gz
  • Upload date:
  • Size: 418.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.11.5 Darwin/22.6.0

File hashes

Hashes for streamlit_annotation_tools-1.0.1.tar.gz
Algorithm Hash digest
SHA256 1a6e8cf0ea57f47fada3cbfa6f0656cf3a5c940b20ae2db4699f55e57a0417a3
MD5 c06d1e10299c269c8729290f46261078
BLAKE2b-256 44b6f857280587c2cca862ff70942b2443eb50d352746cf5ccfc7bdd7907520f

See more details on using hashes here.

File details

Details for the file streamlit_annotation_tools-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for streamlit_annotation_tools-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3022565bed09b13ab700a5983adb3643acfb6681fe7a4f7501b696142912f6f0
MD5 edb792ff0c0a9c220ad2244a32fb5f95
BLAKE2b-256 d941794d4e554c6b7aef075175f999cb86305bb4bbc5355cccfc2fbc4c2d2cc9

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