pub struct NormalizerConfig {
pub lang: Language,
pub operator: Operator,
pub fix_contractions: bool,
pub traditional_to_simple: bool,
pub full_to_half: bool,
pub remove_interjections: bool,
pub remove_puncts: bool,
pub tag_oov: bool,
pub enable_0_to_9: bool,
pub remove_erhua: bool,
}Expand description
Normalizer configuration
Fields§
§lang: LanguageLanguage setting, Auto means auto-detect
operator: OperatorOperation type: TN or ITN
fix_contractions: boolWhether to fix English contractions (e.g., “don’t” → “do not”)
traditional_to_simple: boolWhether to convert Traditional Chinese to Simplified Chinese
full_to_half: boolWhether to convert full-width characters to half-width
remove_interjections: boolWhether to remove interjections (e.g., “嗯”, “啊”)
remove_puncts: boolWhether to remove punctuation marks
tag_oov: boolWhether to tag OOV (out-of-vocabulary) words
enable_0_to_9: boolWhether to enable 0-9 digit conversion in ITN
remove_erhua: boolWhether to remove erhua (儿化音) (e.g., “哪儿” → “哪”)
Implementations§
Source§impl NormalizerConfig
impl NormalizerConfig
Sourcepub fn with_operator(self, operator: Operator) -> Self
pub fn with_operator(self, operator: Operator) -> Self
Set the operator
Sourcepub fn with_fix_contractions(self, fix: bool) -> Self
pub fn with_fix_contractions(self, fix: bool) -> Self
Set whether to fix contractions
Sourcepub fn with_traditional_to_simple(self, convert: bool) -> Self
pub fn with_traditional_to_simple(self, convert: bool) -> Self
Set whether to convert traditional to simplified Chinese
Sourcepub fn with_full_to_half(self, convert: bool) -> Self
pub fn with_full_to_half(self, convert: bool) -> Self
Set whether to convert full-width to half-width
Sourcepub fn with_remove_interjections(self, remove: bool) -> Self
pub fn with_remove_interjections(self, remove: bool) -> Self
Set whether to remove interjections
Sourcepub fn with_remove_puncts(self, remove: bool) -> Self
pub fn with_remove_puncts(self, remove: bool) -> Self
Set whether to remove punctuation
Sourcepub fn with_remove_erhua(self, remove: bool) -> Self
pub fn with_remove_erhua(self, remove: bool) -> Self
Set whether to remove erhua
Sourcepub fn with_tag_oov(self, tag: bool) -> Self
pub fn with_tag_oov(self, tag: bool) -> Self
Set whether to tag OOV words
Sourcepub fn with_enable_0_to_9(self, enable: bool) -> Self
pub fn with_enable_0_to_9(self, enable: bool) -> Self
Set whether to enable 0-9 conversion in ITN
Trait Implementations§
Source§impl Clone for NormalizerConfig
impl Clone for NormalizerConfig
Source§fn clone(&self) -> NormalizerConfig
fn clone(&self) -> NormalizerConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for NormalizerConfig
impl Debug for NormalizerConfig
Source§impl Default for NormalizerConfig
impl Default for NormalizerConfig
Source§fn default() -> NormalizerConfig
fn default() -> NormalizerConfig
Auto Trait Implementations§
impl Freeze for NormalizerConfig
impl RefUnwindSafe for NormalizerConfig
impl Send for NormalizerConfig
impl Sync for NormalizerConfig
impl Unpin for NormalizerConfig
impl UnwindSafe for NormalizerConfig
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
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>
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>
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