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.4.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: token-count-0.1.4.tar.gz
  • Upload date:
  • Size: 3.3 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.4.tar.gz
Algorithm Hash digest
SHA256 2afc01b4f33b555c2d100f7206f5f69c4620d33b725d99b3198c8cd4bc45a0b7
MD5 3b4016a62042b3e206ada4b98f29793d
BLAKE2b-256 639b360a3eb9b24f1654eba73d7e833edc963cbe5b039d7b163707bd225b73cc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: token_count-0.1.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 eec142bcaa122f064900a942c5677a859b19c918c4b16f0b1a773bf629a71c71
MD5 e44cb2d7e61144c1bc479fbcbaaf84fb
BLAKE2b-256 aa87fbfca06ebbcb8df95b9f0c1a4b0ed161a459998f4d722c3f812f8d272e3d

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