diff --git a/crates/engine/src/spell.rs b/crates/engine/src/spell.rs index 2c947835..44d1c6b7 100644 --- a/crates/engine/src/spell.rs +++ b/crates/engine/src/spell.rs @@ -357,6 +357,9 @@ impl Dictionary { /// Is `word` spelt correctly? Capitalised and upper-case forms of a lower-case word pass. pub fn check(&self, word: &str) -> bool { + if word.contains('\u{2019}') { + return self.check(&word.replace('\u{2019}', "'")); + } if word.is_empty() || word.chars().all(|c| !c.is_alphabetic()) { return true; } @@ -800,6 +803,13 @@ SFX D Y 1\nSFX D 0 ed/S .\n"; Dictionary::parse(AFF.as_bytes(), DIC.as_bytes()) } + #[test] + fn curly_apostrophe_matches_ascii_entry() { + let d = Dictionary::parse(AFF.as_bytes(), "2\ndon't\nwork\n".as_bytes()); + assert!(d.check("don't")); + assert!(d.check("don\u{2019}t")); + } + #[test] fn roots_affixes_and_cross_products_check() { let d = d();