Qtok: Quality Control Tool for Tokenizers
Qtok is a Python-based tool designed for quality control and analysis of tokenizers used in natural language processing (NLP) tasks.
Features
- Analyze multiple tokenizer vocabularies simultaneously
- Generate statistics on token distribution
- Produce visualizations of token characteristics
- Compare multiple tokenizers
- Analyze Unicode coverage
- Assess language-specific token distributions (Latin and Cyrillic scripts)
Installation
You can install Qtok using pip:
pip install qtok
Or clone the repository and install:
git clone https://github.com/nup-csai/Qtok.git
cd Qtok
pip install .
Usage
Qtok can be used as a command-line tool:
qtok -i /path/to/tokenizer1.json /path/to/tokenizer2.json ... -l label1 label2 ... -o /path/to/output/folder [--latex]
Arguments:
-i: Paths to the tokenizer JSON files or URLs (required, multiple inputs accepted)-l: Labels for the tokenizers (required, must match the number of input files)-o: Output folder for results (required)--latex: Optional flag to generate LaTeX and PDF reports (default: False)
Example:
qtok -i /path/to/tokenizer1.json /path/to/tokenizer2.json -l label1 label2 -o /path/to/output/folder --latex
- Arguments:
-i: Paths to the tokenizer JSON files or URLs (required, multiple inputs accepted)-l: Labels for the tokenizers (required, must match the number of input files)-o: Output folder for results (required)
Output
Qtok generates several output files:
basic_stats.tsvandbasic_stats.png: Basic statistics of the tokenizersunicode_stats.tsvandunicode_stats.png: Unicode coverage statisticslatin_stats.tsvandlatin_stats.png: Statistics for Latin script tokenscyrillic_stats.tsvandcyrillic_stats.png: Statistics for Cyrillic script tokensreport.html: An HTML report summarizing all analysesreport.texandreport.pdf: LaTeX and PDF versions of the report (if--latexflag is used and pdflatex is installed)
Requirements
- Python 3.6+
- matplotlib
- numpy
- pandas
- requests
- tqdm
Reproducibility
For full tables and data, please refer to the Jupyter notebook available at:
Contributing
Contributions to Qtok are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Authors
- Aleksey Komissarov
- Iaroslav Chelombitko
- Egor Safronov
Contact
For any queries, please contact ad3002@gmail.com.
Acknowledgments
- Thanks to all contributors and users of Qtok
- Special thanks to the NLP community for inspiration and support
Metadata
Release files for Qtok 0.11.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| Qtok-0.11.0.tar.gz | 18.5 MB | Without provenance | Details |
Release files / Qtok-0.11.0.tar.gz
| Download URL | Qtok-0.11.0.tar.gz |
|---|---|
| Size | 18.5 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c8099d24a7cf644ec464ccf2aec7d2b6cb4ff2c15e137f1eca4239601e90695f
|
|
BLAKE2b-256 checksum How to use checksums |
ffd5324992ffc77136e9a8252c942a7e38457f24ff51c525a30eee16afb39e2d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.19
|
Security for Qtok 0.11.0
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.