Skip to main content

Visualize number vector on text using colored html

Installation

pip install html-text-color

Usage

Input:

from html_text_color import from_text
html = from_text(["I", " am", " a", " sentence", "."], [1, 2, 3, 4, 5], color_order="b")

Output html:
test_outputs/test_single.html

Input:

html = from_text(
    [["I", "▁am", "▁a", "▁sentence", "."],
    ["I", "▁am", "▁another", "▁sentence", "."]],
    [[[1, 0, 5], [2, 0, 2], [3, 0, 3], [4, 0, 4], [5, 0, 5]],
    [[5, 0, 0], [4, 2, 0], [3, 4, 0], [2, 6, 0], [1, 8, 0]]],
    color_order="rgb"
)

Output html:
test_outputs/test_multiple.html

Input:

from html_text_color import from_ids
from transformers import AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("gpt2")
html = from_ids(tokenizer.encode("I am a sentence."), tokenizer, [1, 2, 3, 4, 5])

Output html:
test_outputs/test_tokens.html

Metadata

Release files for html-text-color 0.0.10

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

Source distribution (sdist)

Source distribution for html-text-color 0.0.10
File Size Uploaded Provenance Actions
html_text_color-0.0.10.tar.gz 15.2 kB Without provenance Details for html_text_color-0.0.10.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for html-text-color 0.0.10
File Interpreter ABI Platform Actions
html_text_color-0.0.10-py3-none-any.whl Python 3 none any Details for html_text_color-0.0.10-py3-none-any.whl

Total release size: 20.1 kB

Release files / html_text_color-0.0.10.tar.gz

Download URL html_text_color-0.0.10.tar.gz
Size 15.2 kB
Tags Source
SHA-256 checksum
How to use checksums
078b9e1b6e8ba8ca70a4de858450558a563b20407fb59f0ec6fba7ea56012ec3
BLAKE2b-256 checksum
How to use checksums
82067c8fe06256fffa7a4100ced09edb3349a477a968456bd94914eb45269620
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.0.0 CPython/3.12.2

Release files / html_text_color-0.0.10-py3-none-any.whl

Download URL html_text_color-0.0.10-py3-none-any.whl
Size 4.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c21fe1f40ec25492c38a740cb2e923f91ddcd44832f497dc3760db107c36acbe
BLAKE2b-256 checksum
How to use checksums
54de2bb2b46756656663820d49ed3ff5cdea203e1d96089a9f337357d92e9bbf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.0.0 CPython/3.12.2

Security for html-text-color 0.0.10

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