pub struct Registry { /* private fields */ }Expand description
Run-time table of algorithms and adapters.
Implementations§
Source§impl Registry
impl Registry
pub fn new() -> Registry
Sourcepub fn register_algorithm<F>(&mut self, name: &str, factory: F)
pub fn register_algorithm<F>(&mut self, name: &str, factory: F)
Register a tokenization algorithm under name. Replaces an earlier
registration of the same name.
pub fn register_adapter<F>(&mut self, name: &str, factory: F)
Sourcepub fn tokenizer(&self, name: &str) -> Result<Box<dyn Tokenizer>, KuteError>
pub fn tokenizer(&self, name: &str) -> Result<Box<dyn Tokenizer>, KuteError>
A fresh, untrained tokenizer for name.
pub fn adapter(&self, name: &str) -> Result<Box<dyn ModalityAdapter>, KuteError>
Sourcepub fn tokenizer_for(
&self,
vocabulary: Vocabulary,
) -> Result<Box<dyn Tokenizer>, KuteError>
pub fn tokenizer_for( &self, vocabulary: Vocabulary, ) -> Result<Box<dyn Tokenizer>, KuteError>
A tokenizer with vocabulary installed, chosen by the manifest.
pub fn algorithm_names(&self) -> Vec<String>
pub fn adapter_names(&self) -> Vec<String>
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Registry
impl !UnwindSafe for Registry
impl Forget for Registry
impl Freeze for Registry
impl Move for Registry
impl Send for Registry
impl Sync for Registry
impl Unpin for Registry
impl UnsafeUnpin for Registry
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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