Skip to main content

Qtok: quality control tool for tokenization

Project description

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)

Qtok Pipeline

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

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)

Example:

qtok -i /path/to/tokenizer1.json /path/to/tokenizer2.json ... -l label1 label2 ... -o /path/to/output/folder
  • 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:

  1. basic_stats.tsv and basic_stats.png: Basic statistics of the tokenizers
  2. unicode_stats.tsv and unicode_stats.png: Unicode coverage statistics
  3. latin_stats.tsv and latin_stats.png: Statistics for Latin script tokens
  4. cyrillic_stats.tsv and cyrillic_stats.png: Statistics for Cyrillic script tokens
  5. report.html: An HTML report summarizing all analyses
  6. report.tex and report.pdf: LaTeX and PDF versions of the report (if pdflatex is installed)

Requirements

  • Python 3.6+
  • matplotlib
  • numpy
  • pandas
  • requests

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Qtok-0.10.5.tar.gz (18.5 MB view details)

Uploaded Source

File details

Details for the file Qtok-0.10.5.tar.gz.

File metadata

  • Download URL: Qtok-0.10.5.tar.gz
  • Upload date:
  • Size: 18.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.19

File hashes

Hashes for Qtok-0.10.5.tar.gz
Algorithm Hash digest
SHA256 605560164a66dd62e0e4c3095f13a8f69c5d6bff85c9a8063afc3bd1e74c129d
MD5 97a4d246e8120d459b9ec41eb818c900
BLAKE2b-256 89915c787b01a41373e8d1cbb8037d14f865aff4a4eca4f8cfe9b9aeb64d6b1d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page