Skip to main content

Text Highlighter

A Streamlit component for annotating text using text highlighting. Useful for NLP tasks.

Installation

You can install the Text Highlighter package using the following command:

pip install --upgrade text-highlighter

Usage

The package can be used as follows:

from text_highlighter import text_highlighter
import streamlit as st

# Basic usage
result = text_highlighter(
    text="John Doe is the founder of MyComp Inc. and lives in New York with his wife Jane Doe.",
    labels=[("PERSON", "red"), ("ORG", "#0000FF")],
    # Optionally you can specify pre-existing annotations:
    annotations=[
        {"start": 0, "end": 8, "tag": "PERSON"},
        {"start": 27, "end": 38, "tag": "ORG"},
        {"start": 75, "end": 83, "tag": "PERSON"},
    ],
)

# Show the results (in XML format)
st.code(result.to_xml())

# Show the results (as a list)
st.write(result)

In the example.py script you can find the above example. You can run the example as follows:

streamlit run example.py

The output will look like this:

Example

Deployment

Run the following to build the front-end:

cd text_highlighter/frontend
npm run build

After that, you can build the package using the following command from the root directory:

python -m build

And then you can deploy it to PyPI using the following command:

twine upload dist/*

Contribute

Feel free to add a pull request or open an issue if you have any questions or suggestions.

Metadata

Release files for text-highlighter 0.0.15

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for text-highlighter 0.0.15
File Size Uploaded Provenance Actions
text_highlighter-0.0.15.tar.gz 1.0 MB Without provenance Details for text_highlighter-0.0.15.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for text-highlighter 0.0.15
File Interpreter ABI Platform Actions
text_highlighter-0.0.15-py3-none-any.whl Python 3 none any Details for text_highlighter-0.0.15-py3-none-any.whl

Total release size: 1.9 MB

Release files / text_highlighter-0.0.15.tar.gz

Download URL text_highlighter-0.0.15.tar.gz
Size 1.0 MB
Tags Source
SHA-256 checksum
How to use checksums
693e0550183db49d15567088b36cc234e20773b3d0ed1035054db62e7cfe5457
BLAKE2b-256 checksum
How to use checksums
878488060d8f9371e9843f2569f7e07ff24333f149fe699b98adf13b394f965d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.11.7

Release files / text_highlighter-0.0.15-py3-none-any.whl

Download URL text_highlighter-0.0.15-py3-none-any.whl
Size 928.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b74c58729749c7b0580ff7e4b92da41af3610a1bafc1a89edb8b58f7f51488cd
BLAKE2b-256 checksum
How to use checksums
0e80ac46b6e7920b0d9b6f80419ad29d4695a92cfa586e8ef9f85fce579dc437
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.11.7

Security for text-highlighter 0.0.15

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page