
Show HN: A Go library for approximate string matching using character n-grams - qrv3w
https://github.com/schollz/closestmatch
======
Safety1stClyde
I have only looked at the README.

> If you run go test the tests will pass which validate that Levenshtein
> performs < 60% accuracy and closestmatch performs with > 98% accuracy.

If you've set those tests up yourself, what you mean by "accuracy" may be what
your library achieves.

~~~
qrv3w
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/closestm...](https://github.com/schollz/closestmatch/blob/master/closestmatch.go#L181)

