From 512cc8942f944533775adf0a84c1d4b9b31e45bc Mon Sep 17 00:00:00 2001 From: unwox Date: Thu, 17 Oct 2024 14:32:50 +0600 Subject: do not use candidates with distance > 3 for spell fixes --- spellfix.fnl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'spellfix.fnl') 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) -- cgit v1.2.3