pub struct KimiTokenizer { /* private fields */ }Implementations§
Source§impl KimiTokenizer
impl KimiTokenizer
pub fn new( encoder: HashMap<Vec<u8>, u32>, special_tokens: HashMap<String, u32>, ) -> Result<Self, KimiTokenizerError>
pub fn vocab_size(&self) -> usize
pub fn special_token_id(&self, name: &str) -> Option<u32>
Sourcepub fn encode(&self, text: &str) -> Vec<u32>
pub fn encode(&self, text: &str) -> Vec<u32>
Encodes ordinary text (no inline special-token recognition –
matches the real disallowed_special=() path used for
untrusted/user text in tokenization_kimi.py, so a literal
<|...|> substring in the input is BPE-encoded like any other
text, never misread as a control token).
pub fn decode(&self, ids: &[u32]) -> String
Trait Implementations§
Auto Trait Implementations§
impl Freeze for KimiTokenizer
impl RefUnwindSafe for KimiTokenizer
impl Send for KimiTokenizer
impl Sync for KimiTokenizer
impl Unpin for KimiTokenizer
impl UnsafeUnpin for KimiTokenizer
impl UnwindSafe for KimiTokenizer
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
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