Lucene.Net  3.0.3
Lucene.Net is a port of the Lucene search engine library, written in C# and targeted at .NET runtime users.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Pages
DutchStemmer.cs
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 // This file was generated automatically by the Snowball to Java compiler
19 using System;
20 using Among = SF.Snowball.Among;
21 using SnowballProgram = SF.Snowball.SnowballProgram;
22 namespace SF.Snowball.Ext
23 {
24 #pragma warning disable 162
25 
26  /// <summary> Generated class implementing code defined by a snowball script.</summary>
28  {
29  public DutchStemmer()
30  {
31  InitBlock();
32  }
33  private void InitBlock()
34  {
35  a_0 = new Among[]{new Among("", - 1, 6, "", this), new Among("\u00E1", 0, 1, "", this), new Among("\u00E4", 0, 1, "", this), new Among("\u00E9", 0, 2, "", this), new Among("\u00EB", 0, 2, "", this), new Among("\u00ED", 0, 3, "", this), new Among("\u00EF", 0, 3, "", this), new Among("\u00F3", 0, 4, "", this), new Among("\u00F6", 0, 4, "", this), new Among("\u00FA", 0, 5, "", this), new Among("\u00FC", 0, 5, "", this)};
36  a_1 = new Among[]{new Among("", - 1, 3, "", this), new Among("I", 0, 2, "", this), new Among("Y", 0, 1, "", this)};
37  a_2 = new Among[]{new Among("dd", - 1, - 1, "", this), new Among("kk", - 1, - 1, "", this), new Among("tt", - 1, - 1, "", this)};
38  a_3 = new Among[]{new Among("ene", - 1, 2, "", this), new Among("se", - 1, 3, "", this), new Among("en", - 1, 2, "", this), new Among("heden", 2, 1, "", this), new Among("s", - 1, 3, "", this)};
39  a_4 = new Among[]{new Among("end", - 1, 1, "", this), new Among("ig", - 1, 2, "", this), new Among("ing", - 1, 1, "", this), new Among("lijk", - 1, 3, "", this), new Among("baar", - 1, 4, "", this), new Among("bar", - 1, 5, "", this)};
40  a_5 = new Among[]{new Among("aa", - 1, - 1, "", this), new Among("ee", - 1, - 1, "", this), new Among("oo", - 1, - 1, "", this), new Among("uu", - 1, - 1, "", this)};
41  }
42 
43  private Among[] a_0;
44  private Among[] a_1;
45  private Among[] a_2;
46  private Among[] a_3;
47  private Among[] a_4;
48  private Among[] a_5;
49  private static readonly char[] g_v = new char[]{(char) (17), (char) (65), (char) (16), (char) (1), (char) (0), (char) (0), (char) (0), (char) (0), (char) (0), (char) (0), (char) (0), (char) (0), (char) (0), (char) (0), (char) (0), (char) (0), (char) (128)};
50  private static readonly char[] g_v_I = new char[]{(char) (1), (char) (0), (char) (0), (char) (17), (char) (65), (char) (16), (char) (1), (char) (0), (char) (0), (char) (0), (char) (0), (char) (0), (char) (0), (char) (0), (char) (0), (char) (0), (char) (0), (char) (0), (char) (0), (char) (128)};
51  private static readonly char[] g_v_j = new char[]{(char) (17), (char) (67), (char) (16), (char) (1), (char) (0), (char) (0), (char) (0), (char) (0), (char) (0), (char) (0), (char) (0), (char) (0), (char) (0), (char) (0), (char) (0), (char) (0), (char) (128)};
52 
53  private int I_p2;
54  private int I_p1;
55  private bool B_e_found;
56 
57  protected internal virtual void copy_from(DutchStemmer other)
58  {
59  I_p2 = other.I_p2;
60  I_p1 = other.I_p1;
61  B_e_found = other.B_e_found;
62  base.copy_from(other);
63  }
64 
65  private bool r_prelude()
66  {
67  int among_var;
68  int v_1;
69  int v_2;
70  int v_3;
71  int v_4;
72  int v_5;
73  int v_6;
74  // (, line 41
75  // test, line 42
76  v_1 = cursor;
77  // repeat, line 42
78  while (true)
79  {
80  v_2 = cursor;
81  do
82  {
83  // (, line 42
84  // [, line 43
85  bra = cursor;
86  // substring, line 43
87  among_var = find_among(a_0, 11);
88  if (among_var == 0)
89  {
90  goto lab1_brk;
91  }
92  // ], line 43
93  ket = cursor;
94  switch (among_var)
95  {
96 
97  case 0:
98  goto lab1_brk;
99 
100  case 1:
101  // (, line 45
102  // <-, line 45
103  slice_from("a");
104  break;
105 
106  case 2:
107  // (, line 47
108  // <-, line 47
109  slice_from("e");
110  break;
111 
112  case 3:
113  // (, line 49
114  // <-, line 49
115  slice_from("i");
116  break;
117 
118  case 4:
119  // (, line 51
120  // <-, line 51
121  slice_from("o");
122  break;
123 
124  case 5:
125  // (, line 53
126  // <-, line 53
127  slice_from("u");
128  break;
129 
130  case 6:
131  // (, line 54
132  // next, line 54
133  if (cursor >= limit)
134  {
135  goto lab1_brk;
136  }
137  cursor++;
138  break;
139  }
140  goto replab0;
141  }
142  while (false);
143 
144 lab1_brk: ;
145 
146  cursor = v_2;
147  goto replab0_brk;
148 
149 replab0: ;
150  }
151 
152 replab0_brk: ;
153 
154  cursor = v_1;
155  // try, line 57
156  v_3 = cursor;
157  do
158  {
159  // (, line 57
160  // [, line 57
161  bra = cursor;
162  // literal, line 57
163  if (!(eq_s(1, "y")))
164  {
165  cursor = v_3;
166  goto lab2_brk;
167  }
168  // ], line 57
169  ket = cursor;
170  // <-, line 57
171  slice_from("Y");
172  }
173  while (false);
174 
175 lab2_brk: ;
176 
177  // repeat, line 58
178  while (true)
179  {
180  v_4 = cursor;
181  do
182  {
183  // goto, line 58
184  while (true)
185  {
186  v_5 = cursor;
187  do
188  {
189  // (, line 58
190  if (!(in_grouping(g_v, 97, 232)))
191  {
192  goto lab6_brk;
193  }
194  // [, line 59
195  bra = cursor;
196  // or, line 59
197  do
198  {
199  v_6 = cursor;
200  do
201  {
202  // (, line 59
203  // literal, line 59
204  if (!(eq_s(1, "i")))
205  {
206  goto lab8_brk;
207  }
208  // ], line 59
209  ket = cursor;
210  if (!(in_grouping(g_v, 97, 232)))
211  {
212  goto lab8_brk;
213  }
214  // <-, line 59
215  slice_from("I");
216  goto lab7_brk;
217  }
218  while (false);
219 
220 lab8_brk: ;
221 
222  cursor = v_6;
223  // (, line 60
224  // literal, line 60
225  if (!(eq_s(1, "y")))
226  {
227  goto lab6_brk;
228  }
229  // ], line 60
230  ket = cursor;
231  // <-, line 60
232  slice_from("Y");
233  }
234  while (false);
235 
236 lab7_brk: ;
237 
238  cursor = v_5;
239  goto golab5_brk;
240  }
241  while (false);
242 
243 lab6_brk: ;
244 
245  cursor = v_5;
246  if (cursor >= limit)
247  {
248  goto lab4_brk;
249  }
250  cursor++;
251  }
252 
253 golab5_brk: ;
254 
255  goto replab3;
256  }
257  while (false);
258 
259 lab4_brk: ;
260 
261  cursor = v_4;
262  goto replab3_brk;
263 
264 replab3: ;
265  }
266 
267 replab3_brk: ;
268 
269  return true;
270  }
271 
272  private bool r_mark_regions()
273  {
274  // (, line 64
275  I_p1 = limit;
276  I_p2 = limit;
277  // gopast, line 69
278  while (true)
279  {
280  do
281  {
282  if (!(in_grouping(g_v, 97, 232)))
283  {
284  goto lab3_brk;
285  }
286  goto golab0_brk;
287  }
288  while (false);
289 
290 lab3_brk: ;
291 
292  if (cursor >= limit)
293  {
294  return false;
295  }
296  cursor++;
297  }
298 
299 golab0_brk: ;
300 
301  // gopast, line 69
302  while (true)
303  {
304  do
305  {
306  if (!(out_grouping(g_v, 97, 232)))
307  {
308  goto lab3_brk;
309  }
310  goto golab2_brk;
311  }
312  while (false);
313 
314 lab3_brk: ;
315 
316  if (cursor >= limit)
317  {
318  return false;
319  }
320  cursor++;
321  }
322 
323 golab2_brk: ;
324 
325  // setmark p1, line 69
326  I_p1 = cursor;
327  // try, line 70
328  do
329  {
330  // (, line 70
331  if (!(I_p1 < 3))
332  {
333  goto lab5_brk;
334  }
335  I_p1 = 3;
336  }
337  while (false);
338 
339 lab5_brk: ;
340 
341  // gopast, line 71
342  while (true)
343  {
344  do
345  {
346  if (!(in_grouping(g_v, 97, 232)))
347  {
348  goto lab9_brk;
349  }
350  goto golab6_brk;
351  }
352  while (false);
353 
354 lab9_brk: ;
355 
356  if (cursor >= limit)
357  {
358  return false;
359  }
360  cursor++;
361  }
362 
363 golab6_brk: ;
364 
365  // gopast, line 71
366  while (true)
367  {
368  do
369  {
370  if (!(out_grouping(g_v, 97, 232)))
371  {
372  goto lab9_brk;
373  }
374  goto golab7_brk;
375  }
376  while (false);
377 
378 lab9_brk: ;
379 
380  if (cursor >= limit)
381  {
382  return false;
383  }
384  cursor++;
385  }
386 
387 golab7_brk: ;
388 
389  // setmark p2, line 71
390  I_p2 = cursor;
391  return true;
392  }
393 
394  private bool r_postlude()
395  {
396  int among_var;
397  int v_1;
398  // repeat, line 75
399  while (true)
400  {
401  v_1 = cursor;
402  do
403  {
404  // (, line 75
405  // [, line 77
406  bra = cursor;
407  // substring, line 77
408  among_var = find_among(a_1, 3);
409  if (among_var == 0)
410  {
411  goto lab5_brk;
412  }
413  // ], line 77
414  ket = cursor;
415  switch (among_var)
416  {
417 
418  case 0:
419  goto lab5_brk;
420 
421  case 1:
422  // (, line 78
423  // <-, line 78
424  slice_from("y");
425  break;
426 
427  case 2:
428  // (, line 79
429  // <-, line 79
430  slice_from("i");
431  break;
432 
433  case 3:
434  // (, line 80
435  // next, line 80
436  if (cursor >= limit)
437  {
438  goto lab5_brk;
439  }
440  cursor++;
441  break;
442  }
443  goto replab1;
444  }
445  while (false);
446 
447 lab5_brk: ;
448 
449  cursor = v_1;
450  goto replab1_brk;
451 
452 replab1: ;
453  }
454 
455 replab1_brk: ;
456 
457  return true;
458  }
459 
460  private bool r_R1()
461  {
462  if (!(I_p1 <= cursor))
463  {
464  return false;
465  }
466  return true;
467  }
468 
469  private bool r_R2()
470  {
471  if (!(I_p2 <= cursor))
472  {
473  return false;
474  }
475  return true;
476  }
477 
478  private bool r_undouble()
479  {
480  int v_1;
481  // (, line 90
482  // test, line 91
483  v_1 = limit - cursor;
484  // among, line 91
485  if (find_among_b(a_2, 3) == 0)
486  {
487  return false;
488  }
489  cursor = limit - v_1;
490  // [, line 91
491  ket = cursor;
492  // next, line 91
493  if (cursor <= limit_backward)
494  {
495  return false;
496  }
497  cursor--;
498  // ], line 91
499  bra = cursor;
500  // delete, line 91
501  slice_del();
502  return true;
503  }
504 
505  private bool r_e_ending()
506  {
507  int v_1;
508  // (, line 94
509  // unset e_found, line 95
510  B_e_found = false;
511  // [, line 96
512  ket = cursor;
513  // literal, line 96
514  if (!(eq_s_b(1, "e")))
515  {
516  return false;
517  }
518  // ], line 96
519  bra = cursor;
520  // call R1, line 96
521  if (!r_R1())
522  {
523  return false;
524  }
525  // test, line 96
526  v_1 = limit - cursor;
527  if (!(out_grouping_b(g_v, 97, 232)))
528  {
529  return false;
530  }
531  cursor = limit - v_1;
532  // delete, line 96
533  slice_del();
534  // set e_found, line 97
535  B_e_found = true;
536  // call undouble, line 98
537  if (!r_undouble())
538  {
539  return false;
540  }
541  return true;
542  }
543 
544  private bool r_en_ending()
545  {
546  int v_1;
547  int v_2;
548  // (, line 101
549  // call R1, line 102
550  if (!r_R1())
551  {
552  return false;
553  }
554  // and, line 102
555  v_1 = limit - cursor;
556  if (!(out_grouping_b(g_v, 97, 232)))
557  {
558  return false;
559  }
560  cursor = limit - v_1;
561  // not, line 102
562  {
563  v_2 = limit - cursor;
564  do
565  {
566  // literal, line 102
567  if (!(eq_s_b(3, "gem")))
568  {
569  goto lab0_brk;
570  }
571  return false;
572  }
573  while (false);
574 
575 lab0_brk: ;
576 
577  cursor = limit - v_2;
578  }
579  // delete, line 102
580  slice_del();
581  // call undouble, line 103
582  if (!r_undouble())
583  {
584  return false;
585  }
586  return true;
587  }
588 
589  private bool r_standard_suffix()
590  {
591  int among_var;
592  int v_1;
593  int v_2;
594  int v_3;
595  int v_4;
596  int v_5;
597  int v_6;
598  int v_7;
599  int v_8;
600  int v_9;
601  int v_10;
602  // (, line 106
603  // do, line 107
604  v_1 = limit - cursor;
605  do
606  {
607  // (, line 107
608  // [, line 108
609  ket = cursor;
610  // substring, line 108
611  among_var = find_among_b(a_3, 5);
612  if (among_var == 0)
613  {
614  goto lab0_brk;
615  }
616  // ], line 108
617  bra = cursor;
618  switch (among_var)
619  {
620 
621  case 0:
622  goto lab0_brk;
623 
624  case 1:
625  // (, line 110
626  // call R1, line 110
627  if (!r_R1())
628  {
629  goto lab0_brk;
630  }
631  // <-, line 110
632  slice_from("heid");
633  break;
634 
635  case 2:
636  // (, line 113
637  // call en_ending, line 113
638  if (!r_en_ending())
639  {
640  goto lab0_brk;
641  }
642  break;
643 
644  case 3:
645  // (, line 116
646  // call R1, line 116
647  if (!r_R1())
648  {
649  goto lab0_brk;
650  }
651  if (!(out_grouping_b(g_v_j, 97, 232)))
652  {
653  goto lab0_brk;
654  }
655  // delete, line 116
656  slice_del();
657  break;
658  }
659  }
660  while (false);
661 
662 lab0_brk: ;
663 
664  cursor = limit - v_1;
665  // do, line 120
666  v_2 = limit - cursor;
667  do
668  {
669  // call e_ending, line 120
670  if (!r_e_ending())
671  {
672  goto lab1_brk;
673  }
674  }
675  while (false);
676 
677 lab1_brk: ;
678 
679  cursor = limit - v_2;
680  // do, line 122
681  v_3 = limit - cursor;
682  do
683  {
684  // (, line 122
685  // [, line 122
686  ket = cursor;
687  // literal, line 122
688  if (!(eq_s_b(4, "heid")))
689  {
690  goto lab2_brk;
691  }
692  // ], line 122
693  bra = cursor;
694  // call R2, line 122
695  if (!r_R2())
696  {
697  goto lab2_brk;
698  }
699  // not, line 122
700  {
701  v_4 = limit - cursor;
702  do
703  {
704  // literal, line 122
705  if (!(eq_s_b(1, "c")))
706  {
707  goto lab3_brk;
708  }
709  goto lab2_brk;
710  }
711  while (false);
712 
713 lab3_brk: ;
714 
715  cursor = limit - v_4;
716  }
717  // delete, line 122
718  slice_del();
719  // [, line 123
720  ket = cursor;
721  // literal, line 123
722  if (!(eq_s_b(2, "en")))
723  {
724  goto lab2_brk;
725  }
726  // ], line 123
727  bra = cursor;
728  // call en_ending, line 123
729  if (!r_en_ending())
730  {
731  goto lab2_brk;
732  }
733  }
734  while (false);
735 
736 lab2_brk: ;
737 
738  cursor = limit - v_3;
739  // do, line 126
740  v_5 = limit - cursor;
741  do
742  {
743  // (, line 126
744  // [, line 127
745  ket = cursor;
746  // substring, line 127
747  among_var = find_among_b(a_4, 6);
748  if (among_var == 0)
749  {
750  goto lab4_brk;
751  }
752  // ], line 127
753  bra = cursor;
754  switch (among_var)
755  {
756 
757  case 0:
758  goto lab4_brk;
759 
760  case 1:
761  // (, line 129
762  // call R2, line 129
763  if (!r_R2())
764  {
765  goto lab4_brk;
766  }
767  // delete, line 129
768  slice_del();
769  // or, line 130
770  do
771  {
772  v_6 = limit - cursor;
773  do
774  {
775  // (, line 130
776  // [, line 130
777  ket = cursor;
778  // literal, line 130
779  if (!(eq_s_b(2, "ig")))
780  {
781  goto lab6_brk;
782  }
783  // ], line 130
784  bra = cursor;
785  // call R2, line 130
786  if (!r_R2())
787  {
788  goto lab6_brk;
789  }
790  // not, line 130
791  {
792  v_7 = limit - cursor;
793  do
794  {
795  // literal, line 130
796  if (!(eq_s_b(1, "e")))
797  {
798  goto lab7_brk;
799  }
800  goto lab6_brk;
801  }
802  while (false);
803 
804 lab7_brk: ;
805 
806  cursor = limit - v_7;
807  }
808  // delete, line 130
809  slice_del();
810  goto lab5_brk;
811  }
812  while (false);
813 
814 lab6_brk: ;
815 
816  cursor = limit - v_6;
817  // call undouble, line 130
818  if (!r_undouble())
819  {
820  goto lab4_brk;
821  }
822  }
823  while (false);
824 
825 lab5_brk: ;
826 
827  break;
828 
829  case 2:
830  // (, line 133
831  // call R2, line 133
832  if (!r_R2())
833  {
834  goto lab4_brk;
835  }
836  // not, line 133
837  {
838  v_8 = limit - cursor;
839  do
840  {
841  // literal, line 133
842  if (!(eq_s_b(1, "e")))
843  {
844  goto lab8_brk;
845  }
846  goto lab4_brk;
847  }
848  while (false);
849 
850 lab8_brk: ;
851 
852  cursor = limit - v_8;
853  }
854  // delete, line 133
855  slice_del();
856  break;
857 
858  case 3:
859  // (, line 136
860  // call R2, line 136
861  if (!r_R2())
862  {
863  goto lab4_brk;
864  }
865  // delete, line 136
866  slice_del();
867  // call e_ending, line 136
868  if (!r_e_ending())
869  {
870  goto lab4_brk;
871  }
872  break;
873 
874  case 4:
875  // (, line 139
876  // call R2, line 139
877  if (!r_R2())
878  {
879  goto lab4_brk;
880  }
881  // delete, line 139
882  slice_del();
883  break;
884 
885  case 5:
886  // (, line 142
887  // call R2, line 142
888  if (!r_R2())
889  {
890  goto lab4_brk;
891  }
892  // Boolean test e_found, line 142
893  if (!(B_e_found))
894  {
895  goto lab4_brk;
896  }
897  // delete, line 142
898  slice_del();
899  break;
900  }
901  }
902  while (false);
903 
904 lab4_brk: ;
905 
906  cursor = limit - v_5;
907  // do, line 146
908  v_9 = limit - cursor;
909  do
910  {
911  // (, line 146
912  if (!(out_grouping_b(g_v_I, 73, 232)))
913  {
914  goto lab9_brk;
915  }
916  // test, line 148
917  v_10 = limit - cursor;
918  // (, line 148
919  // among, line 149
920  if (find_among_b(a_5, 4) == 0)
921  {
922  goto lab9_brk;
923  }
924  if (!(out_grouping_b(g_v, 97, 232)))
925  {
926  goto lab9_brk;
927  }
928  cursor = limit - v_10;
929  // [, line 152
930  ket = cursor;
931  // next, line 152
932  if (cursor <= limit_backward)
933  {
934  goto lab9_brk;
935  }
936  cursor--;
937  // ], line 152
938  bra = cursor;
939  // delete, line 152
940  slice_del();
941  }
942  while (false);
943 
944 lab9_brk: ;
945 
946  cursor = limit - v_9;
947  return true;
948  }
949 
950  public override bool Stem()
951  {
952  int v_1;
953  int v_2;
954  int v_3;
955  int v_4;
956  // (, line 157
957  // do, line 159
958  v_1 = cursor;
959  do
960  {
961  // call prelude, line 159
962  if (!r_prelude())
963  {
964  goto lab0_brk;
965  }
966  }
967  while (false);
968 
969 lab0_brk: ;
970 
971  cursor = v_1;
972  // do, line 160
973  v_2 = cursor;
974  do
975  {
976  // call mark_regions, line 160
977  if (!r_mark_regions())
978  {
979  goto lab1_brk;
980  }
981  }
982  while (false);
983 
984 lab1_brk: ;
985 
986  cursor = v_2;
987  // backwards, line 161
988  limit_backward = cursor; cursor = limit;
989  // do, line 162
990  v_3 = limit - cursor;
991  do
992  {
993  // call standard_suffix, line 162
994  if (!r_standard_suffix())
995  {
996  goto lab2_brk;
997  }
998  }
999  while (false);
1000 
1001 lab2_brk: ;
1002 
1003  cursor = limit - v_3;
1004  cursor = limit_backward; // do, line 163
1005  v_4 = cursor;
1006  do
1007  {
1008  // call postlude, line 163
1009  if (!r_postlude())
1010  {
1011  goto lab3_brk;
1012  }
1013  }
1014  while (false);
1015 
1016 lab3_brk: ;
1017 
1018  cursor = v_4;
1019  return true;
1020  }
1021  }
1022 }