Struct TokEnvWithTrie
pub struct TokEnvWithTrie { /* private fields */ }
Implementations§
§impl TokEnvWithTrie
impl TokEnvWithTrie
pub fn new( base_env: Arc<dyn TokenizerEnv + Sync>, tok_trie: TokTrie, ) -> TokEnvWithTrie
Trait Implementations§
§impl TokenizerEnv for TokEnvWithTrie
impl TokenizerEnv for TokEnvWithTrie
§fn tokenize_bytes(&self, s: &[u8]) -> Vec<u32>
fn tokenize_bytes(&self, s: &[u8]) -> Vec<u32>
Tokenize a given byte sequence.
It may or may not interpret <|special_tokens|> as special.
§fn tokenize_bytes_marker(&self, s: &[u8]) -> Vec<u32>
fn tokenize_bytes_marker(&self, s: &[u8]) -> Vec<u32>
Tokenize a given byte sequence.
It will interpret text starting with SPECIAL_TOKEN_MARKER as special tokens.
§fn tokenize(&self, s: &str) -> Vec<u32>
fn tokenize(&self, s: &str) -> Vec<u32>
Tokenize a string coming from user. It may or may not interpret <|special_tokens|> as special.
§fn tokenize_special(&self, s: &str) -> Vec<u32>
fn tokenize_special(&self, s: &str) -> Vec<u32>
Tokenize a string. It will interpret <|special_tokens|> as special.
§fn tokenize_is_canonical(&self) -> bool
fn tokenize_is_canonical(&self) -> bool
If this returns true, this tokenizer always returns canonical tokenizations
and can be used for forcing tokens.
Non-canonical tokenizers will typically just use TokTrie::greedy_tokenize().
Auto Trait Implementations§
impl Freeze for TokEnvWithTrie
impl !RefUnwindSafe for TokEnvWithTrie
impl Send for TokEnvWithTrie
impl Sync for TokEnvWithTrie
impl Unpin for TokEnvWithTrie
impl !UnwindSafe for TokEnvWithTrie
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
§impl<T> Downcast for Twhere
T: AsAny + ?Sized,
impl<T> Downcast for Twhere
T: AsAny + ?Sized,
§fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
Forward to the method defined on the type
Any
.§fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
Forward to the method defined on the type
Any
.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more