cadmium
cadmium copied to clipboard
Add spellchecker
Spell checking can be accomplished a number of different ways, none of them particularly fast unfortunately. The basic spell checker has a dictionary of words; if any token doesn't match one of the words in the dictionary it is wrong. Suggestions are implemented by calculating the distance between the incorrectly spelled word and every other word in the corpus. Typically misspelled words are within a distance of 1 from each other, so words with a distance of 1 would be returned.
Ideally the tolerance would be configurable, with the knowledge that the higher the tolerance the longer it will take. I believe the time complexity is O(log n)
.