Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

180 lines
7.5 KiB

  1. /*
  2. * Copyright (C) 1997 - 1998, Microsoft Corporation. All Rights Reserved.
  3. *
  4. * STEMKOR.H - API entry header file for Korean Stemmer API
  5. *
  6. * See korstem.doc for details
  7. * Date - 1996 Jan. made by dhyu
  8. */
  9. #ifndef STEMKOR_H
  10. #define STEMKOR_H
  11. typedef ULONG_PTR HSTM; /* Stemmer ID type */
  12. typedef unsigned int UINT;
  13. typedef unsigned int SRC; /* stemmer return code */
  14. typedef unsigned short USHORT;
  15. /* Major Options */
  16. #define SO_NOUNPHRASE 0x00000001
  17. #define SO_PREDICATE 0x00000002
  18. #define SO_ALONE 0x00000004
  19. #define SO_AUXILIARY 0x0000000a /* SO_PREDICATE | 0x00000008 */
  20. #define SO_COMPOUND 0x00000011 /* SO_NOUNPHRASE | 0x00000010 */
  21. #define SO_SUFFIX 0x00000021 /* SO_NOUNPHRASE | 0x00000020 */
  22. /* Minor Options : If major options are not set, this options don't have no meaning.
  23. Some minor options also can be inserted anytime.
  24. /* If SO_NOUNPHRASE is not defined, the following four have no meaning. */
  25. #define SO_NP_NOUN 0x00000100
  26. #define SO_NP_PRONOUN 0x00000200
  27. #define SO_NP_NUMBER 0x00000400
  28. #define SO_NP_DEPENDENT 0x00000800
  29. #define SO_NP_PROPER 0x00001000
  30. /* If SO_SUFFIX is not define, the following have no meaning.
  31. In future, thease can be inserted. I don't know which suffix is inserted yet. */
  32. #define SO_SUFFIX_JEOG 0x00002000
  33. typedef struct tagDecomposeOutBuffer {
  34. LPSTR wordlist; /* pointer to the result
  35. format : word\0word_info\0word\0word_info\0 ... */
  36. unsigned short num; /* the number of saperated words */
  37. unsigned short sch; /* total space of chars in wordlist
  38. application should assign this value */
  39. unsigned short len; /* returned byte contains the result */
  40. }DOB;
  41. typedef struct tagDecomposeOutBufferW {
  42. LPWSTR wordlist;
  43. unsigned short num;
  44. unsigned short sch;
  45. unsigned short len;
  46. }WDOB;
  47. typedef DOB * LPDOB;
  48. typedef WDOB * LPWDOB;
  49. typedef struct tagComposeInputBuffer {
  50. LPSTR silsa;
  51. LPSTR heosa;
  52. WORD pos;
  53. }CIB;
  54. typedef struct tagComposeInputBufferW {
  55. LPWSTR silsa;
  56. LPWSTR heosa;
  57. WORD pos;
  58. }WCIB;
  59. #ifdef _UNICODE
  60. #define LPTDOB LPWDOB
  61. #define TCIB WCIB
  62. #define TDOB WDOB
  63. #else
  64. #define LPTDOB LPDOB
  65. #define TCIB CIB
  66. #define TDOB DOB
  67. #endif
  68. typedef WORD FAR PASCAL FNDECOMPOSE (LPDOB);
  69. typedef FNDECOMPOSE FAR *LPFNDECOMPOSE;
  70. typedef WORD FAR PASCAL FNDECOMPOSEW (LPWDOB);
  71. typedef FNDECOMPOSEW FAR *LPFNDECOMPOSEW;
  72. // Word Info : two byte
  73. /* Word Info : most left 4 bits of high byte */
  74. #define wtINVALID 0xffff
  75. #define wtSilsa 0x8000
  76. #define wtHeosa 0x0000
  77. /* general POS (a part of speech) info : right 4 bits of high byte */
  78. #define POS_NOUN 0x0100
  79. #define POS_VERB 0x0200
  80. #define POS_ADJECTIVE 0x0300
  81. #define POS_PRONOUN 0x0400
  82. #define POS_TOSSI 0x0500
  83. #define POS_ENDING 0x0600
  84. #define POS_ADVERB 0x0700
  85. #define POS_SUFFIX 0x0800
  86. #define POS_AUXVERB 0x0900
  87. #define POS_AUXADJ 0x0a00
  88. #define POS_SPECIFIER 0x0b00
  89. #define POS_NUMBER 0x0c00
  90. #define POS_PREFIX 0x0d00
  91. #define POS_OTHERS 0x0f00
  92. /* low byte : more detail POS info
  93. --- more word infos will be inserted in the near future */
  94. #define DEOL_SUFFIX 0x0001
  95. #define COPULA_OTHERS 0x0002
  96. #define PROPER_NOUN 0x0003
  97. /* Flag define for StemmerIsEnding */
  98. #define IS_ENDING 0x0001
  99. #define IS_TOSSI 0x0002
  100. /* return code : Low Byte SRC */
  101. #define srcOOM 1
  102. #define srcInvalid 2 /* Unknown word */
  103. #define srcModuleError 3 /* Something wrong with parameters, or state of stemmer module */
  104. #define srcIOErrorMdr 4
  105. #define srcIOErrorUdr 5
  106. #define srcNoMoreResult 6
  107. #define srcComposeError 7
  108. /* Minor Error Codes. Not set unless major code also set. */
  109. /* High Byte of SRC word var. */
  110. #define srcModuleAlreadyBusy (128<<16) /* For non-reentrant code */
  111. #define srcInvalidID (129<<16) /* Not yet inited or already terminated.*/
  112. #define srcExcessBuffer (130<<16) /* return buffer size is smaller than needed */
  113. #define srcInvalidMdr (131<<16) /* Mdr not registered with spell session */
  114. #define srcInvalidUdr (132<<16) /* Udr not registered with spell session */
  115. #define srcInvalidMainDict (134<<16) /* Specified dictionary not correct format */
  116. #define srcOperNotMatchedUserDict (135<<16) /* Illegal operation for user dictionary type. */
  117. #define srcFileReadError (136<<16) /* Generic read error */
  118. #define srcFileWriteError (137<<16) /* Generic write error */
  119. #define srcFileCreateError (138<<16) /* Generic create error */
  120. #define srcFileShareError (139<<16) /* Generic share error */
  121. #define srcModuleNotTerminated (140<<16) /* Module not able to be terminated completely.*/
  122. #define srcUserDictFull (141<<16) /* Could not update Udr without exceeding limit.*/
  123. #define srcInvalidUdrEntry (142<<16) /* invalid chars in string(s) */
  124. #define srcMdrCountExceeded (144<<16) /* Too many Mdr references */
  125. #define srcUdrCountExceeded (145<<16) /* Too many udr references */
  126. #define srcFileOpenError (146<<16) /* Generic Open error */
  127. #define srcFileTooLargeError (147<<16) /* Generic file too large error */
  128. #define srcUdrReadOnly (148<<16) /* Attempt to add to or write RO udr */
  129. #define WINSRC SRC
  130. //------------------------- FUNCTION LIST -----------------------------------
  131. extern WINSRC StemmerInit (HSTM *);
  132. extern WINSRC StemmerSetOption (HSTM, UINT);
  133. extern WINSRC StemmerGetOption (HSTM, UINT *);
  134. extern WINSRC StemmerDecompose (HSTM, LPCSTR, LPDOB);
  135. extern WINSRC StemmerDecomposeW (HSTM, LPCWSTR, LPWDOB);
  136. extern WINSRC StemmerDecomposeMore (HSTM, LPCSTR, LPDOB);
  137. extern WINSRC StemmerDecomposeMoreW (HSTM, LPCWSTR, LPWDOB);
  138. extern WINSRC StemmerEnumDecompose (HSTM, LPCSTR, LPDOB, LPFNDECOMPOSE);
  139. extern WINSRC StemmerEnumDecomposeW (HSTM, LPCWSTR, LPWDOB, LPFNDECOMPOSE);
  140. extern WINSRC StemmerCompose (HSTM, CIB, LPSTR);
  141. extern WINSRC StemmerComposeW (HSTM, WCIB, LPWSTR);
  142. extern WINSRC StemmerCompare (HSTM, LPCSTR, LPCSTR, LPSTR, LPSTR, LPSTR, WORD *);
  143. extern WINSRC StemmerCompareW (HSTM, LPCWSTR, LPCWSTR, LPWSTR, LPWSTR, LPWSTR, WORD *);
  144. extern WINSRC StemmerOpenMdr (HSTM, char *);
  145. extern WINSRC StemmerCloseMdr (HSTM);
  146. extern WINSRC StemmerTerminate (HSTM);
  147. extern WINSRC StemmerOpenUdr (HSTM, LPCSTR);
  148. extern WINSRC StemmerCloseUdr (HSTM);
  149. extern WINSRC StemmerIsEnding (HSTM, LPCSTR, UINT, BOOL *);
  150. extern WINSRC StemmerIsEndingW (HSTM, LPCWSTR, UINT, BOOL *);
  151. #define STEMMERKEY "SYSTEM\\currentcontrolset\\control\\ContentIndex\\Language\\Korean_Default"
  152. #define STEM_DICTIONARY "StemmerDictionary"
  153. BOOL StemInit();
  154. #endif /* STEMKOR_H */