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.

59 lines
1.8 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. //
  4. // CThaiWordBreak
  5. //
  6. // History:
  7. // created 7/99 aarayas
  8. //
  9. // �1999 Microsoft Corporation
  10. //----------------------------------------------------------------------------
  11. #ifndef _CTHAIWORDBREAK_H_
  12. #define _CTHAIWORDBREAK_H_
  13. #include "thwbdef.hpp"
  14. #include "ctrie.hpp"
  15. #include "CThaiTrieIter.hpp"
  16. #include "lextable.hpp"
  17. #include "CThaiBreakTree.hpp"
  18. #include "CThaiTrigramTrieIter.hpp"
  19. class CThaiBreakTree;
  20. class CThaiWordBreak {
  21. public:
  22. #if defined (NGRAM_ENABLE)
  23. PTEC Init(WCHAR* wzFileName, WCHAR* wzFileNameSentStruct, WCHAR* wzFileNameTrigram);
  24. #else
  25. PTEC Init(WCHAR* wzFileName, WCHAR* wzFileNameTrigram);
  26. #endif
  27. PTEC InitRc(LPBYTE , LPBYTE);
  28. void UnInit();
  29. int IndexWordBreak(WCHAR* wzString,unsigned int iStringLen, BYTE* pBreakPos,THWB_STRUCT* pThwb_Struct,unsigned int iBreakMax);
  30. int FindAltWord(WCHAR* wzWord,unsigned int iWordLen, BYTE Alt, BYTE* pBreakPos);
  31. int FindWordBreak(WCHAR* wzString,unsigned int iStringLen, BYTE* pBreakPos,unsigned int iBreakMax, BYTE mode, bool fFastWordBreak = true);
  32. DWORD_PTR CreateWordBreaker();
  33. bool DeleteWordBreaker(DWORD_PTR dwBreaker);
  34. int FindWordBreak(DWORD_PTR dwBreaker, WCHAR* wzString,unsigned int iStringLen, BYTE* pBreakPos,unsigned int iBreakMax, BYTE mode, bool fFastWordBreak = true, THWB_STRUCT* pThwb_Struct = NULL);
  35. BOOL Find(WCHAR* wzString, DWORD* pdwPOS);
  36. int Soundex(WCHAR* word) {return 0;} //breakTree.Soundex(word);} -- re-entrant bug fix
  37. protected:
  38. #if defined (NGRAM_ENABLE)
  39. BOOL WordBreak(WCHAR* pszBegin, WCHAR* pszEnd);
  40. #endif
  41. CTrie m_trie;
  42. #if defined (NGRAM_ENABLE)
  43. CTrie trie_sentence_struct;
  44. #endif
  45. CTrie m_trie_trigram;
  46. CThaiTrieIter m_thaiTrieIter;
  47. // CThaiBreakTree breakTree; fix re-entrant bug.
  48. int wordCount[MAXBREAK];
  49. };
  50. #endif