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.7.tar.gz
(14.8 kB
view hashes)
Built Distribution
Close
Hashes for html_text_color-0.0.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd877b97a7a5c8809333799ef30a0163176ab83ad89f61d017954ce202e97efb |
|
MD5 | f0bf81306553b48c85dd3d3ab0f42f7a |
|
BLAKE2b-256 | f0e3b221d6da4ff1a79240c8c1280d742b15a58130391a9f4833f0f83e54aba0 |