0

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?

Ninjakannon
  • 3,751
  • 7
  • 53
  • 76
pkn1230
  • 103
  • 1
  • 3
  • 15

1 Answers1

2

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

AwokeKnowing
  • 7,728
  • 9
  • 36
  • 47
  • Hi @AwokeKnowing, could you also tell, the dictionary I am currently using has many slang language words, so is there any short way to remove the slang words or will I have to use an entirely new dictionary – pkn1230 Sep 16 '15 at 07:37
  • @pkn1230 if you really want it to show slang as misspelled, then yes, you either need (1) a dictionary of only formal words, which is very rare, or (2) a dictionary of "slang" to cross-reference with, or (3), a dictionary which includes definitons and labels, such as formal, informal, etc. I say just let them use slang if it made it into the dictionary, and pull their ears when you see the people who used slang! – AwokeKnowing Sep 16 '15 at 07:49
  • it's not an option. I have to get rid of the slang words. – pkn1230 Sep 16 '15 at 09:03