xapian-core  2.1.0
dutch.h
Go to the documentation of this file.
1 /* Generated from dutch.sbl by Snowball 3.1.1 - https://snowballstem.org/ */
2 
3 #include <xapian/stem.h>
4 
5 #define SNOWBALL_RUNTIME_THROW_EXCEPTIONS
7 
9 
11  public:
12  struct SN_local {
13  struct SN_env z;
14  int i_p2;
15  int i_p1;
17  };
18 
19  private:
21 
22  void close_env() {
23  struct SN_env * z = &(zlocal.z);
24  lose_s(((SN_local *)z)->s_ch);
25  lose_s(z->p);
26  }
27 
28  static int stem(struct SN_env * z);
29 
30  public:
31  Dutch() {
32  struct SN_env * z = &(zlocal.z);
33  z->p = create_s();
34  try {
35  ((SN_local *)z)->s_ch = create_s();
36  } catch (...) {
37  close_env();
38  throw;
39  }
40  }
41 
42  ~Dutch() {
43  close_env();
44  }
45 
46  std::string operator()(const std::string& word) override {
47  struct SN_env* z = &(zlocal.z);
48  const symbol* s = reinterpret_cast<const symbol*>(word.data());
49  int s_size = word.size() > INT_MAX ? INT_MAX : word.size();
50  replace_s(z, 0, z->l, s_size, s);
51  z->c = 0;
53  return std::string(reinterpret_cast<const char*>(z->p), SIZE(z->p));
54  }
55 
56  bool use_proper_noun_heuristic() const override {
57  return true;
58  }
59 
60  std::string get_description() const override {
61  return "dutch";
62  }
63 };
64 
65 }
unsigned char symbol
Definition: api.h:4
std::string operator()(const std::string &word) override
Stem the specified word.
Definition: dutch.h:46
static int stem(struct SN_env *z)
Definition: dutch.cc:603
std::string get_description() const override
Return a string describing this object.
Definition: dutch.h:60
bool use_proper_noun_heuristic() const override
Should QueryParser suppress stemming for capitalised words?
Definition: dutch.h:56
Class representing a stemming algorithm implementation.
Definition: stem.h:41
#define SIZE(p)
Definition: header.h:21
void lose_s(byte *p)
byte * create_s(int n)
SNOWBALL_ERR replace_s(struct SN_env *z, int c_bra, int c_ket, int s_size, const symbol *s)
stemming algorithms
Definition: api.h:12
symbol * p
Definition: api.h:13
int c
Definition: api.h:14
int l
Definition: api.h:14