Skip to content
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

Addition of support for a distance of 1 #17

Merged
merged 1 commit into from
Oct 3, 2018

Conversation

mrjamesriley
Copy link
Contributor

For our purposes, it was apparent that the spellchecker was too 'generous' in the suggestions offered for words - due to the edit distance of two. This meant that words which we wouldn't deem to be typos, frequently being identified as such - or we'd have candidates offered which were too far 'removed' from what we'd expected. It also happens to be that the performance was a fair bit slower than the real-time use we were aiming for.

When set to an edit distance of 1, we get the performance and tighter 'accuracy' that works well for us. Thus this pull request is to allow for the setting of the distance during the SpellChecker initialisation, with the default set to 2 for backwords compatability.

A quick benchmark reveals the increased performance of the edit distance of 1, where appropriate of course:

word: 'mrjamesriley'

Looking for correction with distance of two (5 times):
15.7 seconds

Looking for correction with distance of one (5 times):
0.01 seconds

@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) to 98.425% when pulling db4edaf on mrjamesriley:master into 2bdb305 on barrust:master.

@barrust barrust merged commit b5f38d9 into barrust:master Oct 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants