pub struct CodeLexTokenizer { /* private fields */ }Expand description
Tokenizer for code-like text.
Identifiers are Unicode alphanumeric characters plus _. Other characters
are lexical boundaries. When operator indexing is enabled, recognized
multi-character operators use longest-match tokenization and remaining
operator characters are emitted individually.
§Examples
use lance_tokenizer::{CodeLexTokenizer, TextAnalyzer, TokenStream};
let mut analyzer = TextAnalyzer::builder(CodeLexTokenizer::new(true)).build();
let mut stream = analyzer.token_stream("a::b");
assert!(stream.advance());
assert_eq!(stream.token().text, "a");
assert!(stream.advance());
assert_eq!(stream.token().text, "::");Implementations§
Trait Implementations§
Source§impl Clone for CodeLexTokenizer
impl Clone for CodeLexTokenizer
Source§fn clone(&self) -> CodeLexTokenizer
fn clone(&self) -> CodeLexTokenizer
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for CodeLexTokenizer
impl Default for CodeLexTokenizer
Source§fn default() -> CodeLexTokenizer
fn default() -> CodeLexTokenizer
Returns the “default value” for a type. Read more
Source§impl Tokenizer for CodeLexTokenizer
impl Tokenizer for CodeLexTokenizer
Source§type TokenStream<'a> = CodeLexTokenStream<'a>
type TokenStream<'a> = CodeLexTokenStream<'a>
Stream type emitted by the tokenizer.
Source§fn token_stream<'a>(&'a mut self, text: &'a str) -> Self::TokenStream<'a>
fn token_stream<'a>(&'a mut self, text: &'a str) -> Self::TokenStream<'a>
Create a token stream for the provided text.
Auto Trait Implementations§
impl Freeze for CodeLexTokenizer
impl RefUnwindSafe for CodeLexTokenizer
impl Send for CodeLexTokenizer
impl Sync for CodeLexTokenizer
impl Unpin for CodeLexTokenizer
impl UnsafeUnpin for CodeLexTokenizer
impl UnwindSafe for CodeLexTokenizer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more