# Visualize number vector on text using colored html
## Installation
`pip install html-text-color`
## Usage
Input:
```python
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](test_outputs/test_single.svg)
<br/>
Input:
```python
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](test_outputs/test_multiple.svg)
<br/>
Input:
```python
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](test_outputs/test_tokens.svg)
Raw data
{
"_id": null,
"home_page": null,
"name": "html-text-color",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "HTML, Language Model, color, text, visualization",
"author": null,
"author_email": "Yannik Keller <yannik@kelnet.de>",
"download_url": "https://files.pythonhosted.org/packages/82/06/7c8fe06256fffa7a4100ced09edb3349a477a968456bd94914eb45269620/html_text_color-0.0.10.tar.gz",
"platform": null,
"description": "# Visualize number vector on text using colored html\n## Installation\n`pip install html-text-color`\n\n## Usage\nInput:\n```python\nfrom html_text_color import from_text\nhtml = from_text([\"I\", \" am\", \" a\", \" sentence\", \".\"], [1, 2, 3, 4, 5], color_order=\"b\")\n```\nOutput html: \n![test_outputs/test_single.html](test_outputs/test_single.svg)\n<br/>\n\nInput:\n```python\nhtml = from_text(\n [[\"I\", \"\u2581am\", \"\u2581a\", \"\u2581sentence\", \".\"],\n [\"I\", \"\u2581am\", \"\u2581another\", \"\u2581sentence\", \".\"]],\n [[[1, 0, 5], [2, 0, 2], [3, 0, 3], [4, 0, 4], [5, 0, 5]],\n [[5, 0, 0], [4, 2, 0], [3, 4, 0], [2, 6, 0], [1, 8, 0]]],\n color_order=\"rgb\"\n)\n```\nOutput html: \n![test_outputs/test_multiple.html](test_outputs/test_multiple.svg)\n<br/>\n\nInput:\n```python\nfrom html_text_color import from_ids\nfrom transformers import AutoTokenizer\ntokenizer = AutoTokenizer.from_pretrained(\"gpt2\")\nhtml = from_ids(tokenizer.encode(\"I am a sentence.\"), tokenizer, [1, 2, 3, 4, 5])\n```\nOutput html: \n![test_outputs/test_tokens.html](test_outputs/test_tokens.svg)",
"bugtrack_url": null,
"license": "MIT License",
"summary": "Visualize number vector on text using colored html",
"version": "0.0.10",
"project_urls": null,
"split_keywords": [
"html",
" language model",
" color",
" text",
" visualization"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "54de2bb2b46756656663820d49ed3ff5cdea203e1d96089a9f337357d92e9bbf",
"md5": "7efe3b58cfa7280812945a19c91e687d",
"sha256": "c21fe1f40ec25492c38a740cb2e923f91ddcd44832f497dc3760db107c36acbe"
},
"downloads": -1,
"filename": "html_text_color-0.0.10-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7efe3b58cfa7280812945a19c91e687d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 4869,
"upload_time": "2024-04-07T13:09:42",
"upload_time_iso_8601": "2024-04-07T13:09:42.406385Z",
"url": "https://files.pythonhosted.org/packages/54/de/2bb2b46756656663820d49ed3ff5cdea203e1d96089a9f337357d92e9bbf/html_text_color-0.0.10-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "82067c8fe06256fffa7a4100ced09edb3349a477a968456bd94914eb45269620",
"md5": "dd24bc878c3ae6926ef7b6a3801e0193",
"sha256": "078b9e1b6e8ba8ca70a4de858450558a563b20407fb59f0ec6fba7ea56012ec3"
},
"downloads": -1,
"filename": "html_text_color-0.0.10.tar.gz",
"has_sig": false,
"md5_digest": "dd24bc878c3ae6926ef7b6a3801e0193",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 15219,
"upload_time": "2024-04-07T13:09:43",
"upload_time_iso_8601": "2024-04-07T13:09:43.539874Z",
"url": "https://files.pythonhosted.org/packages/82/06/7c8fe06256fffa7a4100ced09edb3349a477a968456bd94914eb45269620/html_text_color-0.0.10.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-07 13:09:43",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "html-text-color"
}