Skip to main content

Count the number of tokens in a text string or file, similar to the Unix 'wc' utility.

Project description

Token Count

Token Count is a command-line utility that counts the number of tokens in a text string, file, or directory, similar to the Unix wc utility. It uses the OpenAI tiktoken library for tokenization and is compatible with GPT-3.5-turbo token counts.

Installation

To install Token Count, run the following command in your terminal:

pip install token-count

Usage

Token Count has three main options:

Count tokens in a text string:

token-count --text "Your text here"

Count tokens in a file:

token-count --file path/to/your/file.txt

Count tokens in a directory (recursively):

token-count --directory path/to/your/directory

You can provide any combination of these options. Token Count will print the token count for each input type.

License

This project is licensed under the MIT 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

token-count-0.1.1.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

token_count-0.1.1-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file token-count-0.1.1.tar.gz.

File metadata

  • Download URL: token-count-0.1.1.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.4

File hashes

Hashes for token-count-0.1.1.tar.gz
Algorithm Hash digest
SHA256 5f0dae957b15f09bfd931b75a85e426f28ff82ba89a0f95c54b9972d1bfb75c8
MD5 8f4e3c7584b9c9c184f39362114ab97e
BLAKE2b-256 fc9af554d7a7dbb0e08f8162e8fe12e3ccc31a595dba8bad9018ef21e170f5c8

See more details on using hashes here.

File details

Details for the file token_count-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: token_count-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.4

File hashes

Hashes for token_count-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 527eba9ba9f7cd16851ea91cc532bc89acb4bafaeb347382d0abb19a4ad32311
MD5 e6c7bc6bd9a4d3964253b0a8cef66f0e
BLAKE2b-256 c12be1e3a8385269b38866bbf2732ad2c79dd935cc1b98562c9d43dade44290e

See more details on using hashes here.

Supported by

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