Tokenizer

interface Tokenizer

Interface for KMP-compatible tokenizers.

Tokenizers convert text into a sequence of tokens (integers) processed by models like BERT.

Properties

Link copied to clipboard
abstract val vocabSize: Int

Returns the vocabulary size of the tokenizer.

Functions

Link copied to clipboard
abstract fun detokenize(tokens: List<Int>): String

Converts a list of token IDs back into a string.

Link copied to clipboard
abstract fun tokenize(text: String): List<Int>

Converts a string into a list of token IDs.