-
-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use similarity for lenient? #6
Comments
It's not really the same thing. The lenient mode works by detecting if the entered word is close to a valid one on the actual keyboard while modules like |
The current lenient is not using any proper algorithm and is implemented naively. lenient should be done using a proper algorithm such as Levenshtein distance. |
The current one is pretty naive yes, but still better than using the wrong algorithm. The "proper" algorithm is relative to what you're doing. Here we want to match whether the user mistyped a character on the keyboard by checking if any of the characters around it would have spelled it. Levenshtein is actually more naive in this case as it only lets you know how distance the word is using any character. Would be happy to see the current algorithm improved, but should be done correctly. |
I agree, but using a "proper" algorithm here would be very hard. "autocorrect" and "google suggest" are actually using many different algorithms (including Levenshtein distance) so that they can work reasonably well. |
https://github.com/zeke/similarity
Better algorithm
The text was updated successfully, but these errors were encountered: