Addition of support for a distance of 1 #17
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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: