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.

58 lines
1.3 KiB

  1. #ifndef __PROPER_NOUN_H__
  2. #define __PROPER_NOUN_H__
  3. #define NAME_LENGTH (3)
  4. #define FL_PROPER_NAME_THRESHOLD (0.0005 * 0.0005)
  5. #define FL_DEFAULT_CHAR_PROBABILITY (0.00005)
  6. typedef struct {
  7. DWORD dwUnicode;
  8. FLOAT flProbability;
  9. } CharProb, *PCharProb;
  10. typedef struct {
  11. WORD wPrevUnicode;
  12. WORD wNextUnicode;
  13. } EngName, *PEngName;
  14. typedef struct {
  15. DWORD dwTotalEngUnicodeNum;
  16. DWORD dwTotalEngNamePairNum;
  17. PWORD pwUnicode;
  18. PEngName pEngNamePair;
  19. } EngNameData, *PEngNameData;
  20. class CProperNoun {
  21. public:
  22. CProperNoun(HINSTANCE hInstance);
  23. ~CProperNoun();
  24. BOOL InitData();
  25. BOOL IsAProperNoun(LPWSTR lpwszChar, UINT uCount);
  26. BOOL IsAChineseName(LPCWSTR lpcwszChar, UINT uCount);
  27. BOOL IsAEnglishName(LPCWSTR lpcwszChar, UINT uCount);
  28. private:
  29. friend int __cdecl CharCompare(const void *item1, const void *item2);
  30. friend int __cdecl EngNameCompare(const void *item1, const void *item2);
  31. DOUBLE m_dProperNameThreshold;
  32. PCharProb m_pCharProb;
  33. DWORD m_dwTotalCharProbNum;
  34. PEngNameData m_pEngNameData;
  35. static WCHAR m_pwszSurname[][3];
  36. static DWORD m_dwTotalSurnameNum;
  37. HANDLE m_hProcessHeap;
  38. HINSTANCE m_hInstance;
  39. };
  40. typedef CProperNoun * PCProperNoun;
  41. #else
  42. #endif // __PROPER_NOUN_H__