Lucene++ - a full-featured, c++ search engine
API Documentation


 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
PorterStemmer.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2011 Alan Wright. All rights reserved.
3 // Distributable under the terms of either the Apache License (Version 2.0)
4 // or the GNU Lesser General Public License.
6 
7 #ifndef PORTERSTEMMER_H
8 #define PORTERSTEMMER_H
9 
10 #include "LuceneObject.h"
11 
12 namespace Lucene
13 {
26  class PorterStemmer : public LuceneObject
27  {
28  public:
29  PorterStemmer();
30  virtual ~PorterStemmer();
31 
33 
34  protected:
35  wchar_t* b; // buffer for word to be stemmed
36  int32_t k; // offset to the end of the string
37  int32_t j; // a general offset into the string
38  int32_t i; // initial length of word
39  bool dirty;
40 
41  public:
42  bool stem(CharArray word);
43 
47  bool stem(wchar_t* b, int32_t k);
48 
49  wchar_t* getResultBuffer();
50  int32_t getResultLength();
51 
52  protected:
54  bool cons(int32_t i);
55 
64  int32_t m();
65 
67  bool vowelinstem();
68 
70  bool doublec(int32_t j);
71 
77  bool cvc(int32_t i);
78 
80  bool ends(const wchar_t* s);
81 
83  void setto(const wchar_t* s);
84 
85  void r(const wchar_t* s);
86 
106  void step1ab();
107 
109  void step1c();
110 
113  void step2();
114 
116  void step3();
117 
119  void step4();
120 
122  void step5();
123  };
124 }
125 
126 #endif

clucene.sourceforge.net