Skip to main content

normalize

Function normalize 

Source
pub fn normalize(s: &str) -> String
Expand description

Pure-Rust port of Words2Num_Base._normalize.

nfkd = unicodedata.normalize("NFKD", text)
text = "".join(c for c in nfkd if not unicodedata.combining(c))
# ... normalize_tail ...

The NFKD decomposition + combining-mark strip is what makes “trente-deux” match “trente deux”. It is done here with the unicode-normalization crate rather than round-tripping to Python’s unicodedata, so the core is self-contained.