Trait text_splitter::TokenCount
source · pub trait TokenCount {
// Required method
fn token_count(&self, text: &str) -> usize;
}Expand description
Generic interface for tokenizers to calculate number of tokens.
Required Methods§
sourcefn token_count(&self, text: &str) -> usize
fn token_count(&self, text: &str) -> usize
Returns the number of tokens in a given text after tokenization.
Implementations on Foreign Types§
source§impl TokenCount for CoreBPE
Available on crate feature tiktoken-rs only.
impl TokenCount for CoreBPE
Available on crate feature
tiktoken-rs only.source§impl TokenCount for Tokenizer
Available on crate feature tokenizers only.
impl TokenCount for Tokenizer
Available on crate feature
tokenizers only.