Search code examples
javascriptxhtmlspell-checkingjspell

Spell Check API


I have implemented the Jazzy spell-check API in my project to find misspelled words and provide suggestions for these words. I've downloaded a ".dic" file to be used with it. However, the dictionary file doesn't contain words in alphabetic order. Could anyone point out the reason why?

Also we have a getSuggestions() method, which provides the suggestions for the misspelled words. Could anyone suggest how to it determines which suggestion displays first?


Solution

  • If you are going to loop through an array of words and compare a string to them, it makes a lot of sense to put the words that are more frequent, like "the" "for", near the beginning so that your loop finds the correct answer sooner.

    There are many ways to determine "suggestions", one is the levenshtein distance https://en.wikipedia.org/wiki/Levenshtein_distance