Skip to main content

version badge license badge

DOM tokenizers

DOM-aware tokenization for Hugging Face language models.

TL;DR

Input:

<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <meta name="viewport" content="width=device-width">
    <title>Hello world</title>
    <script>
    document.getElementById("demo").innerHTML = "Hello JavaScript!";
    </script>
    ...

Output:

<html><head><meta_httpequiv=contenttype_content=texthtmlcharsetUTF8><meta_name=viewport_content=widthdevicewidth><title>helloworld</title><script>documentgetElementByIddemoinnerHTMLHelloJavaScript</script>...

Installation

With PIP

pip install dom-tokenizers[train]

From sources

git clone https://github.com/gbenson/dom-tokenizers.git
cd dom-tokenizers
python3 -m venv .venv
. .venv/bin/activate
pip install --upgrade pip
pip install -e .[dev,train]

Train a tokenizer

On the command line

Check everything's working using a small dataset of around 300 examples:

train-tokenizer gbenson/interesting-dom-snapshots

Train a tokenizer with a 10,000-token vocabulary using a dataset of 4,536 examples and upload it to the Hub:

train-tokenizer gbenson/webui-dom-snapshots -n 10000 -N 4536
huggingface-cli login
huggingface-cli upload dom-tokenizer-10k

Metadata

Release files for dom-tokenizers 0.0.17

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

Source distribution (sdist)

Source distribution for dom-tokenizers 0.0.17
File Size Uploaded Provenance Actions
dom_tokenizers-0.0.17.tar.gz 85.1 kB Without provenance Details for dom_tokenizers-0.0.17.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dom-tokenizers 0.0.17
File Interpreter ABI Platform Actions
dom_tokenizers-0.0.17-py3-none-any.whl Python 3 none any Details for dom_tokenizers-0.0.17-py3-none-any.whl

Total release size: 113.7 kB

Release files / dom_tokenizers-0.0.17.tar.gz

Download URL dom_tokenizers-0.0.17.tar.gz
Size 85.1 kB
Tags Source
SHA-256 checksum
How to use checksums
b20f7fb0add1414a645b4c7cb5143b005432bb55fdadcd7765511fcbc1de7774
BLAKE2b-256 checksum
How to use checksums
df42a22c3aeca3674b38f2dd90d491ee95c612d93cc8d341ebfb86bff053ea45
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.4

Release files / dom_tokenizers-0.0.17-py3-none-any.whl

Download URL dom_tokenizers-0.0.17-py3-none-any.whl
Size 28.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1e14b260d25b0823db01aaf66ee08f836d7140a9aba9779ce899079ae6cfde6d
BLAKE2b-256 checksum
How to use checksums
e15fdc2631c1a691e53534e811d602642cbfc087a722021c766d6bb3bf58868b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.4

Security for dom-tokenizers 0.0.17

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