Count number of tokens in the text file using toktoken tokenizer from OpenAI.
Project description
Count tokens
Simple tool that have one purpose - count tokens in a text file.
Requirements
This package is using tiktoken library for tokenization.
## Installation
For usage from comman line install the package in isolated environement with pipx:
```sh
$ pipx install count-tokens
or install it in your current environment with pip.
Usage
Open terminal and run:
$ count-tokens document.txt
You should see something like this:
File: document.txt
Encoding: cl100k_base
Number of tokens: 67
if you want to see just the tokens count run:
$ count-tokens document.txt --quiet
and the output will be:
67
Related Projects
- tiktoken - tokenization library used by this package
Credits
Thanks to the authors of the tiktoken library for open sourcing their work.
License
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
count_tokens-0.2.0.tar.gz
(2.3 kB
view hashes)
Built Distribution
Close
Hashes for count_tokens-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8551c70a0e1e1d0b6f9f20c233597702cc5cd0d2fca2bdf881816e54a9d0c862 |
|
MD5 | 20bdcd056f35b71dae49fe7ee82f530d |
|
BLAKE2b-256 | 128e0353819a48329fbd576e28fc1e7c3966041e7fe7ec6433bbef7b01ba29fd |