View Source Gpt3Tokenizer (gpt3_tokenizer v0.1.1)

GPT-3 Tokenizer

Link to this section Summary

Functions

Decode a list of tokens into a string.

Encode a string into a list of tokens.

Count the number of tokens in a string.

Link to this section Functions

Decode a list of tokens into a string.

examples

Examples

iex> Gpt3Tokenizer.decode([31373, 995])
"hello world"

Encode a string into a list of tokens.

examples

Examples

iex> Gpt3Tokenizer.encode("hello world")
[31373, 995]

Count the number of tokens in a string.

examples

Examples

iex> Gpt3Tokenizer.token_count("hello world")
2