pub struct TokenizerEngine { /* private fields */ }Implementations§
Source§impl TokenizerEngine
impl TokenizerEngine
pub fn new(tokenizer: Tokenizer) -> Result<Self>
pub fn new_with_options( tokenizer: Tokenizer, options: EngineOptions, ) -> Result<Self>
pub fn tokenizer(&self) -> &Tokenizer
pub fn set_options(&mut self, options: EngineOptions) -> Result<()>
pub fn decode_id(&self, id: u32) -> Result<String>
pub fn encode_text(&self, text: &str) -> Result<Vec<u32>>
pub fn random_token( &self, rng: &mut SimpleRng, mode: RandomMode, ) -> Option<TokenPiece>
pub fn text_stream(&self, text: &str, repeat: TextRepeat) -> Result<TextStream>
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for TokenizerEngine
impl RefUnwindSafe for TokenizerEngine
impl Send for TokenizerEngine
impl Sync for TokenizerEngine
impl Unpin for TokenizerEngine
impl UnwindSafe for TokenizerEngine
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
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