20 using Among = SF.Snowball.Among;
22 namespace SF.Snowball.Ext
24 #pragma warning disable 162,164
33 private void InitBlock()
35 a_0 =
new Among[]{
new Among(
"a", - 1, 1,
"",
this),
new Among(
"e", - 1, 1,
"",
this),
new Among(
"ede", 1, 1,
"",
this),
new Among(
"ande", 1, 1,
"",
this),
new Among(
"ende", 1, 1,
"",
this),
new Among(
"ane", 1, 1,
"",
this),
new Among(
"ene", 1, 1,
"",
this),
new Among(
"hetene", 6, 1,
"",
this),
new Among(
"erte", 1, 3,
"",
this),
new Among(
"en", - 1, 1,
"",
this),
new Among(
"heten", 9, 1,
"",
this),
new Among(
"ar", - 1, 1,
"",
this),
new Among(
"er", - 1, 1,
"",
this),
new Among(
"heter", 12, 1,
"",
this),
new Among(
"s", - 1, 2,
"",
this),
new Among(
"as", 14, 1,
"",
this),
new Among(
"es", 14, 1,
"",
this),
new Among(
"edes", 16, 1,
"",
this),
new Among(
"endes", 16, 1,
"",
this),
new Among(
"enes", 16, 1,
"",
this),
new Among(
"hetenes", 19, 1,
"",
this),
new Among(
"ens", 14, 1,
"",
this),
new Among(
"hetens", 21, 1,
"",
this),
new Among(
"ers", 14, 1,
"",
this),
new Among(
"ets", 14, 1,
"",
this),
new Among(
"et", - 1, 1,
"",
this),
new Among(
"het", 25, 1,
"",
this),
new Among(
"ert", - 1, 3,
"",
this),
new Among(
"ast", - 1, 1,
"",
this)};
36 a_1 =
new Among[]{
new Among(
"dt", - 1, - 1,
"",
this),
new Among(
"vt", - 1, - 1,
"",
this)};
37 a_2 =
new Among[]{
new Among(
"leg", - 1, 1,
"",
this),
new Among(
"eleg", 0, 1,
"",
this),
new Among(
"ig", - 1, 1,
"",
this),
new Among(
"eig", 2, 1,
"",
this),
new Among(
"lig", 2, 1,
"",
this),
new Among(
"elig", 4, 1,
"",
this),
new Among(
"els", - 1, 1,
"",
this),
new Among(
"lov", - 1, 1,
"",
this),
new Among(
"elov", 7, 1,
"",
this),
new Among(
"slov", 7, 1,
"",
this),
new Among(
"hetslov", 9, 1,
"",
this)};
43 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) (48), (char) (0), (char) (128)};
44 private static readonly
char[] g_s_ending =
new char[]{(char) (119), (char) (127), (char) (149), (char) (1)};
48 protected internal virtual void copy_from(NorwegianStemmer other)
51 base.copy_from(other);
54 private bool r_mark_regions()
65 if (!(in_grouping(g_v, 97, 248)))
91 if (!(out_grouping(g_v, 97, 248)))
129 private bool r_main_suffix()
136 v_1 = limit - cursor;
143 v_2 = limit_backward;
144 limit_backward = cursor;
145 cursor = limit - v_1;
150 among_var = find_among_b(a_0, 29);
153 limit_backward = v_2;
158 limit_backward = v_2;
173 if (!(in_grouping_b(g_s_ending, 98, 122)))
190 private bool r_consonant_pair()
197 v_1 = limit - cursor;
200 v_2 = limit - cursor;
207 v_3 = limit_backward;
208 limit_backward = cursor;
209 cursor = limit - v_2;
214 if (find_among_b(a_1, 2) == 0)
216 limit_backward = v_3;
221 limit_backward = v_3;
222 cursor = limit - v_1;
224 if (cursor <= limit_backward)
236 private bool r_other_suffix()
243 v_1 = limit - cursor;
250 v_2 = limit_backward;
251 limit_backward = cursor;
252 cursor = limit - v_1;
257 among_var = find_among_b(a_2, 11);
260 limit_backward = v_2;
265 limit_backward = v_2;
281 public override bool Stem()
293 if (!r_mark_regions())
304 limit_backward = cursor; cursor = limit;
307 v_2 = limit - cursor;
311 if (!r_main_suffix())
320 cursor = limit - v_2;
322 v_3 = limit - cursor;
326 if (!r_consonant_pair())
335 cursor = limit - v_3;
337 v_4 = limit - cursor;
341 if (!r_other_suffix())
350 cursor = limit - v_4;
351 cursor = limit_backward;
return true;