hunspell api test


/ Published in: C
Save to your folder(s)



Copy this code and paste it in your HTML
  1. int main()
  2. {
  3. Hunhandle *dic;
  4. char *word_ok, *word_notok, **slist;
  5. int list_size, i;
  6.  
  7. word_ok = "hejes";
  8. word_notok = "helyes";
  9.  
  10. dic = Hunspell_create("hu_HU-1.5/hu_HU.aff", "hu_HU-1.5/hu_HU.dic");
  11.  
  12. printf("%i\n", Hunspell_spell(dic, word_ok));
  13. printf("%i\n\n", Hunspell_spell(dic, word_notok));
  14. printf("%s\n\n", Hunspell_get_dic_encoding(dic));
  15.  
  16. list_size = Hunspell_suggest(dic, &slist, "hejes");
  17. printf("%i\n", list_size);
  18. for (i = 0; i < list_size; i++)
  19. {
  20. printf("%s\n", slist[i]);
  21. }
  22.  
  23. Hunspell_destroy(dic);
  24. return 0;
  25. }

URL: http://blog.connor.hu/2009/11/21/hunspell-c-api/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.