Visualize number vector on text using colored html
Project description
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:
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:
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:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
html_text_color-0.0.10.tar.gz
(15.2 kB
view details)
Built Distribution
File details
Details for the file html_text_color-0.0.10.tar.gz
.
File metadata
- Download URL: html_text_color-0.0.10.tar.gz
- Upload date:
- Size: 15.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 078b9e1b6e8ba8ca70a4de858450558a563b20407fb59f0ec6fba7ea56012ec3 |
|
MD5 | dd24bc878c3ae6926ef7b6a3801e0193 |
|
BLAKE2b-256 | 82067c8fe06256fffa7a4100ced09edb3349a477a968456bd94914eb45269620 |
File details
Details for the file html_text_color-0.0.10-py3-none-any.whl
.
File metadata
- Download URL: html_text_color-0.0.10-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c21fe1f40ec25492c38a740cb2e923f91ddcd44832f497dc3760db107c36acbe |
|
MD5 | 7efe3b58cfa7280812945a19c91e687d |
|
BLAKE2b-256 | 54de2bb2b46756656663820d49ed3ff5cdea203e1d96089a9f337357d92e9bbf |