diff options
| author | unwox <me@unwox.com> | 2024-10-17 14:32:50 +0600 |
|---|---|---|
| committer | unwox <me@unwox.com> | 2024-10-17 14:32:50 +0600 |
| commit | 512cc8942f944533775adf0a84c1d4b9b31e45bc (patch) | |
| tree | 80a97e707d32b322188ead1e5a63b806fd9d9c94 /spellfix.fnl | |
| parent | 359790c402d2731b7dd1df8a629726e69922a035 (diff) | |
do not use candidates with distance > 3 for spell fixes
Diffstat (limited to 'spellfix.fnl')
| -rw-r--r-- | spellfix.fnl | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/spellfix.fnl b/spellfix.fnl index 5ecb870..2507fca 100644 --- a/spellfix.fnl +++ b/spellfix.fnl @@ -300,7 +300,9 @@ (local sorted-index (array.sort index #(< $1.distance $2.distance))) (local most-similar (. sorted-index 1)) - most-similar.word) + (if (< most-similar.distance 3) + most-similar.word + token)) (str.split string " ")) " ")) (if (~= result string) |
