5 ms·
You're absolutely right. You can check out the tests [1] - its a lot of re-ordering and inserting random letters in random places, which basically trying to emu
by qrv3w 10y ago
You're absolutely right. You can check out the tests [1] - its a lot of re-ordering and inserting random letters in random places, which basically trying to emulate sloppy user input.
Your comment is also getting at a caveat: this library works better than Levenshtein for long strings (multiple words) but worse than Levenshtein for short strings (e.g. single words) as there is too much overlap in character n-grams.
[1] https://github.com/schollz/closestmatch/blob/master/closestmatch.go#L181 https://github.com/schollz/closestmatch/blob/master/closestm...