xapian-core  2.1.0
indonesian.cc
Go to the documentation of this file.
1 /* Generated from indonesian.sbl by Snowball 3.1.1 - https://snowballstem.org/ */
2 
3 #include <config.h>
4 
5 #define SNOWBALL_RUNTIME_THROW_EXCEPTIONS
6 #include "indonesian.h"
7 
8 #include <stddef.h>
9 
11 
12 static int r_remove_suffix(struct SN_env * z);
13 static int r_remove_second_order_prefix(struct SN_env * z);
14 
15 static const symbol s_0[] = { 'a', 'j', 'a', 'r' };
16 static const symbol s_1[] = { 'a', 'j', 'a', 'r' };
17 static const symbol s_2[] = { 'e', 'r' };
18 static const symbol s_3[] = { 's' };
19 static const symbol s_4[] = { 's' };
20 static const symbol s_5[] = { 'p' };
21 static const symbol s_6[] = { 'p' };
22 
23 static const symbol s_0_0[3] = { 'k', 'a', 'h' };
24 static const symbol s_0_1[3] = { 'l', 'a', 'h' };
25 static const symbol s_0_2[3] = { 'p', 'u', 'n' };
26 static const struct among a_0[3] = {
27 { 3, s_0_0, 0, 1, 0},
28 { 3, s_0_1, 0, 1, 0},
29 { 3, s_0_2, 0, 1, 0}
30 };
31 
32 static const symbol s_1_0[3] = { 'n', 'y', 'a' };
33 static const symbol s_1_1[2] = { 'k', 'u' };
34 static const symbol s_1_2[2] = { 'm', 'u' };
35 static const struct among a_1[3] = {
36 { 3, s_1_0, 0, 1, 0},
37 { 2, s_1_1, 0, 1, 0},
38 { 2, s_1_2, 0, 1, 0}
39 };
40 
41 static const symbol s_2_0[1] = { 'i' };
42 static const symbol s_2_1[2] = { 'a', 'n' };
43 static const struct among a_2[2] = {
44 { 1, s_2_0, 0, 2, 0},
45 { 2, s_2_1, 0, 1, 0}
46 };
47 
48 static const symbol s_3_0[2] = { 'd', 'i' };
49 static const symbol s_3_1[2] = { 'k', 'e' };
50 static const symbol s_3_2[2] = { 'm', 'e' };
51 static const symbol s_3_3[3] = { 'm', 'e', 'm' };
52 static const symbol s_3_4[3] = { 'm', 'e', 'n' };
53 static const symbol s_3_5[4] = { 'm', 'e', 'n', 'g' };
54 static const symbol s_3_6[3] = { 'p', 'e', 'm' };
55 static const symbol s_3_7[3] = { 'p', 'e', 'n' };
56 static const symbol s_3_8[4] = { 'p', 'e', 'n', 'g' };
57 static const symbol s_3_9[3] = { 't', 'e', 'r' };
58 static const struct among a_3[10] = {
59 { 2, s_3_0, 0, 1, 0},
60 { 2, s_3_1, 0, 3, 0},
61 { 2, s_3_2, 0, 1, 0},
62 { 3, s_3_3, -1, 5, 0},
63 { 3, s_3_4, -2, 2, 0},
64 { 4, s_3_5, -1, 1, 0},
65 { 3, s_3_6, 0, 6, 0},
66 { 3, s_3_7, 0, 4, 0},
67 { 4, s_3_8, -1, 3, 0},
68 { 3, s_3_9, 0, 1, 0}
69 };
70 
71 static const symbol s_4_0[2] = { 'b', 'e' };
72 static const symbol s_4_1[2] = { 'p', 'e' };
73 static const struct among a_4[2] = {
74 { 2, s_4_0, 0, 2, 0},
75 { 2, s_4_1, 0, 1, 0}
76 };
77 
78 static const unsigned char g_vowel[] = { 17, 65, 16 };
79 
80 static int r_remove_suffix(struct SN_env * z) {
81  int among_var;
82  z->ket = z->c;
83  if (z->c <= z->lb || (z->p[z->c - 1] != 105 && z->p[z->c - 1] != 110)) return 0;
84  among_var = find_among_b(z, a_2, 2, 0);
85  if (!among_var) return 0;
86  z->bra = z->c;
87  switch (among_var) {
88  case 1:
89  do {
90  int v_1 = z->l - z->c;
91  if (((SN_local *)z)->i_prefix == 3) goto lab0;
92  if (((SN_local *)z)->i_prefix == 2) goto lab0;
93  if (z->c <= z->lb || z->p[z->c - 1] != 'k') goto lab0;
94  z->c--;
95  z->bra = z->c;
96  break;
97  lab0:
98  z->c = z->l - v_1;
99  if (((SN_local *)z)->i_prefix == 1) return 0;
100  } while (0);
101  break;
102  case 2:
103  if (((SN_local *)z)->i_prefix > 2) return 0;
104  if (z->c <= z->lb || z->p[z->c - 1] != 's') goto lab1;
105  z->c--;
106  return 0;
107  lab1:
108  break;
109  }
110  slice_del(z);
111  ((SN_local *)z)->i_measure -= 1;
112  return 1;
113 }
114 
115 static int r_remove_second_order_prefix(struct SN_env * z) {
116  int among_var;
117  z->bra = z->c;
118  if (z->c + 1 >= z->l || z->p[z->c + 1] != 101) return 0;
119  among_var = find_among(z, a_4, 2, 0);
120  if (!among_var) return 0;
121  switch (among_var) {
122  case 1:
123  do {
124  int v_1 = z->c;
125  if (z->c == z->l || z->p[z->c] != 'r') goto lab0;
126  z->c++;
127  z->ket = z->c;
128  ((SN_local *)z)->i_prefix = 2;
129  break;
130  lab0:
131  z->c = v_1;
132  if (z->c == z->l || z->p[z->c] != 'l') goto lab1;
133  z->c++;
134  z->ket = z->c;
135  if (!(eq_s(z, 4, s_0))) goto lab1;
136  break;
137  lab1:
138  z->c = v_1;
139  z->ket = z->c;
140  ((SN_local *)z)->i_prefix = 2;
141  } while (0);
142  break;
143  case 2:
144  do {
145  int v_2 = z->c;
146  if (z->c == z->l || z->p[z->c] != 'r') goto lab2;
147  z->c++;
148  z->ket = z->c;
149  break;
150  lab2:
151  z->c = v_2;
152  if (z->c == z->l || z->p[z->c] != 'l') goto lab3;
153  z->c++;
154  z->ket = z->c;
155  if (!(eq_s(z, 4, s_1))) goto lab3;
156  break;
157  lab3:
158  z->c = v_2;
159  z->ket = z->c;
160  if (out_grouping_U(z, g_vowel, 97, 117, 0)) return 0;
161  if (!(eq_s(z, 2, s_2))) return 0;
162  } while (0);
163  ((SN_local *)z)->i_prefix = 4;
164  break;
165  }
166  ((SN_local *)z)->i_measure -= 1;
167  slice_del(z);
168  return 1;
169 }
170 
172  int among_var;
173  ((SN_local *)z)->i_measure = 0;
174  {
175  int v_1 = z->c;
176  while (1) {
177  int v_2 = z->c;
178  {
179  int ret = out_grouping_U(z, g_vowel, 97, 117, 1);
180  if (ret < 0) goto lab1;
181  z->c += ret;
182  }
183  ((SN_local *)z)->i_measure += 1;
184  continue;
185  lab1:
186  z->c = v_2;
187  break;
188  }
189  z->c = v_1;
190  }
191  if (((SN_local *)z)->i_measure < 3) return 0;
192  ((SN_local *)z)->i_prefix = 0;
193  z->lb = z->c; z->c = z->l;
194  {
195  int v_3 = z->l - z->c;
196  z->ket = z->c;
197  if (z->c - 2 <= z->lb || (z->p[z->c - 1] != 104 && z->p[z->c - 1] != 110)) goto lab2;
198  if (!find_among_b(z, a_0, 3, 0)) goto lab2;
199  z->bra = z->c;
200  slice_del(z);
201  ((SN_local *)z)->i_measure -= 1;
202  lab2:
203  z->c = z->l - v_3;
204  }
205  if (((SN_local *)z)->i_measure < 3) return 0;
206  {
207  int v_4 = z->l - z->c;
208  z->ket = z->c;
209  if (z->c - 1 <= z->lb || (z->p[z->c - 1] != 97 && z->p[z->c - 1] != 117)) goto lab3;
210  if (!find_among_b(z, a_1, 3, 0)) goto lab3;
211  z->bra = z->c;
212  slice_del(z);
213  ((SN_local *)z)->i_measure -= 1;
214  lab3:
215  z->c = z->l - v_4;
216  }
217  z->c = z->lb;
218  if (((SN_local *)z)->i_measure < 3) return 0;
219  do {
220  int v_5 = z->c;
221  {
222  int v_6 = z->c;
223  z->bra = z->c;
224  if (z->c + 1 >= z->l || (z->p[z->c + 1] != 105 && z->p[z->c + 1] != 101)) goto lab4;
225  among_var = find_among(z, a_3, 10, 0);
226  if (!among_var) goto lab4;
227  z->ket = z->c;
228  switch (among_var) {
229  case 1:
230  slice_del(z);
231  ((SN_local *)z)->i_prefix = 1;
232  ((SN_local *)z)->i_measure -= 1;
233  break;
234  case 2:
235  do {
236  int v_7 = z->c;
237  if (z->c == z->l || z->p[z->c] != 'y') goto lab5;
238  z->c++;
239  {
240  int v_8 = z->c;
241  if (in_grouping_U(z, g_vowel, 97, 117, 0)) goto lab5;
242  z->c = v_8;
243  }
244  z->ket = z->c;
245  slice_from_s(z, 1, s_3);
246  ((SN_local *)z)->i_prefix = 1;
247  ((SN_local *)z)->i_measure -= 1;
248  break;
249  lab5:
250  z->c = v_7;
251  slice_del(z);
252  ((SN_local *)z)->i_prefix = 1;
253  ((SN_local *)z)->i_measure -= 1;
254  } while (0);
255  break;
256  case 3:
257  slice_del(z);
258  ((SN_local *)z)->i_prefix = 3;
259  ((SN_local *)z)->i_measure -= 1;
260  break;
261  case 4:
262  do {
263  int v_9 = z->c;
264  if (z->c == z->l || z->p[z->c] != 'y') goto lab6;
265  z->c++;
266  {
267  int v_10 = z->c;
268  if (in_grouping_U(z, g_vowel, 97, 117, 0)) goto lab6;
269  z->c = v_10;
270  }
271  z->ket = z->c;
272  slice_from_s(z, 1, s_4);
273  ((SN_local *)z)->i_prefix = 3;
274  ((SN_local *)z)->i_measure -= 1;
275  break;
276  lab6:
277  z->c = v_9;
278  slice_del(z);
279  ((SN_local *)z)->i_prefix = 3;
280  ((SN_local *)z)->i_measure -= 1;
281  } while (0);
282  break;
283  case 5:
284  ((SN_local *)z)->i_prefix = 1;
285  ((SN_local *)z)->i_measure -= 1;
286  do {
287  int v_11 = z->c;
288  {
289  int v_12 = z->c;
290  if (in_grouping_U(z, g_vowel, 97, 117, 0)) goto lab7;
291  z->c = v_12;
292  slice_from_s(z, 1, s_5);
293  }
294  break;
295  lab7:
296  z->c = v_11;
297  slice_del(z);
298  } while (0);
299  break;
300  case 6:
301  ((SN_local *)z)->i_prefix = 3;
302  ((SN_local *)z)->i_measure -= 1;
303  do {
304  int v_13 = z->c;
305  {
306  int v_14 = z->c;
307  if (in_grouping_U(z, g_vowel, 97, 117, 0)) goto lab8;
308  z->c = v_14;
309  slice_from_s(z, 1, s_6);
310  }
311  break;
312  lab8:
313  z->c = v_13;
314  slice_del(z);
315  } while (0);
316  break;
317  }
318  {
319  int v_15 = z->c;
320  {
321  int v_16 = z->c;
322  if (((SN_local *)z)->i_measure < 3) goto lab9;
323  z->lb = z->c; z->c = z->l;
324  if (!r_remove_suffix(z)) goto lab9;
325  z->c = z->lb;
326  z->c = v_16;
327  }
328  if (((SN_local *)z)->i_measure < 3) goto lab9;
329  if (!r_remove_second_order_prefix(z)) goto lab9;
330  lab9:
331  z->c = v_15;
332  }
333  z->c = v_6;
334  }
335  break;
336  lab4:
337  z->c = v_5;
338  {
339  int v_17 = z->c;
341  z->c = v_17;
342  }
343  {
344  int v_18 = z->c;
345  if (((SN_local *)z)->i_measure < 3) goto lab10;
346  z->lb = z->c; z->c = z->l;
347  if (!r_remove_suffix(z)) goto lab10;
348  z->c = z->lb;
349  lab10:
350  z->c = v_18;
351  }
352  } while (0);
353  return 1;
354 }
unsigned char symbol
Definition: api.h:4
static int stem(struct SN_env *z)
Definition: indonesian.cc:171
static const symbol s_2[]
Definition: indonesian.cc:17
static const symbol s_0_2[3]
Definition: indonesian.cc:25
static const struct among a_2[2]
Definition: indonesian.cc:43
static const symbol s_3_5[4]
Definition: indonesian.cc:53
static const symbol s_3_9[3]
Definition: indonesian.cc:57
static const symbol s_4[]
Definition: indonesian.cc:19
static const symbol s_3_7[3]
Definition: indonesian.cc:55
static const symbol s_1_2[2]
Definition: indonesian.cc:34
static const symbol s_3_1[2]
Definition: indonesian.cc:49
static const symbol s_4_1[2]
Definition: indonesian.cc:72
static const symbol s_2_0[1]
Definition: indonesian.cc:41
static const struct among a_0[3]
Definition: indonesian.cc:26
static const symbol s_6[]
Definition: indonesian.cc:21
static int r_remove_suffix(struct SN_env *z)
Definition: indonesian.cc:80
Xapian::Internal::Snowball::Indonesian::SN_local SN_local
Definition: indonesian.cc:10
static const symbol s_3[]
Definition: indonesian.cc:18
static const symbol s_3_0[2]
Definition: indonesian.cc:48
static const symbol s_1_1[2]
Definition: indonesian.cc:33
static const symbol s_0_0[3]
Definition: indonesian.cc:23
static const symbol s_0_1[3]
Definition: indonesian.cc:24
static const struct among a_3[10]
Definition: indonesian.cc:58
static const symbol s_3_6[3]
Definition: indonesian.cc:54
static const struct among a_4[2]
Definition: indonesian.cc:73
static const struct among a_1[3]
Definition: indonesian.cc:35
static const symbol s_1[]
Definition: indonesian.cc:16
static const symbol s_3_4[3]
Definition: indonesian.cc:52
static const symbol s_3_3[3]
Definition: indonesian.cc:51
static const symbol s_4_0[2]
Definition: indonesian.cc:71
static const symbol s_1_0[3]
Definition: indonesian.cc:32
static const symbol s_3_8[4]
Definition: indonesian.cc:56
static int r_remove_second_order_prefix(struct SN_env *z)
Definition: indonesian.cc:115
static const unsigned char g_vowel[]
Definition: indonesian.cc:78
static const symbol s_2_1[2]
Definition: indonesian.cc:42
static const symbol s_3_2[2]
Definition: indonesian.cc:50
static const symbol s_5[]
Definition: indonesian.cc:20
static const symbol s_0[]
Definition: indonesian.cc:15
int out_grouping_U(struct SN_env *z, const unsigned char *s, int min, int max, int repeat)
int in_grouping_U(struct SN_env *z, const unsigned char *s, int min, int max, int repeat)
SNOWBALL_ERR slice_from_s(struct SN_env *z, int s_size, const symbol *s)
int eq_s(struct SN_env *z, int s_size, const symbol *s)
int find_among_b(struct SN_env *z, const struct among *v, int v_size, int(*call_among_func)(struct SN_env *))
SNOWBALL_ERR slice_del(struct SN_env *z)
int find_among(struct SN_env *z, const struct among *v, int v_size, int(*call_among_func)(struct SN_env *))
Definition: api.h:12
int lb
Definition: api.h:14
symbol * p
Definition: api.h:13
int ket
Definition: api.h:14
int c
Definition: api.h:14
int bra
Definition: api.h:14
int l
Definition: api.h:14
Definition: header.h:295