3

I had a specific question regrading ordering the suggested words returned by hunspell on a typo. The words seems to be returned in an alpha order. I want to order the suggestions by relevance, that is the closest match should show up first. I couldn't find any way to do that via hunspell apis. How can this be achieved?

log0
  • 10,489
  • 4
  • 28
  • 62
HeretoLearn
  • 7,124
  • 6
  • 24
  • 22

2 Answers2

3

You're not putting the results into a sorted list or anything like that, are you?

When I call int iCount = pHunspell->suggest(aSuggestions, "Testig") I get "Testing, Testis, Testes". If it was in alphabetical order, "Testes" would have been first, which is certainly not what I had intended.

Tested in unmanaged C++ with versions 1.2.2 and 1.3.2.

Rick Yorgason
  • 1,616
  • 14
  • 22
0

I agree with above. Hunspell makes use of certain probability models like keyboard character proximities and phonetic similarities to suggest best matches. You must be storing it in a list which gets sorted.

user1294764
  • 103
  • 9