pub trait Tokenizer:
Send
+ Sync
+ Clone
+ 'static {
// Required method
fn tokenize(&self, text: &str) -> Vec<Token>;
// Provided method
fn tokenize_with(
&self,
text: &str,
hint: Option<&str>,
purpose: Purpose,
) -> Vec<Token> { ... }
}Expand description
Trait for tokenizers
Required Methods§
Provided Methods§
Sourcefn tokenize_with(
&self,
text: &str,
hint: Option<&str>,
purpose: Purpose,
) -> Vec<Token>
fn tokenize_with( &self, text: &str, hint: Option<&str>, purpose: Purpose, ) -> Vec<Token>
Tokenize with a caller-supplied hint and a purpose.
Static tokenizers ignore both and have a single form. A
LexTokenizer reads the hint as a comma-separated list of language
codes (a sibling document field at index time, tokenizer_hint on
the query) and emits the forms the purpose asks for (see
Purpose).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".