xref: /Lucene/lucene/analysis/common/src/java/org/tartarus/snowball/ext/DutchStemmer.java (revision 0b1d8ccba6cf394f707a09217813a25ec1504e50)
1 // Generated by Snowball 2.0.0 - https://snowballstem.org/
2 
3 package org.tartarus.snowball.ext;
4 
5 import org.tartarus.snowball.Among;
6 
7 /**
8  * This class implements the stemming algorithm defined by a snowball script.
9  *
10  * <p>Generated by Snowball 2.0.0 - https://snowballstem.org/
11  */
12 @SuppressWarnings("unused")
13 public class DutchStemmer extends org.tartarus.snowball.SnowballStemmer {
14 
15   private static final long serialVersionUID = 1L;
16   private static final java.lang.invoke.MethodHandles.Lookup methodObject =
17       java.lang.invoke.MethodHandles.lookup();
18 
19   private static final Among a_0[] = {
20     new Among("", -1, 6),
21     new Among("\u00E1", 0, 1),
22     new Among("\u00E4", 0, 1),
23     new Among("\u00E9", 0, 2),
24     new Among("\u00EB", 0, 2),
25     new Among("\u00ED", 0, 3),
26     new Among("\u00EF", 0, 3),
27     new Among("\u00F3", 0, 4),
28     new Among("\u00F6", 0, 4),
29     new Among("\u00FA", 0, 5),
30     new Among("\u00FC", 0, 5)
31   };
32 
33   private static final Among a_1[] = {
34     new Among("", -1, 3), new Among("I", 0, 2), new Among("Y", 0, 1)
35   };
36 
37   private static final Among a_2[] = {
38     new Among("dd", -1, -1), new Among("kk", -1, -1), new Among("tt", -1, -1)
39   };
40 
41   private static final Among a_3[] = {
42     new Among("ene", -1, 2),
43     new Among("se", -1, 3),
44     new Among("en", -1, 2),
45     new Among("heden", 2, 1),
46     new Among("s", -1, 3)
47   };
48 
49   private static final Among a_4[] = {
50     new Among("end", -1, 1),
51     new Among("ig", -1, 2),
52     new Among("ing", -1, 1),
53     new Among("lijk", -1, 3),
54     new Among("baar", -1, 4),
55     new Among("bar", -1, 5)
56   };
57 
58   private static final Among a_5[] = {
59     new Among("aa", -1, -1),
60     new Among("ee", -1, -1),
61     new Among("oo", -1, -1),
62     new Among("uu", -1, -1)
63   };
64 
65   private static final char g_v[] = {17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128};
66 
67   private static final char g_v_I[] = {
68     1, 0, 0, 17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128
69   };
70 
71   private static final char g_v_j[] = {17, 67, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128};
72 
73   private int I_p2;
74   private int I_p1;
75   private boolean B_e_found;
76 
r_prelude()77   private boolean r_prelude() {
78     int among_var;
79     int v_1 = cursor;
80     while (true) {
81       int v_2 = cursor;
82       lab0:
83       {
84         bra = cursor;
85         among_var = find_among(a_0);
86         if (among_var == 0) {
87           break lab0;
88         }
89         ket = cursor;
90         switch (among_var) {
91           case 1:
92             slice_from("a");
93             break;
94           case 2:
95             slice_from("e");
96             break;
97           case 3:
98             slice_from("i");
99             break;
100           case 4:
101             slice_from("o");
102             break;
103           case 5:
104             slice_from("u");
105             break;
106           case 6:
107             if (cursor >= limit) {
108               break lab0;
109             }
110             cursor++;
111             break;
112         }
113         continue;
114       }
115       cursor = v_2;
116       break;
117     }
118     cursor = v_1;
119     int v_3 = cursor;
120     lab1:
121     {
122       bra = cursor;
123       if (!(eq_s("y"))) {
124         cursor = v_3;
125         break lab1;
126       }
127       ket = cursor;
128       slice_from("Y");
129     }
130     while (true) {
131       int v_4 = cursor;
132       lab2:
133       {
134         golab3:
135         while (true) {
136           int v_5 = cursor;
137           lab4:
138           {
139             if (!(in_grouping(g_v, 97, 232))) {
140               break lab4;
141             }
142             bra = cursor;
143             lab5:
144             {
145               int v_6 = cursor;
146               lab6:
147               {
148                 if (!(eq_s("i"))) {
149                   break lab6;
150                 }
151                 ket = cursor;
152                 if (!(in_grouping(g_v, 97, 232))) {
153                   break lab6;
154                 }
155                 slice_from("I");
156                 break lab5;
157               }
158               cursor = v_6;
159               if (!(eq_s("y"))) {
160                 break lab4;
161               }
162               ket = cursor;
163               slice_from("Y");
164             }
165             cursor = v_5;
166             break golab3;
167           }
168           cursor = v_5;
169           if (cursor >= limit) {
170             break lab2;
171           }
172           cursor++;
173         }
174         continue;
175       }
176       cursor = v_4;
177       break;
178     }
179     return true;
180   }
181 
r_mark_regions()182   private boolean r_mark_regions() {
183     I_p1 = limit;
184     I_p2 = limit;
185     golab0:
186     while (true) {
187       lab1:
188       {
189         if (!(in_grouping(g_v, 97, 232))) {
190           break lab1;
191         }
192         break golab0;
193       }
194       if (cursor >= limit) {
195         return false;
196       }
197       cursor++;
198     }
199     golab2:
200     while (true) {
201       lab3:
202       {
203         if (!(out_grouping(g_v, 97, 232))) {
204           break lab3;
205         }
206         break golab2;
207       }
208       if (cursor >= limit) {
209         return false;
210       }
211       cursor++;
212     }
213     I_p1 = cursor;
214     lab4:
215     {
216       if (!(I_p1 < 3)) {
217         break lab4;
218       }
219       I_p1 = 3;
220     }
221     golab5:
222     while (true) {
223       lab6:
224       {
225         if (!(in_grouping(g_v, 97, 232))) {
226           break lab6;
227         }
228         break golab5;
229       }
230       if (cursor >= limit) {
231         return false;
232       }
233       cursor++;
234     }
235     golab7:
236     while (true) {
237       lab8:
238       {
239         if (!(out_grouping(g_v, 97, 232))) {
240           break lab8;
241         }
242         break golab7;
243       }
244       if (cursor >= limit) {
245         return false;
246       }
247       cursor++;
248     }
249     I_p2 = cursor;
250     return true;
251   }
252 
r_postlude()253   private boolean r_postlude() {
254     int among_var;
255     while (true) {
256       int v_1 = cursor;
257       lab0:
258       {
259         bra = cursor;
260         among_var = find_among(a_1);
261         if (among_var == 0) {
262           break lab0;
263         }
264         ket = cursor;
265         switch (among_var) {
266           case 1:
267             slice_from("y");
268             break;
269           case 2:
270             slice_from("i");
271             break;
272           case 3:
273             if (cursor >= limit) {
274               break lab0;
275             }
276             cursor++;
277             break;
278         }
279         continue;
280       }
281       cursor = v_1;
282       break;
283     }
284     return true;
285   }
286 
r_R1()287   private boolean r_R1() {
288     if (!(I_p1 <= cursor)) {
289       return false;
290     }
291     return true;
292   }
293 
r_R2()294   private boolean r_R2() {
295     if (!(I_p2 <= cursor)) {
296       return false;
297     }
298     return true;
299   }
300 
r_undouble()301   private boolean r_undouble() {
302     int v_1 = limit - cursor;
303     if (find_among_b(a_2) == 0) {
304       return false;
305     }
306     cursor = limit - v_1;
307     ket = cursor;
308     if (cursor <= limit_backward) {
309       return false;
310     }
311     cursor--;
312     bra = cursor;
313     slice_del();
314     return true;
315   }
316 
r_e_ending()317   private boolean r_e_ending() {
318     B_e_found = false;
319     ket = cursor;
320     if (!(eq_s_b("e"))) {
321       return false;
322     }
323     bra = cursor;
324     if (!r_R1()) {
325       return false;
326     }
327     int v_1 = limit - cursor;
328     if (!(out_grouping_b(g_v, 97, 232))) {
329       return false;
330     }
331     cursor = limit - v_1;
332     slice_del();
333     B_e_found = true;
334     if (!r_undouble()) {
335       return false;
336     }
337     return true;
338   }
339 
r_en_ending()340   private boolean r_en_ending() {
341     if (!r_R1()) {
342       return false;
343     }
344     int v_1 = limit - cursor;
345     if (!(out_grouping_b(g_v, 97, 232))) {
346       return false;
347     }
348     cursor = limit - v_1;
349     {
350       int v_2 = limit - cursor;
351       lab0:
352       {
353         if (!(eq_s_b("gem"))) {
354           break lab0;
355         }
356         return false;
357       }
358       cursor = limit - v_2;
359     }
360     slice_del();
361     if (!r_undouble()) {
362       return false;
363     }
364     return true;
365   }
366 
r_standard_suffix()367   private boolean r_standard_suffix() {
368     int among_var;
369     int v_1 = limit - cursor;
370     lab0:
371     {
372       ket = cursor;
373       among_var = find_among_b(a_3);
374       if (among_var == 0) {
375         break lab0;
376       }
377       bra = cursor;
378       switch (among_var) {
379         case 1:
380           if (!r_R1()) {
381             break lab0;
382           }
383           slice_from("heid");
384           break;
385         case 2:
386           if (!r_en_ending()) {
387             break lab0;
388           }
389           break;
390         case 3:
391           if (!r_R1()) {
392             break lab0;
393           }
394           if (!(out_grouping_b(g_v_j, 97, 232))) {
395             break lab0;
396           }
397           slice_del();
398           break;
399       }
400     }
401     cursor = limit - v_1;
402     int v_2 = limit - cursor;
403     r_e_ending();
404     cursor = limit - v_2;
405     int v_3 = limit - cursor;
406     lab1:
407     {
408       ket = cursor;
409       if (!(eq_s_b("heid"))) {
410         break lab1;
411       }
412       bra = cursor;
413       if (!r_R2()) {
414         break lab1;
415       }
416       {
417         int v_4 = limit - cursor;
418         lab2:
419         {
420           if (!(eq_s_b("c"))) {
421             break lab2;
422           }
423           break lab1;
424         }
425         cursor = limit - v_4;
426       }
427       slice_del();
428       ket = cursor;
429       if (!(eq_s_b("en"))) {
430         break lab1;
431       }
432       bra = cursor;
433       if (!r_en_ending()) {
434         break lab1;
435       }
436     }
437     cursor = limit - v_3;
438     int v_5 = limit - cursor;
439     lab3:
440     {
441       ket = cursor;
442       among_var = find_among_b(a_4);
443       if (among_var == 0) {
444         break lab3;
445       }
446       bra = cursor;
447       switch (among_var) {
448         case 1:
449           if (!r_R2()) {
450             break lab3;
451           }
452           slice_del();
453           lab4:
454           {
455             int v_6 = limit - cursor;
456             lab5:
457             {
458               ket = cursor;
459               if (!(eq_s_b("ig"))) {
460                 break lab5;
461               }
462               bra = cursor;
463               if (!r_R2()) {
464                 break lab5;
465               }
466               {
467                 int v_7 = limit - cursor;
468                 lab6:
469                 {
470                   if (!(eq_s_b("e"))) {
471                     break lab6;
472                   }
473                   break lab5;
474                 }
475                 cursor = limit - v_7;
476               }
477               slice_del();
478               break lab4;
479             }
480             cursor = limit - v_6;
481             if (!r_undouble()) {
482               break lab3;
483             }
484           }
485           break;
486         case 2:
487           if (!r_R2()) {
488             break lab3;
489           }
490           {
491             int v_8 = limit - cursor;
492             lab7:
493             {
494               if (!(eq_s_b("e"))) {
495                 break lab7;
496               }
497               break lab3;
498             }
499             cursor = limit - v_8;
500           }
501           slice_del();
502           break;
503         case 3:
504           if (!r_R2()) {
505             break lab3;
506           }
507           slice_del();
508           if (!r_e_ending()) {
509             break lab3;
510           }
511           break;
512         case 4:
513           if (!r_R2()) {
514             break lab3;
515           }
516           slice_del();
517           break;
518         case 5:
519           if (!r_R2()) {
520             break lab3;
521           }
522           if (!(B_e_found)) {
523             break lab3;
524           }
525           slice_del();
526           break;
527       }
528     }
529     cursor = limit - v_5;
530     int v_9 = limit - cursor;
531     lab8:
532     {
533       if (!(out_grouping_b(g_v_I, 73, 232))) {
534         break lab8;
535       }
536       int v_10 = limit - cursor;
537       if (find_among_b(a_5) == 0) {
538         break lab8;
539       }
540       if (!(out_grouping_b(g_v, 97, 232))) {
541         break lab8;
542       }
543       cursor = limit - v_10;
544       ket = cursor;
545       if (cursor <= limit_backward) {
546         break lab8;
547       }
548       cursor--;
549       bra = cursor;
550       slice_del();
551     }
552     cursor = limit - v_9;
553     return true;
554   }
555 
556   @Override
stem()557   public boolean stem() {
558     int v_1 = cursor;
559     r_prelude();
560     cursor = v_1;
561     int v_2 = cursor;
562     r_mark_regions();
563     cursor = v_2;
564     limit_backward = cursor;
565     cursor = limit;
566     r_standard_suffix();
567     cursor = limit_backward;
568     int v_4 = cursor;
569     r_postlude();
570     cursor = v_4;
571     return true;
572   }
573 
574   @Override
equals(Object o)575   public boolean equals(Object o) {
576     return o instanceof DutchStemmer;
577   }
578 
579   @Override
hashCode()580   public int hashCode() {
581     return DutchStemmer.class.getName().hashCode();
582   }
583 }
584