pub struct TextNormalizer<D = DefaultInputTextPlugin> { /* private fields */ }Expand description
Applies input-text normalization used by tokenizer input processing.
By default, this uses DefaultInputTextPlugin. When built from a dictionary,
it applies that dictionary’s configured input-text plugins.
Implementations§
Source§impl TextNormalizer<DefaultInputTextPlugin>
impl TextNormalizer<DefaultInputTextPlugin>
Sourcepub fn new(grammar: &Grammar<'_>) -> SudachiResult<Self>
pub fn new(grammar: &Grammar<'_>) -> SudachiResult<Self>
Create a text normalizer using the default input-text plugin.
Sourcepub fn try_default() -> SudachiResult<Self>
pub fn try_default() -> SudachiResult<Self>
Create a text normalizer using the default input-text plugin and an empty grammar.
pub fn normalize(&mut self, text: &str) -> SudachiResult<String>
Source§impl<D> TextNormalizer<D>where
D: DictionaryAccess,
impl<D> TextNormalizer<D>where
D: DictionaryAccess,
Sourcepub fn from_dictionary(dictionary: D) -> Self
pub fn from_dictionary(dictionary: D) -> Self
Create a text normalizer using the input-text plugins from a dictionary.
pub fn normalize(&mut self, text: &str) -> SudachiResult<String>
Source§impl<D> TextNormalizer<Arc<D>>where
D: DictionaryAccess + ?Sized,
impl<D> TextNormalizer<Arc<D>>where
D: DictionaryAccess + ?Sized,
Create a text normalizer using the input-text plugins from a shared dictionary handle.
Auto Trait Implementations§
impl<D> Freeze for TextNormalizer<D>where
D: Freeze,
impl<D> RefUnwindSafe for TextNormalizer<D>where
D: RefUnwindSafe,
impl<D> Send for TextNormalizer<D>where
D: Send,
impl<D> Sync for TextNormalizer<D>where
D: Sync,
impl<D> Unpin for TextNormalizer<D>where
D: Unpin,
impl<D> UnsafeUnpin for TextNormalizer<D>where
D: UnsafeUnpin,
impl<D> UnwindSafe for TextNormalizer<D>where
D: UnwindSafe,
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