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 only.
impl TokenCount for CoreBPE
Available on crate feature
tiktoken only.source§impl TokenCount for Tokenizer
Available on crate feature huggingface only.
impl TokenCount for Tokenizer
Available on crate feature
huggingface only.