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 
2 // Copyright (c) 2009-2014 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 public:
28  PorterStemmer();
29  virtual ~PorterStemmer();
30 
32 
33 protected:
34  wchar_t* b; // buffer for word to be stemmed
35  int32_t k; // offset to the end of the string
36  int32_t j; // a general offset into the string
37  int32_t i; // initial length of word
38  bool dirty;
39 
40 public:
41  bool stem(CharArray word);
42 
46  bool stem(wchar_t* b, int32_t k);
47 
48  wchar_t* getResultBuffer();
49  int32_t getResultLength();
50 
51 protected:
53  bool cons(int32_t i);
54 
63  int32_t m();
64 
66  bool vowelinstem();
67 
69  bool doublec(int32_t j);
70 
76  bool cvc(int32_t i);
77 
79  bool ends(const wchar_t* s);
80 
82  void setto(const wchar_t* s);
83 
84  void r(const wchar_t* s);
85 
105  void step1ab();
106 
108  void step1c();
109 
112  void step2();
113 
115  void step3();
116 
118  void step4();
119 
121  void step5();
122 };
123 
124 }
125 
126 #endif

clucene.sourceforge.net