summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunwox <me@unwox.com>2024-10-17 14:32:50 +0600
committerunwox <me@unwox.com>2024-10-17 14:32:50 +0600
commit512cc8942f944533775adf0a84c1d4b9b31e45bc (patch)
tree80a97e707d32b322188ead1e5a63b806fd9d9c94
parent359790c402d2731b7dd1df8a629726e69922a035 (diff)
do not use candidates with distance > 3 for spell fixes
-rw-r--r--spellfix.fnl4
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)