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.

82 lines
2.4 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1991 - 1995.
  5. //
  6. // File: stemsink.hxx
  7. //
  8. // Contents: IStemSink implementation
  9. //
  10. // Classes: CStemmerSink
  11. //
  12. // History: 3-May-95 SitaramR Created.
  13. //
  14. //----------------------------------------------------------------------------
  15. #pragma once
  16. //+---------------------------------------------------------------------------
  17. //
  18. // Class: CStemmerSink
  19. //
  20. // Purpose: Stemmer stage in filtering pipeline, which consists of:
  21. // Word Breaker
  22. // Stemmer
  23. // Normalizer
  24. // Noise List
  25. //
  26. // History: 3-May-95 SitaramR Created.
  27. //
  28. //----------------------------------------------------------------------------
  29. class CStemmerSink : public PWordRepository, public IStemSink
  30. {
  31. public:
  32. CStemmerSink ( IStemmer *pStemmer, PWordRepository& wordRep );
  33. ~CStemmerSink () { }
  34. //
  35. // From PWordRepository
  36. //
  37. unsigned GetMaxBufferLen () { return _cwcMaxNormBuf; }
  38. void GetFlags ( BOOL** ppRange, CI_RANK** ppRank );
  39. void ProcessAltWord ( WCHAR const *pwcInBuf, ULONG cwc );
  40. void ProcessWord ( WCHAR const *pwcInBuf, ULONG cwc );
  41. void StartAltPhrase () { _wordRep.StartAltPhrase(); }
  42. void EndAltPhrase () { _wordRep.EndAltPhrase(); }
  43. void SkipNoiseWords ( ULONG cWords ) { _wordRep.SkipNoiseWords( cWords ); }
  44. void SetOccurrence ( OCCURRENCE occ ) { _wordRep.SetOccurrence( occ ); }
  45. OCCURRENCE GetOccurrence () { return _wordRep.GetOccurrence(); }
  46. //
  47. // From IUnknown
  48. //
  49. virtual SCODE STDMETHODCALLTYPE QueryInterface ( REFIID riid, void **ppvObject );
  50. virtual ULONG STDMETHODCALLTYPE AddRef ();
  51. virtual ULONG STDMETHODCALLTYPE Release ();
  52. //
  53. // From IStemSink
  54. //
  55. virtual SCODE STDMETHODCALLTYPE PutAltWord ( WCHAR const *pwcInBuf, ULONG cwc );
  56. virtual SCODE STDMETHODCALLTYPE PutWord ( WCHAR const *pwcInBuf, ULONG cwc );
  57. private:
  58. SCODE PutStemmedWord ( WCHAR const *pwcInBuf, ULONG cwc, BOOL fAltWord );
  59. PWordRepository& _wordRep;
  60. unsigned _cwcMaxNormBuf;
  61. IStemmer *_pStemmer;
  62. BOOL _fWBreakAltWord; // is the current word an alternate
  63. // word according to the wordbreaker ?
  64. };