use alpha_id::normalize::normalize; #[test] fn lowercases_and_collapses_whitespace() { assert_eq!(normalize(" Diabetes Mellitus\tTyp 2 "), "diabetes mellitus typ 2"); } #[test] fn expands_common_medical_abbreviations() { assert_eq!(normalize("V.a. art. Hypertonie"), "verdacht auf arterielle hypertonie"); assert_eq!(normalize("Z.n. OP"), "zustand nach operation"); } // The system must match regardless of whether the dictation uses real // umlauts (ä, ö, ü, ß) or their ASCII digraphs (ae, oe, ue, ss). Both the // indexed corpus text and the query pass through normalize(), so folding // both forms to one canonical (ASCII-digraph) representation makes the // lexical path symmetric — "Hyperlipidämie" and "Hyperlipidaemie" match. #[test] fn folds_umlauts_and_eszett_to_ascii_digraphs() { assert_eq!(normalize("Ödem"), "oedem"); assert_eq!(normalize("Fußödem"), "fussoedem"); assert_eq!(normalize("über"), "ueber"); } #[test] fn umlaut_and_digraph_forms_normalize_identically() { assert_eq!(normalize("Hyperlipidämie"), normalize("Hyperlipidaemie")); assert_eq!(normalize("Ödem"), normalize("Oedem")); assert_eq!(normalize("Fußödem"), normalize("Fussoedem")); assert_eq!(normalize("über"), normalize("ueber")); } #[test] fn folding_is_idempotent_on_already_ascii_text() { // ASCII-only medical text must be unchanged by the fold. assert_eq!(normalize("hyperlipidaemie"), "hyperlipidaemie"); assert_eq!(normalize("Diabetes Mellitus"), "diabetes mellitus"); }