pub struct Normalizer { /* private fields */ }Expand description
A configured CJK normalization pipeline.
Create via Normalizer::builder() for ergonomic defaults, or supply a
NormalizerConfig directly via Normalizer::with_config.
Implementations§
Source§impl Normalizer
impl Normalizer
Sourcepub fn builder() -> NormalizerBuilder
pub fn builder() -> NormalizerBuilder
Returns a builder with Japanese-oriented defaults:
strip_ivs: true, fold_variants: true, width_normalization: true.
Note: these defaults differ from NormalizerConfig::default(), which
keeps width_normalization: false for backward compatibility with the
standalone normalize() function.
Sourcepub fn with_config(config: NormalizerConfig) -> Self
pub fn with_config(config: NormalizerConfig) -> Self
Create a Normalizer from an explicit NormalizerConfig.
Sourcepub fn normalize<'a>(&self, input: &'a str) -> Result<Cow<'a, str>>
pub fn normalize<'a>(&self, input: &'a str) -> Result<Cow<'a, str>>
Normalize input according to this normalizer’s configuration.
Returns Cow::Borrowed when no substitutions are made (zero allocation).
Auto Trait Implementations§
impl Freeze for Normalizer
impl RefUnwindSafe for Normalizer
impl Send for Normalizer
impl Sync for Normalizer
impl Unpin for Normalizer
impl UnsafeUnpin for Normalizer
impl UnwindSafe for Normalizer
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