hunspell.h 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #ifndef _MYSPELLMGR_H_
  2. #define _MYSPELLMGR_H_
  3. #include "hunvisapi.h"
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. typedef struct Hunhandle Hunhandle;
  8. LIBHUNSPELL_DLL_EXPORTED Hunhandle *Hunspell_create(const char * affpath, const char * dpath);
  9. LIBHUNSPELL_DLL_EXPORTED Hunhandle *Hunspell_create_key(const char * affpath, const char * dpath,
  10. const char * key);
  11. LIBHUNSPELL_DLL_EXPORTED void Hunspell_destroy(Hunhandle *pHunspell);
  12. /* spell(word) - spellcheck word
  13. * output: 0 = bad word, not 0 = good word
  14. */
  15. LIBHUNSPELL_DLL_EXPORTED int Hunspell_spell(Hunhandle *pHunspell, const char *);
  16. LIBHUNSPELL_DLL_EXPORTED char *Hunspell_get_dic_encoding(Hunhandle *pHunspell);
  17. /* suggest(suggestions, word) - search suggestions
  18. * input: pointer to an array of strings pointer and the (bad) word
  19. * array of strings pointer (here *slst) may not be initialized
  20. * output: number of suggestions in string array, and suggestions in
  21. * a newly allocated array of strings (*slts will be NULL when number
  22. * of suggestion equals 0.)
  23. */
  24. LIBHUNSPELL_DLL_EXPORTED int Hunspell_suggest(Hunhandle *pHunspell, char*** slst, const char * word);
  25. /* morphological functions */
  26. /* analyze(result, word) - morphological analysis of the word */
  27. LIBHUNSPELL_DLL_EXPORTED int Hunspell_analyze(Hunhandle *pHunspell, char*** slst, const char * word);
  28. /* stem(result, word) - stemmer function */
  29. LIBHUNSPELL_DLL_EXPORTED int Hunspell_stem(Hunhandle *pHunspell, char*** slst, const char * word);
  30. /* stem(result, analysis, n) - get stems from a morph. analysis
  31. * example:
  32. * char ** result, result2;
  33. * int n1 = Hunspell_analyze(result, "words");
  34. * int n2 = Hunspell_stem2(result2, result, n1);
  35. */
  36. LIBHUNSPELL_DLL_EXPORTED int Hunspell_stem2(Hunhandle *pHunspell, char*** slst, char** desc, int n);
  37. /* generate(result, word, word2) - morphological generation by example(s) */
  38. LIBHUNSPELL_DLL_EXPORTED int Hunspell_generate(Hunhandle *pHunspell, char*** slst, const char * word,
  39. const char * word2);
  40. /* generate(result, word, desc, n) - generation by morph. description(s)
  41. * example:
  42. * char ** result;
  43. * char * affix = "is:plural"; // description depends from dictionaries, too
  44. * int n = Hunspell_generate2(result, "word", &affix, 1);
  45. * for (int i = 0; i < n; i++) printf("%s\n", result[i]);
  46. */
  47. LIBHUNSPELL_DLL_EXPORTED int Hunspell_generate2(Hunhandle *pHunspell, char*** slst, const char * word,
  48. char** desc, int n);
  49. /* functions for run-time modification of the dictionary */
  50. /* add word to the run-time dictionary */
  51. LIBHUNSPELL_DLL_EXPORTED int Hunspell_add(Hunhandle *pHunspell, const char * word);
  52. /* add word to the run-time dictionary with affix flags of
  53. * the example (a dictionary word): Hunspell will recognize
  54. * affixed forms of the new word, too.
  55. */
  56. LIBHUNSPELL_DLL_EXPORTED int Hunspell_add_with_affix(Hunhandle *pHunspell, const char * word, const char * example);
  57. /* remove word from the run-time dictionary */
  58. LIBHUNSPELL_DLL_EXPORTED int Hunspell_remove(Hunhandle *pHunspell, const char * word);
  59. /* free suggestion lists */
  60. LIBHUNSPELL_DLL_EXPORTED void Hunspell_free_list(Hunhandle *pHunspell, char *** slst, int n);
  61. #ifdef __cplusplus
  62. }
  63. #endif
  64. #endif