Leaked source code of windows server 2003
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.

60 lines
1.9 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. #include "listWordBreak.hpp" // new memory management
  20. class CThaiBreakTree;
  21. class CThaiWordBreak {
  22. public:
  23. CThaiWordBreak();
  24. ~CThaiWordBreak();
  25. PTEC Init(const WCHAR* wzFileName, const WCHAR* wzFileNameTrigram);
  26. PTEC InitRc(LPBYTE , LPBYTE, BOOL);
  27. void UnInit();
  28. int IndexWordBreak(WCHAR* wzString,unsigned int iStringLen, BYTE* pBreakPos,THWB_STRUCT* pThwb_Struct,unsigned int iBreakMax);
  29. int FindAltWord(WCHAR* wzWord,unsigned int iWordLen, BYTE Alt, BYTE* pBreakPos);
  30. int FindWordBreak(WCHAR* wzString,unsigned int iStringLen, BYTE* pBreakPos,unsigned int iBreakMax, BYTE mode, bool fFastWordBreak = true);
  31. DWORD_PTR CreateWordBreaker();
  32. bool DeleteWordBreaker(DWORD_PTR dwBreaker);
  33. 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);
  34. BOOL Find(const WCHAR* wzString, DWORD* pdwPOS);
  35. int Soundex(WCHAR* word) {return 0;} //breakTree.Soundex(word);} -- re-entrant bug fix
  36. protected:
  37. #if defined (NGRAM_ENABLE)
  38. BOOL WordBreak(WCHAR* pszBegin, WCHAR* pszEnd);
  39. #endif
  40. CTrie m_trie;
  41. #if defined (NGRAM_ENABLE)
  42. CTrie trie_sentence_struct;
  43. #endif
  44. CTrie m_trie_trigram;
  45. CThaiTrieIter m_thaiTrieIter;
  46. // new memory management
  47. ListWordBreak listWordBreak;
  48. int wordCount[MAXBREAK];
  49. };
  50. #endif