HeretoLearn
HeretoLearn

Reputation: 7454

hunspell spell check

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?

Upvotes: 3

Views: 1449

Answers (2)

user1294764
user1294764

Reputation: 103

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.

Upvotes: 0

Rick Yorgason
Rick Yorgason

Reputation: 1676

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.

Upvotes: 3

Related Questions