Expand description
Thai spell correction using edit distance and phonetic ranking.
SpellChecker finds words in the built-in dictionary that are close to a
given input, ranked first by phonetic similarity (lk82 Soundex), then by
edit distance, then by TNC corpus frequency.
use kham_core::spell::SpellChecker;
let checker = SpellChecker::builtin();
let suggestions = checker.suggestions("กาน", 5);
// All candidates are within edit distance 2
assert!(suggestions.iter().all(|s| s.edit_distance <= 2));
// Phonetically similar words appear first
if let Some(first) = suggestions.first() {
assert!(first.soundex_match || first.edit_distance <= 1);
}Structs§
- Spell
Checker - Thai spell checker using edit distance and lk82 phonetic ranking.
- Suggestion
- A spelling suggestion returned by
SpellChecker::suggestions.