#include "interfaces/cc/aspell.h" #include int main(int argc, char *argv[]) { if (argc < 2) { std::cout << "please give some words as args\n"; exit(0); } AspellConfig * spell_config = new_aspell_config(); AspellCanHaveError * possible_err = new_aspell_speller(spell_config); AspellSpeller * spell_checker = 0; if (aspell_error_number(possible_err) != 0) puts(aspell_error_message(possible_err)); else spell_checker = to_aspell_speller(possible_err); const AspellSuggestionList * suggestions = aspell_speller_suggest_plus( spell_checker, argv[1], -1); AspellSuggestionEnumeration * elements = aspell_suggestion_list_elements(suggestions); const AspellSuggestion * sugg; while ( (sugg = aspell_suggestion_enumeration_next(elements)) != NULL ) { std::cout << sugg->word << '\t' << sugg->score << '\n'; // Add to suggestion list sugg->word, of length sugg->word_len, and // with score sugg->score. } delete_aspell_suggestion_enumeration(elements); }