pub struct StubTokenizer { /* private fields */ }Expand description
Stub tokenizer for testing
Implementations§
Trait Implementations§
Source§impl Debug for StubTokenizer
impl Debug for StubTokenizer
Source§impl Tokenizer for StubTokenizer
impl Tokenizer for StubTokenizer
Source§fn encode(&self, text: &str, _add_special: bool) -> Result<Vec<TokenId>>
fn encode(&self, text: &str, _add_special: bool) -> Result<Vec<TokenId>>
Encode text to token IDs
Source§fn decode(&self, tokens: &[TokenId], _skip_special: bool) -> Result<String>
fn decode(&self, tokens: &[TokenId], _skip_special: bool) -> Result<String>
Decode token IDs to text
Source§fn decode_incremental(&self, _prev: &[TokenId], next: TokenId) -> Result<String>
fn decode_incremental(&self, _prev: &[TokenId], next: TokenId) -> Result<String>
Incremental decode: given previous tokens and new token, return only the new text
This is crucial for streaming applications to avoid re-decoding all tokens
Source§fn vocab_size(&self) -> usize
fn vocab_size(&self) -> usize
Get vocabulary size
Source§fn special_tokens(&self) -> &SpecialTokens
fn special_tokens(&self) -> &SpecialTokens
Get special tokens configuration
Source§fn token_id(&self, _text: &str) -> Option<TokenId>
fn token_id(&self, _text: &str) -> Option<TokenId>
Get token ID for a specific text (if exists in vocabulary)
Source§fn info(&self) -> TokenizerInfo
fn info(&self) -> TokenizerInfo
Get tokenizer information
Source§fn token_bytes(&self, token_id: TokenId) -> Option<Vec<u8>>
fn token_bytes(&self, token_id: TokenId) -> Option<Vec<u8>>
Return the context-free byte surface represented by one vocabulary token. Read more
Source§fn is_special_token(&self, token_id: TokenId) -> bool
fn is_special_token(&self, token_id: TokenId) -> bool
Check if token is a special token
Source§fn apply_chat_template(
&self,
messages: &[ChatMessage],
) -> Result<String, FerrumError>
fn apply_chat_template( &self, messages: &[ChatMessage], ) -> Result<String, FerrumError>
Apply chat template if supported
Auto Trait Implementations§
impl Freeze for StubTokenizer
impl RefUnwindSafe for StubTokenizer
impl Send for StubTokenizer
impl Sync for StubTokenizer
impl Unpin for StubTokenizer
impl UnsafeUnpin for StubTokenizer
impl UnwindSafe for StubTokenizer
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> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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