snowball
Version:
snowball word stemming algorithm implementation
2,045 lines (2,043 loc) • 158 kB
JavaScript
/*!
* Snowball JavaScript Library v0.3
* http://code.google.com/p/urim/
* http://snowball.tartarus.org/
*
* Copyright 2010, Oleg Mazko
* http://www.mozilla.org/MPL/
*/
module.exports = Snowball;
function Snowball(lng) {
function Among(s, substring_i, result, method) {
this.s_size = s.length;
this.s = this.toCharArray(s);
this.substring_i = substring_i;
this.result = result;
this.method = method;
}
Among.prototype.toCharArray = function(s) {
var sLength = s.length, charArr = new Array(sLength);
for (var i = 0; i < sLength; i++)
charArr[i] = s.charCodeAt(i);
return charArr;
}
function SnowballProgram() {
var current;
return {
b : 0,
k : 0,
l : 0,
c : 0,
lb : 0,
s_c : function(word) {
current = word;
this.c = 0;
this.l = word.length;
this.lb = 0;
this.b = this.c;
this.k = this.l;
},
g_c : function() {
var result = current;
current = null;
return result;
},
i_g : function(s, min, max) {
if (this.c < this.l) {
var ch = current.charCodeAt(this.c);
if (ch <= max && ch >= min) {
ch -= min;
if (s[ch >> 3] & (0X1 << (ch & 0X7))) {
this.c++;
return true;
}
}
}
return false;
},
i_g_b : function(s, min, max) {
if (this.c > this.lb) {
var ch = current.charCodeAt(this.c - 1);
if (ch <= max && ch >= min) {
ch -= min;
if (s[ch >> 3] & (0X1 << (ch & 0X7))) {
this.c--;
return true;
}
}
}
return false;
},
o_g : function(s, min, max) {
if (this.c < this.l) {
var ch = current.charCodeAt(this.c);
if (ch > max || ch < min) {
this.c++;
return true;
}
ch -= min;
if (!(s[ch >> 3] & (0X1 << (ch & 0X7)))) {
this.c++;
return true;
}
}
return false;
},
o_g_b : function(s, min, max) {
if (this.c > this.lb) {
var ch = current.charCodeAt(this.c - 1);
if (ch > max || ch < min) {
this.c--;
return true;
}
ch -= min;
if (!(s[ch >> 3] & (0X1 << (ch & 0X7)))) {
this.c--;
return true;
}
}
return false;
},
e_s : function(s_size, s) {
if (this.l - this.c < s_size)
return false;
for (var i = 0; i < s_size; i++)
if (current.charCodeAt(this.c + i) != s.charCodeAt(i))
return false;
this.c += s_size;
return true;
},
e_s_b : function(s_size, s) {
if (this.c - this.lb < s_size)
return false;
for (var i = 0; i < s_size; i++)
if (current.charCodeAt(this.c - s_size + i) != s
.charCodeAt(i))
return false;
this.c -= s_size;
return true;
},
f_a : function(v, v_size) {
var i = 0, j = v_size, c = this.c, l = this.l, common_i = 0, common_j = 0, first_key_inspected = false;
while (true) {
var k = i + ((j - i) >> 1), diff = 0, common = common_i < common_j
? common_i
: common_j, w = v[k];
for (var i2 = common; i2 < w.s_size; i2++) {
if (c + common == l) {
diff = -1;
break;
}
diff = current.charCodeAt(c + common) - w.s[i2];
if (diff)
break;
common++;
}
if (diff < 0) {
j = k;
common_j = common;
} else {
i = k;
common_i = common;
}
if (j - i <= 1) {
if (i > 0 || j == i || first_key_inspected)
break;
first_key_inspected = true;
}
}
while (true) {
var w = v[i];
if (common_i >= w.s_size) {
this.c = c + w.s_size;
if (!w.method)
return w.result;
var res = w.method();
this.c = c + w.s_size;
if (res)
return w.result;
}
i = w.substring_i;
if (i < 0)
return 0;
}
},
f_a_b : function(v, v_size) {
var i = 0, j = v_size, c = this.c, lb = this.lb, common_i = 0, common_j = 0, first_key_inspected = false;
while (true) {
var k = i + ((j - i) >> 1), diff = 0, common = common_i < common_j
? common_i
: common_j, w = v[k];
for (var i2 = w.s_size - 1 - common; i2 >= 0; i2--) {
if (c - common == lb) {
diff = -1;
break;
}
diff = current.charCodeAt(c - 1 - common) - w.s[i2];
if (diff)
break;
common++;
}
if (diff < 0) {
j = k;
common_j = common;
} else {
i = k;
common_i = common;
}
if (j - i <= 1) {
if (i > 0 || j == i || first_key_inspected)
break;
first_key_inspected = true;
}
}
while (true) {
var w = v[i];
if (common_i >= w.s_size) {
this.c = c - w.s_size;
if (!w.method)
return w.result;
var res = w.method();
this.c = c - w.s_size;
if (res)
return w.result;
}
i = w.substring_i;
if (i < 0)
return 0;
}
},
r_s : function(c_bra, c_ket, s) {
var adjustment = s.length - (c_ket - c_bra), left = current
.substring(0, c_bra), right = current.substring(c_ket);
current = left + s + right;
this.l += adjustment;
if (this.c >= c_ket)
this.c += adjustment;
else if (this.c > c_bra)
this.c = c_bra;
return adjustment;
},
s_ch : function() {
if (this.b < 0 || this.b > this.k || this.k > this.l
|| this.l > current.length)
throw ("faulty slice operation");
},
s_f : function(s) {
this.s_ch();
this.r_s(this.b, this.k, s);
},
s_d : function() {
this.s_f("");
},
i_ : function(c_bra, c_ket, s) {
var adjustment = this.r_s(c_bra, c_ket, s);
if (c_bra <= this.b)
this.b += adjustment;
if (c_bra <= this.k)
this.k += adjustment;
},
s_t : function() {
this.s_ch();
return current.substring(this.b, this.k);
},
e_v_b : function(s) {
return this.e_s_b(s.length, s);
}
};
}
var stemFactory = {
DanishStemmer : function() {
var a_0 = [new Among("hed", -1, 1), new Among("ethed", 0, 1),
new Among("ered", -1, 1), new Among("e", -1, 1),
new Among("erede", 3, 1), new Among("ende", 3, 1),
new Among("erende", 5, 1), new Among("ene", 3, 1),
new Among("erne", 3, 1), new Among("ere", 3, 1),
new Among("en", -1, 1), new Among("heden", 10, 1),
new Among("eren", 10, 1), new Among("er", -1, 1),
new Among("heder", 13, 1), new Among("erer", 13, 1),
new Among("s", -1, 2), new Among("heds", 16, 1),
new Among("es", 16, 1), new Among("endes", 18, 1),
new Among("erendes", 19, 1), new Among("enes", 18, 1),
new Among("ernes", 18, 1), new Among("eres", 18, 1),
new Among("ens", 16, 1), new Among("hedens", 24, 1),
new Among("erens", 24, 1), new Among("ers", 16, 1),
new Among("ets", 16, 1), new Among("erets", 28, 1),
new Among("et", -1, 1), new Among("eret", 30, 1)], a_1 = [
new Among("gd", -1, -1), new Among("dt", -1, -1),
new Among("gt", -1, -1), new Among("kt", -1, -1)], a_2 = [
new Among("ig", -1, 1), new Among("lig", 0, 1),
new Among("elig", 1, 1), new Among("els", -1, 1),
new Among("l\u00F8st", -1, 2)], g_v = [17, 65, 16, 1, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 0, 128], g_s_ending = [
239, 254, 42, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16], I_x, I_p1, S_ch, sbp = new SnowballProgram();
this.setCurrent = function(word) {
sbp.s_c(word);
};
this.getCurrent = function() {
return sbp.g_c();
};
function r_mark_regions() {
var v_1, c = sbp.c + 3;
I_p1 = sbp.l;
if (0 <= c && c <= sbp.l) {
I_x = c;
while (true) {
v_1 = sbp.c;
if (sbp.i_g(g_v, 97, 248)) {
sbp.c = v_1;
break;
}
sbp.c = v_1;
if (v_1 >= sbp.l)
return;
sbp.c++;
}
while (!sbp.o_g(g_v, 97, 248)) {
if (sbp.c >= sbp.l)
return;
sbp.c++;
}
I_p1 = sbp.c;
if (I_p1 < I_x)
I_p1 = I_x;
}
}
function r_main_suffix() {
var a_v, v_1;
if (sbp.c >= I_p1) {
v_1 = sbp.lb;
sbp.lb = I_p1;
sbp.k = sbp.c;
a_v = sbp.f_a_b(a_0, 32);
sbp.lb = v_1;
if (a_v) {
sbp.b = sbp.c;
switch (a_v) {
case 1 :
sbp.s_d();
break;
case 2 :
if (sbp.i_g_b(g_s_ending, 97, 229))
sbp.s_d();
break;
}
}
}
}
function r_consonant_pair() {
var v_1 = sbp.l - sbp.c, v_2;
if (sbp.c >= I_p1) {
v_2 = sbp.lb;
sbp.lb = I_p1;
sbp.k = sbp.c;
if (sbp.f_a_b(a_1, 4)) {
sbp.b = sbp.c;
sbp.lb = v_2;
sbp.c = sbp.l - v_1;
if (sbp.c > sbp.lb) {
sbp.c--;
sbp.b = sbp.c;
sbp.s_d();
}
} else
sbp.lb = v_2;
}
}
function r_other_suffix() {
var a_v, v_1 = sbp.l - sbp.c, v_2, v_3;
sbp.k = sbp.c;
if (sbp.e_s_b(2, "st")) {
sbp.b = sbp.c;
if (sbp.e_s_b(2, "ig"))
sbp.s_d();
}
sbp.c = sbp.l - v_1;
if (sbp.c >= I_p1) {
v_2 = sbp.lb;
sbp.lb = I_p1;
sbp.k = sbp.c;
a_v = sbp.f_a_b(a_2, 5);
sbp.lb = v_2;
if (a_v) {
sbp.b = sbp.c;
switch (a_v) {
case 1 :
sbp.s_d();
v_3 = sbp.l - sbp.c;
r_consonant_pair();
sbp.c = sbp.l - v_3;
break;
case 2 :
sbp.s_f("l\u00F8s");
break;
}
}
}
}
function r_undouble() {
var v_1;
if (sbp.c >= I_p1) {
v_1 = sbp.lb;
sbp.lb = I_p1;
sbp.k = sbp.c;
if (sbp.o_g_b(g_v, 97, 248)) {
sbp.b = sbp.c;
S_ch = sbp.s_t(S_ch);
sbp.lb = v_1;
if (sbp.e_v_b(S_ch))
sbp.s_d();
} else
sbp.lb = v_1;
}
}
this.stem = function() {
var v_1 = sbp.c;
r_mark_regions();
sbp.lb = v_1;
sbp.c = sbp.l;
r_main_suffix();
sbp.c = sbp.l;
r_consonant_pair();
sbp.c = sbp.l;
r_other_suffix();
sbp.c = sbp.l;
r_undouble();
return true;
}
},
DutchStemmer : function() {
var a_0 = [new Among("", -1, 6), new Among("\u00E1", 0, 1),
new Among("\u00E4", 0, 1), new Among("\u00E9", 0, 2),
new Among("\u00EB", 0, 2), new Among("\u00ED", 0, 3),
new Among("\u00EF", 0, 3), new Among("\u00F3", 0, 4),
new Among("\u00F6", 0, 4), new Among("\u00FA", 0, 5),
new Among("\u00FC", 0, 5)], a_1 = [new Among("", -1, 3),
new Among("I", 0, 2), new Among("Y", 0, 1)], a_2 = [
new Among("dd", -1, -1), new Among("kk", -1, -1),
new Among("tt", -1, -1)], a_3 = [new Among("ene", -1, 2),
new Among("se", -1, 3), new Among("en", -1, 2),
new Among("heden", 2, 1), new Among("s", -1, 3)], a_4 = [
new Among("end", -1, 1), new Among("ig", -1, 2),
new Among("ing", -1, 1), new Among("lijk", -1, 3),
new Among("baar", -1, 4), new Among("bar", -1, 5)], a_5 = [
new Among("aa", -1, -1), new Among("ee", -1, -1),
new Among("oo", -1, -1), new Among("uu", -1, -1)], g_v = [
17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128], g_v_I = [
1, 0, 0, 17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
128], g_v_j = [17, 67, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 128], I_p2, I_p1, B_e_found, sbp = new SnowballProgram();
this.setCurrent = function(word) {
sbp.s_c(word);
};
this.getCurrent = function() {
return sbp.g_c();
};
function r_prelude() {
var a_v, v_1 = sbp.c, v_2, v_3;
while (true) {
sbp.b = sbp.c;
a_v = sbp.f_a(a_0, 11);
if (a_v) {
sbp.k = sbp.c;
switch (a_v) {
case 1 :
sbp.s_f("a");
continue;
case 2 :
sbp.s_f("e");
continue;
case 3 :
sbp.s_f("i");
continue;
case 4 :
sbp.s_f("o");
continue;
case 5 :
sbp.s_f("u");
continue;
case 6 :
if (sbp.c >= sbp.l)
break;
sbp.c++;
continue;
}
}
break;
}
sbp.c = v_1;
sbp.b = v_1;
if (sbp.e_s(1, "y")) {
sbp.k = sbp.c;
sbp.s_f("Y");
} else
sbp.c = v_1;
while (true) {
v_2 = sbp.c;
if (sbp.i_g(g_v, 97, 232)) {
v_3 = sbp.c;
sbp.b = v_3;
if (sbp.e_s(1, "i")) {
sbp.k = sbp.c;
if (sbp.i_g(g_v, 97, 232)) {
sbp.s_f("I");
sbp.c = v_2;
}
} else {
sbp.c = v_3;
if (sbp.e_s(1, "y")) {
sbp.k = sbp.c;
sbp.s_f("Y");
sbp.c = v_2;
} else if (habr1(v_2))
break;
}
} else if (habr1(v_2))
break;
}
}
function habr1(v_1) {
sbp.c = v_1;
if (v_1 >= sbp.l)
return true;
sbp.c++;
return false;
}
function r_mark_regions() {
I_p1 = sbp.l;
I_p2 = I_p1;
if (!habr2()) {
I_p1 = sbp.c;
if (I_p1 < 3)
I_p1 = 3;
if (!habr2())
I_p2 = sbp.c;
}
}
function habr2() {
while (!sbp.i_g(g_v, 97, 232)) {
if (sbp.c >= sbp.l)
return true;
sbp.c++;
}
while (!sbp.o_g(g_v, 97, 232)) {
if (sbp.c >= sbp.l)
return true;
sbp.c++;
}
return false;
}
function r_postlude() {
var a_v;
while (true) {
sbp.b = sbp.c;
a_v = sbp.f_a(a_1, 3);
if (a_v) {
sbp.k = sbp.c;
switch (a_v) {
case 1 :
sbp.s_f("y");
break;
case 2 :
sbp.s_f("i");
break;
case 3 :
if (sbp.c >= sbp.l)
return;
sbp.c++;
break;
}
}
}
}
function r_R1() {
return I_p1 <= sbp.c;
}
function r_R2() {
return I_p2 <= sbp.c;
}
function r_undouble() {
var v_1 = sbp.l - sbp.c;
if (sbp.f_a_b(a_2, 3)) {
sbp.c = sbp.l - v_1;
sbp.k = sbp.c;
if (sbp.c > sbp.lb) {
sbp.c--;
sbp.b = sbp.c;
sbp.s_d();
}
}
}
function r_e_ending() {
var v_1;
B_e_found = false;
sbp.k = sbp.c;
if (sbp.e_s_b(1, "e")) {
sbp.b = sbp.c;
if (r_R1()) {
v_1 = sbp.l - sbp.c;
if (sbp.o_g_b(g_v, 97, 232)) {
sbp.c = sbp.l - v_1;
sbp.s_d();
B_e_found = true;
r_undouble();
}
}
}
}
function r_en_ending() {
var v_1;
if (r_R1()) {
v_1 = sbp.l - sbp.c;
if (sbp.o_g_b(g_v, 97, 232)) {
sbp.c = sbp.l - v_1;
if (!sbp.e_s_b(3, "gem")) {
sbp.c = sbp.l - v_1;
sbp.s_d();
r_undouble();
}
}
}
}
function r_standard_suffix() {
var a_v, v_1 = sbp.l - sbp.c, v_2, v_3, v_4, v_5, v_6;
sbp.k = sbp.c;
a_v = sbp.f_a_b(a_3, 5);
if (a_v) {
sbp.b = sbp.c;
switch (a_v) {
case 1 :
if (r_R1())
sbp.s_f("heid");
break;
case 2 :
r_en_ending();
break;
case 3 :
if (r_R1() && sbp.o_g_b(g_v_j, 97, 232))
sbp.s_d();
break;
}
}
sbp.c = sbp.l - v_1;
r_e_ending();
sbp.c = sbp.l - v_1;
sbp.k = sbp.c;
if (sbp.e_s_b(4, "heid")) {
sbp.b = sbp.c;
if (r_R2()) {
v_2 = sbp.l - sbp.c;
if (!sbp.e_s_b(1, "c")) {
sbp.c = sbp.l - v_2;
sbp.s_d();
sbp.k = sbp.c;
if (sbp.e_s_b(2, "en")) {
sbp.b = sbp.c;
r_en_ending();
}
}
}
}
sbp.c = sbp.l - v_1;
sbp.k = sbp.c;
a_v = sbp.f_a_b(a_4, 6);
if (a_v) {
sbp.b = sbp.c;
switch (a_v) {
case 1 :
if (r_R2()) {
sbp.s_d();
v_3 = sbp.l - sbp.c;
sbp.k = sbp.c;
if (sbp.e_s_b(2, "ig")) {
sbp.b = sbp.c;
if (r_R2()) {
v_4 = sbp.l - sbp.c;
if (!sbp.e_s_b(1, "e")) {
sbp.c = sbp.l - v_4;
sbp.s_d();
break;
}
}
}
sbp.c = sbp.l - v_3;
r_undouble();
}
break;
case 2 :
if (r_R2()) {
v_5 = sbp.l - sbp.c;
if (!sbp.e_s_b(1, "e")) {
sbp.c = sbp.l - v_5;
sbp.s_d();
}
}
break;
case 3 :
if (r_R2()) {
sbp.s_d();
r_e_ending();
}
break;
case 4 :
if (r_R2())
sbp.s_d();
break;
case 5 :
if (r_R2() && B_e_found)
sbp.s_d();
break;
}
}
sbp.c = sbp.l - v_1;
if (sbp.o_g_b(g_v_I, 73, 232)) {
v_6 = sbp.l - sbp.c;
if (sbp.f_a_b(a_5, 4)
&& sbp.o_g_b(g_v, 97, 232)) {
sbp.c = sbp.l - v_6;
sbp.k = sbp.c;
if (sbp.c > sbp.lb) {
sbp.c--;
sbp.b = sbp.c;
sbp.s_d();
}
}
}
}
this.stem = function() {
var v_1 = sbp.c;
r_prelude();
sbp.c = v_1;
r_mark_regions();
sbp.lb = v_1;
sbp.c = sbp.l;
r_standard_suffix();
sbp.c = sbp.lb;
r_postlude();
return true;
}
},
EnglishStemmer : function() {
var a_0 = [new Among("arsen", -1, -1), new Among("commun", -1, -1),
new Among("gener", -1, -1)], a_1 = [new Among("'", -1, 1),
new Among("'s'", 0, 1), new Among("'s", -1, 1)], a_2 = [
new Among("ied", -1, 2), new Among("s", -1, 3),
new Among("ies", 1, 2), new Among("sses", 1, 1),
new Among("ss", 1, -1), new Among("us", 1, -1)], a_3 = [
new Among("", -1, 3), new Among("bb", 0, 2),
new Among("dd", 0, 2), new Among("ff", 0, 2),
new Among("gg", 0, 2), new Among("bl", 0, 1),
new Among("mm", 0, 2), new Among("nn", 0, 2),
new Among("pp", 0, 2), new Among("rr", 0, 2),
new Among("at", 0, 1), new Among("tt", 0, 2),
new Among("iz", 0, 1)], a_4 = [new Among("ed", -1, 2),
new Among("eed", 0, 1), new Among("ing", -1, 2),
new Among("edly", -1, 2), new Among("eedly", 3, 1),
new Among("ingly", -1, 2)], a_5 = [
new Among("anci", -1, 3), new Among("enci", -1, 2),
new Among("ogi", -1, 13), new Among("li", -1, 16),
new Among("bli", 3, 12), new Among("abli", 4, 4),
new Among("alli", 3, 8), new Among("fulli", 3, 14),
new Among("lessli", 3, 15), new Among("ousli", 3, 10),
new Among("entli", 3, 5), new Among("aliti", -1, 8),
new Among("biliti", -1, 12), new Among("iviti", -1, 11),
new Among("tional", -1, 1), new Among("ational", 14, 7),
new Among("alism", -1, 8), new Among("ation", -1, 7),
new Among("ization", 17, 6), new Among("izer", -1, 6),
new Among("ator", -1, 7), new Among("iveness", -1, 11),
new Among("fulness", -1, 9), new Among("ousness", -1, 10)], a_6 = [
new Among("icate", -1, 4), new Among("ative", -1, 6),
new Among("alize", -1, 3), new Among("iciti", -1, 4),
new Among("ical", -1, 4), new Among("tional", -1, 1),
new Among("ational", 5, 2), new Among("ful", -1, 5),
new Among("ness", -1, 5)], a_7 = [new Among("ic", -1, 1),
new Among("ance", -1, 1), new Among("ence", -1, 1),
new Among("able", -1, 1), new Among("ible", -1, 1),
new Among("ate", -1, 1), new Among("ive", -1, 1),
new Among("ize", -1, 1), new Among("iti", -1, 1),
new Among("al", -1, 1), new Among("ism", -1, 1),
new Among("ion", -1, 2), new Among("er", -1, 1),
new Among("ous", -1, 1), new Among("ant", -1, 1),
new Among("ent", -1, 1), new Among("ment", 15, 1),
new Among("ement", 16, 1)], a_8 = [new Among("e", -1, 1),
new Among("l", -1, 2)], a_9 = [
new Among("succeed", -1, -1), new Among("proceed", -1, -1),
new Among("exceed", -1, -1), new Among("canning", -1, -1),
new Among("inning", -1, -1), new Among("earring", -1, -1),
new Among("herring", -1, -1), new Among("outing", -1, -1)], a_10 = [
new Among("andes", -1, -1), new Among("atlas", -1, -1),
new Among("bias", -1, -1), new Among("cosmos", -1, -1),
new Among("dying", -1, 3), new Among("early", -1, 9),
new Among("gently", -1, 7), new Among("howe", -1, -1),
new Among("idly", -1, 6), new Among("lying", -1, 4),
new Among("news", -1, -1), new Among("only", -1, 10),
new Among("singly", -1, 11), new Among("skies", -1, 2),
new Among("skis", -1, 1), new Among("sky", -1, -1),
new Among("tying", -1, 5), new Among("ugly", -1, 8)], g_v = [
17, 65, 16, 1], g_v_WXY = [1, 17, 65, 208, 1], g_valid_LI = [
55, 141, 2], B_Y_found, I_p2, I_p1, habr = [r_Step_1b,
r_Step_1c, r_Step_2, r_Step_3, r_Step_4, r_Step_5], sbp = new SnowballProgram();
this.setCurrent = function(word) {
sbp.s_c(word);
};
this.getCurrent = function() {
return sbp.g_c();
};
function r_prelude() {
var v_1 = sbp.c, v_2;
B_Y_found = false;
sbp.b = sbp.c;
if (sbp.e_s(1, "'")) {
sbp.k = sbp.c;
sbp.s_d();
}
sbp.c = v_1;
sbp.b = v_1;
if (sbp.e_s(1, "y")) {
sbp.k = sbp.c;
sbp.s_f("Y");
B_Y_found = true;
}
sbp.c = v_1;
while (true) {
v_2 = sbp.c;
if (sbp.i_g(g_v, 97, 121)) {
sbp.b = sbp.c;
if (sbp.e_s(1, "y")) {
sbp.k = sbp.c;
sbp.c = v_2;
sbp.s_f("Y");
B_Y_found = true;
continue;
}
}
if (v_2 >= sbp.l) {
sbp.c = v_1;
return;
}
sbp.c = v_2 + 1;
}
}
function r_mark_regions() {
var v_1 = sbp.c;
I_p1 = sbp.l;
I_p2 = I_p1;
if (!sbp.f_a(a_0, 3)) {
sbp.c = v_1;
if (habr1()) {
sbp.c = v_1;
return;
}
}
I_p1 = sbp.c;
if (!habr1())
I_p2 = sbp.c;
}
function habr1() {
while (!sbp.i_g(g_v, 97, 121)) {
if (sbp.c >= sbp.l)
return true;
sbp.c++;
}
while (!sbp.o_g(g_v, 97, 121)) {
if (sbp.c >= sbp.l)
return true;
sbp.c++;
}
return false;
}
function r_shortv() {
var v_1 = sbp.l - sbp.c;
if (!(sbp.o_g_b(g_v_WXY, 89, 121)
&& sbp.i_g_b(g_v, 97, 121) && sbp.o_g_b(g_v, 97, 121))) {
sbp.c = sbp.l - v_1;
if (!sbp.o_g_b(g_v, 97, 121)
|| !sbp.i_g_b(g_v, 97, 121)
|| sbp.c > sbp.lb)
return false;
}
return true;
}
function r_R1() {
return I_p1 <= sbp.c;
}
function r_R2() {
return I_p2 <= sbp.c;
}
function r_Step_1a() {
var a_v, v_1 = sbp.l - sbp.c;
sbp.k = sbp.c;
a_v = sbp.f_a_b(a_1, 3);
if (a_v) {
sbp.b = sbp.c;
if (a_v == 1)
sbp.s_d();
} else
sbp.c = sbp.l - v_1;
sbp.k = sbp.c;
a_v = sbp.f_a_b(a_2, 6);
if (a_v) {
sbp.b = sbp.c;
switch (a_v) {
case 1 :
sbp.s_f("ss");
break;
case 2 :
var c = sbp.c - 2;
if (sbp.lb > c || c > sbp.l) {
sbp.s_f("ie");
break;
}
sbp.c = c;
sbp.s_f("i");
break;
case 3 :
do {
if (sbp.c <= sbp.lb)
return;
sbp.c--;
} while (!sbp.i_g_b(g_v, 97, 121));
sbp.s_d();
break;
}
}
}
function r_Step_1b() {
var a_v, v_1, v_3, v_4;
sbp.k = sbp.c;
a_v = sbp.f_a_b(a_4, 6);
if (a_v) {
sbp.b = sbp.c;
switch (a_v) {
case 1 :
if (r_R1())
sbp.s_f("ee");
break;
case 2 :
v_1 = sbp.l - sbp.c;
while (!sbp.i_g_b(g_v, 97, 121)) {
if (sbp.c <= sbp.lb)
return;
sbp.c--;
}
sbp.c = sbp.l - v_1;
sbp.s_d();
v_3 = sbp.l - sbp.c;
a_v = sbp.f_a_b(a_3, 13);
if (a_v) {
sbp.c = sbp.l - v_3;
switch (a_v) {
case 1 :
var c = sbp.c;
sbp.i_(sbp.c, sbp.c, "e");
sbp.c = c;
break;
case 2 :
sbp.k = sbp.c;
if (sbp.c > sbp.lb) {
sbp.c--;
sbp.b = sbp.c;
sbp.s_d();
}
break;
case 3 :
if (sbp.c == I_p1) {
v_4 = sbp.l - sbp.c;
if (r_shortv()) {
sbp.c = sbp.l - v_4;
var c = sbp.c;
sbp.i_(sbp.c, sbp.c, "e");
sbp.c = c;
}
}
break;
}
}
break;
}
}
}
function r_Step_1c() {
var v_1 = sbp.l - sbp.c;
sbp.k = sbp.c;
if (!sbp.e_s_b(1, "y")) {
sbp.c = sbp.l - v_1;
if (!sbp.e_s_b(1, "Y"))
return;
}
sbp.b = sbp.c;
if (sbp.o_g_b(g_v, 97, 121) && sbp.c > sbp.lb)
sbp.s_f("i");
}
function r_Step_2() {
var a_v;
sbp.k = sbp.c;
a_v = sbp.f_a_b(a_5, 24);
if (a_v) {
sbp.b = sbp.c;
if (r_R1()) {
switch (a_v) {
case 1 :
sbp.s_f("tion");
break;
case 2 :
sbp.s_f("ence");
break;
case 3 :
sbp.s_f("ance");
break;
case 4 :
sbp.s_f("able");
break;
case 5 :
sbp.s_f("ent");
break;
case 6 :
sbp.s_f("ize");
break;
case 7 :
sbp.s_f("ate");
break;
case 8 :
sbp.s_f("al");
break;
case 9 :
sbp.s_f("ful");
break;
case 10 :
sbp.s_f("ous");
break;
case 11 :
sbp.s_f("ive");
break;
case 12 :
sbp.s_f("ble");
break;
case 13 :
if (sbp.e_s_b(1, "l"))
sbp.s_f("og");
break;
case 14 :
sbp.s_f("ful");
break;
case 15 :
sbp.s_f("less");
break;
case 16 :
if (sbp.i_g_b(g_valid_LI, 99, 116))
sbp.s_d();
break;
}
}
}
}
function r_Step_3() {
var a_v;
sbp.k = sbp.c;
a_v = sbp.f_a_b(a_6, 9);
if (a_v) {
sbp.b = sbp.c;
if (r_R1()) {
switch (a_v) {
case 1 :
sbp.s_f("tion");
break;
case 2 :
sbp.s_f("ate");
break;
case 3 :
sbp.s_f("al");
break;
case 4 :
sbp.s_f("ic");
break;
case 5 :
sbp.s_d();
break;
case 6 :
if (r_R2())
sbp.s_d();
break;
}
}
}
}
function r_Step_4() {
var a_v, v_1;
sbp.k = sbp.c;
a_v = sbp.f_a_b(a_7, 18);
if (a_v) {
sbp.b = sbp.c;
if (r_R2()) {
switch (a_v) {
case 1 :
sbp.s_d();
break;
case 2 :
v_1 = sbp.l - sbp.c;
if (!sbp.e_s_b(1, "s")) {
sbp.c = sbp.l - v_1;
if (!sbp.e_s_b(1, "t"))
return;
}
sbp.s_d();
break;
}
}
}
}
function r_Step_5() {
var a_v, v_1;
sbp.k = sbp.c;
a_v = sbp.f_a_b(a_8, 2);
if (a_v) {
sbp.b = sbp.c;
switch (a_v) {
case 1 :
v_1 = sbp.l - sbp.c;
if (!r_R2()) {
sbp.c = sbp.l - v_1;
if (!r_R1() || r_shortv())
return;
sbp.c = sbp.l - v_1;
}
sbp.s_d();
break;
case 2 :
if (!r_R2() || !sbp.e_s_b(1, "l"))
return;
sbp.s_d();
break;
}
}
}
function r_exception2() {
sbp.k = sbp.c;
if (sbp.f_a_b(a_9, 8)) {
sbp.b = sbp.c;
return sbp.c <= sbp.lb;
}
return false;
}
function r_exception1() {
var a_v;
sbp.b = sbp.c;
a_v = sbp.f_a(a_10, 18);
if (a_v) {
sbp.k = sbp.c;
if (sbp.c >= sbp.l) {
switch (a_v) {
case 1 :
sbp.s_f("ski");
break;
case 2 :
sbp.s_f("sky");
break;
case 3 :
sbp.s_f("die");
break;
case 4 :
sbp.s_f("lie");
break;
case 5 :
sbp.s_f("tie");
break;
case 6 :
sbp.s_f("idl");
break;
case 7 :
sbp.s_f("gentl");
break;
case 8 :
sbp.s_f("ugli");
break;
case 9 :
sbp.s_f("earli");
break;
case 10 :
sbp.s_f("onli");
break;
case 11 :
sbp.s_f("singl");
break;
}
return true;
}
}
return false;
}
function r_postlude() {
var v_1;
if (B_Y_found) {
while (true) {
v_1 = sbp.c;
sbp.b = v_1;
if (sbp.e_s(1, "Y")) {
sbp.k = sbp.c;
sbp.c = v_1;
sbp.s_f("y");
continue;
}
sbp.c = v_1;
if (sbp.c >= sbp.l)
return;
sbp.c++;
}
}
}
this.stem = function() {
var v_1 = sbp.c;
if (!r_exception1()) {
sbp.c = v_1;
var c = sbp.c + 3;
if (0 <= c && c <= sbp.l) {
sbp.c = v_1;
r_prelude();
sbp.c = v_1;
r_mark_regions();
sbp.lb = v_1;
sbp.c = sbp.l;
r_Step_1a();
sbp.c = sbp.l;
if (!r_exception2())
for (var i = 0; i < habr.length; i++) {
sbp.c = sbp.l;
habr[i]();
}
sbp.c = sbp.lb;
r_postlude();
}
}
return true;
}
},
FinnishStemmer : function() {
var a_0 = [new Among("pa", -1, 1), new Among("sti", -1, 2),
new Among("kaan", -1, 1), new Among("han", -1, 1),
new Among("kin", -1, 1), new Among("h\u00E4n", -1, 1),
new Among("k\u00E4\u00E4n", -1, 1), new Among("ko", -1, 1),
new Among("p\u00E4", -1, 1), new Among("k\u00F6", -1, 1)], a_1 = [
new Among("lla", -1, -1), new Among("na", -1, -1),
new Among("ssa", -1, -1), new Among("ta", -1, -1),
new Among("lta", 3, -1), new Among("sta", 3, -1)], a_2 = [
new Among("ll\u00E4", -1, -1),
new Among("n\u00E4", -1, -1),
new Among("ss\u00E4", -1, -1),
new Among("t\u00E4", -1, -1), new Among("lt\u00E4", 3, -1),
new Among("st\u00E4", 3, -1)], a_3 = [
new Among("lle", -1, -1), new Among("ine", -1, -1)], a_4 = [
new Among("nsa", -1, 3), new Among("mme", -1, 3),
new Among("nne", -1, 3), new Among("ni", -1, 2),
new Among("si", -1, 1), new Among("an", -1, 4),
new Among("en", -1, 6), new Among("\u00E4n", -1, 5),
new Among("ns\u00E4", -1, 3)], a_5 = [
new Among("aa", -1, -1), new Among("ee", -1, -1),
new Among("ii", -1, -1), new Among("oo", -1, -1),
new Among("uu", -1, -1), new Among("\u00E4\u00E4", -1, -1),
new Among("\u00F6\u00F6", -1, -1)], a_6 = [
new Among("a", -1, 8), new Among("lla", 0, -1),
new Among("na", 0, -1), new Among("ssa", 0, -1),
new Among("ta", 0, -1), new Among("lta", 4, -1),
new Among("sta", 4, -1), new Among("tta", 4, 9),
new Among("lle", -1, -1), new Among("ine", -1, -1),
new Among("ksi", -1, -1), new Among("n", -1, 7),
new Among("han", 11, 1), new Among("den", 11, -1, r_VI),
new Among("seen", 11, -1, r_LONG), new Among("hen", 11, 2),
new Among("tten", 11, -1, r_VI), new Among("hin", 11, 3),
new Among("siin", 11, -1, r_VI), new Among("hon", 11, 4),
new Among("h\u00E4n", 11, 5), new Among("h\u00F6n", 11, 6),
new Among("\u00E4", -1, 8), new Among("ll\u00E4", 22, -1),
new Among("n\u00E4", 22, -1),
new Among("ss\u00E4", 22, -1),
new Among("t\u00E4", 22, -1),
new Among("lt\u00E4", 26, -1),
new Among("st\u00E4", 26, -1), new Among("tt\u00E4", 26, 9)], a_7 = [
new Among("eja", -1, -1), new Among("mma", -1, 1),
new Among("imma", 1, -1), new Among("mpa", -1, 1),
new Among("impa", 3, -1), new Among("mmi", -1, 1),
new Among("immi", 5, -1), new Among("mpi", -1, 1),
new Among("impi", 7, -1), new Among("ej\u00E4", -1, -1),
new Among("mm\u00E4", -1, 1),
new Among("imm\u00E4", 10, -1),
new Among("mp\u00E4", -1, 1),
new Among("imp\u00E4", 12, -1)], a_8 = [
new Among("i", -1, -1), new Among("j", -1, -1)], a_9 = [
new Among("mma", -1, 1), new Among("imma", 0, -1)], g_AEI = [
17, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8], g_V1 = [
17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 32], g_V2 = [
17, 65, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 32], g_particle_end = [
17, 97, 24, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 32], B_ending_removed, S_x, I_p2, I_p1, sbp = new SnowballProgram();
this.setCurrent = function(word) {
sbp.s_c(word);
};
this.getCurrent = function() {
return sbp.g_c();
};
function r_mark_regions() {
I_p1 = sbp.l;
I_p2 = I_p1;
if (!habr1()) {
I_p1 = sbp.c;
if (!habr1())
I_p2 = sbp.c;
}
}
function habr1() {
var v_1;
while (true) {
v_1 = sbp.c;
if (sbp.i_g(g_V1, 97, 246))
break;
sbp.c = v_1;
if (v_1 >= sbp.l)
return true;
sbp.c++;
}
sbp.c = v_1;
while (!sbp.o_g(g_V1, 97, 246)) {
if (sbp.c >= sbp.l)
return true;
sbp.c++;
}
return false;
}
function r_R2() {
return I_p2 <= sbp.c;
}
function r_particle_etc() {
var a_v, v_1;
if (sbp.c >= I_p1) {
v_1 = sbp.lb;
sbp.lb = I_p1;
sbp.k = sbp.c;
a_v = sbp.f_a_b(a_0, 10);
if (a_v) {
sbp.b = sbp.c;
sbp.lb = v_1;
switch (a_v) {
case 1 :
if (!sbp.i_g_b(g_particle_end, 97, 246))
return;
break;
case 2 :
if (!r_R2())
return;
break;
}
sbp.s_d();
} else
sbp.lb = v_1;
}
}
function r_possessive() {
var a_v, v_1, v_2;
if (sbp.c >= I_p1) {
v_1 = sbp.lb;
sbp.lb = I_p1;
sbp.k = sbp.c;
a_v = sbp.f_a_b(a_4, 9);
if (a_v) {
sbp.b = sbp.c;
sbp.lb = v_1;
switch (a_v) {
case 1 :
v_2 = sbp.l - sbp.c;
if (!sbp.e_s_b(1, "k")) {
sbp.c = sbp.l - v_2;
sbp.s_d();
}
break;
case 2 :
sbp.s_d();
sbp.k = sbp.c;
if (sbp.e_s_b(3, "kse")) {
sbp.b = sbp.c;
sbp.s_f("ksi");
}
break;
case 3 :
sbp.s_d();
break;
case 4 :
if (sbp.f_a_b(a_1, 6))
sbp.s_d();
break;
case 5 :
if (sbp.f_a_b(a_2, 6))
sbp.s_d();
break;
case 6 :
if (sbp.f_a_b(a_3, 2))
sbp.s_d();
break;
}
} else
sbp.lb = v_1;
}
}
function r_LONG() {
return sbp.f_a_b(a_5, 7);
}
function r_VI() {
return sbp.e_s_b(1, "i") && sbp.i_g_b(g_V2, 97, 246);
}
function r_case_ending() {
var a_v, v_1, v_2;
if (sbp.c >= I_p1) {
v_1 = sbp.lb;
sbp.lb = I_p1;
sbp.k = sbp.c;
a_v = sbp.f_a_b(a_6, 30);
if (a_v) {
sbp.b = sbp.c;
sbp.lb = v_1;
switch (a_v) {
case 1 :
if (!sbp.e_s_b(1, "a"))
return;
break;
case 2 :
case 9 :
if (!sbp.e_s_b(1, "e"))
return;
break;
case 3 :
if (!sbp.e_s_b(1, "i"))
return;
break;
case 4 :
if (!sbp.e_s_b(1, "o"))
return;
break;
case 5 :
if (!sbp.e_s_b(1, "\u00E4"))
return;
break;
case 6 :
if (!sbp.e_s_b(1, "\u00F6"))
return;
break;
case 7 :
v_2 = sbp.l - sbp.c;
if (!r_LONG()) {
sbp.c = sbp.l - v_2;
if (!sbp.e_s_b(2, "ie")) {
sbp.c = sbp.l - v_2;
break;
}
}
sbp.c = sbp.l - v_2;
if (sbp.c <= sbp.lb) {
sbp.c = sbp.l - v_2;
break;
}
sbp.c--;
sbp.b = sbp.c;
break;
case 8 :
if (!sbp.i_g_b(g_V1, 97, 246)
|| !sbp.o_g_b(g_V1, 97, 246))
return;
break;
}
sbp.s_d();
B_ending_removed = true;
} else
sbp.lb = v_1;
}
}
function r_other_endings() {
var a_v, v_1, v_2;
if (sbp.c >= I_p2) {
v_1 = sbp.lb;
sbp.lb = I_p2;
sbp.k = sbp.c;
a_v = sbp.f_a_b(a_7, 14);
if (a_v) {
sbp.b = sbp.c;
sbp.lb = v_1;
if (a_v == 1) {
v_2 = sbp.l - sbp.c;
if (sbp.e_s_b(2, "po"))
return;
sbp.c = sbp.l - v_2;
}
sbp.s_d();
} else
sbp.lb = v_1;
}
}
function r_i_plural() {
var v_1;
if (sbp.c >= I_p1) {
v_1 = sbp.lb;
sbp.lb = I_p1;
sbp.k = sbp.c;
if (sbp.f_a_b(a_8, 2)) {
sbp.b = sbp.c;
sbp.lb = v_1;
sbp.s_d();
} else
sbp.lb = v_1;
}
}
function r_t_plural() {
var a_v, v_1, v_2, v_3, v_4, v_5;
if (sbp.c >= I_p1) {
v_1 = sbp.lb;
sbp.lb = I_p1;
sbp.k = sbp.c;
if (sbp.e_s_b(1, "t")) {
sbp.b = sbp.c;
v_2 = sbp.l - sbp.c;
if (sbp.i_g_b(g_V1, 97, 246)) {
sbp.c = sbp.l - v_2;
sbp.s_d();
sbp.lb = v_1;
v_3 = sbp.l - sbp.c;
if (sbp.c >= I_p2) {
sbp.c = I_p2;
v_4 = sbp.lb;
sbp.lb = sbp.c;
sbp.c = sbp.l - v_3;
sbp.k = sbp.c;
a_v = sbp.f_a_b(a_9, 2);
if (a_v) {
sbp.b = sbp.c;
sbp.lb = v_4;
if (a_v == 1) {
v_5 = sbp.l - sbp.c;
if (sbp.e_s_b(2, "po"))
return;
sbp.c = sbp.l - v_5;
}
sbp.s_d();
return;
}
}
}
}
sbp.lb = v_1;
}
}
function r_tidy() {
var v_1, v_2, v_3, v_4;
if (sbp.c >= I_p1) {
v_1 = sbp.lb;
sbp.lb = I_p1;
v_2 = sbp.l - sbp.c;
if (r_LONG()) {
sbp.c = sbp.l - v_2;
sbp.k = sbp.c;
if (sbp.c > sbp.lb) {
sbp.c--;
sbp.b = sbp.c;
sbp.s_d();
}
}
sbp.c = sbp.l - v_2;
sbp.k = sbp.c;
if (sbp.i_g_b(g_AEI, 97, 228)) {
sbp.b = sbp.c;
if (sbp.o_g_b(g_V1, 97, 246))
sbp.s_d();
}
sbp.c = sbp.l - v_2;
sbp.k = sbp.c;
if (sbp.e_s_b(1, "j")) {
sbp.b = sbp.c;
v_3 = sbp.l - sbp.c;
if (!sbp.e_s_b(1, "o")) {
sbp.c = sbp.l - v_3;
if (sbp.e_s_b(1, "u"))
sbp.s_d();
} else
sbp.s_d();
}
sbp.c = sbp.l - v_2;
sbp.k = sbp.c;
if (sbp.e_s_b(1, "o")) {
sbp.b = sbp.c;
if (sbp.e_s_b(1, "j"))
sbp.s_d();
}
sbp.c = sbp.l - v_2;
sbp.lb = v_1;
while (true) {
v_4 = sbp.l - sbp.c;
if (sbp.o_g_b(g_V1, 97, 246)) {
sbp.c = sbp.l - v_4;
break;
}
sbp.c = sbp.l - v_4;
if (sbp.c <= sbp.lb)
return;
sbp.c--;
}
sbp.k = sbp.c;
if (sbp.c > sbp.lb) {
sbp.c--;
sbp.b = sbp.c;
S_x = sbp.s_t();
if (sbp.e_v_b(S_x))
sbp.s_d();
}
}
}
this.stem = function() {
var v_1 = sbp.c;
r_mark_regions();
B_ending_removed = false;
sbp.lb = v_1;
sbp.c = sbp.l;
r_particle_etc();
sbp.c = sbp.l;
r_possessive();
sbp.c = sbp.l;
r_case_ending();
sbp.c = sbp.l;
r_other_endings();
sbp.c = sbp.l;
if (B_ending_removed) {
r_i_plural();
sbp.c = sbp.l;
} else {
sbp.c = sbp.l;
r_t_plural();
sbp.c = sbp.l;
}
r_tidy();
return true;
}
},
FrenchStemmer : function() {
var a_0 = [new Among("col", -1, -1), new Among("par", -1, -1),
new Among("tap", -1, -1)], a_1 = [new Among("", -1, 4),
new Among("I", 0, 1), new Among("U", 0, 2),
new Among("Y", 0, 3)], a_2 = [new Among("iqU", -1, 3),
new Among("abl", -1, 3), new Among("I\u00E8r", -1, 4),
new Among("i\u00E8r", -1, 4), new Among("eus", -1, 2),
new Among("iv", -1, 1)], a_3 = [new Among("ic", -1, 2),
new Among("abil", -1, 1), new Among("iv", -1, 3)], a_4 = [
new Among("iqUe", -1, 1), new Among("atrice", -1, 2),
new Among("ance", -1, 1), new Among("ence", -1, 5),
new Among("logie", -1, 3), new Among("able", -1, 1),
new Among("isme", -1, 1), new Among("euse", -1, 11),
new Among("iste", -1, 1), new Among("ive", -1, 8),
new Among("if", -1, 8), new Among("usion", -1, 4),
new Among("ation", -1, 2), new Among("ution", -1, 4),
new Among("ateur", -1, 2), new Among("iqUes", -1, 1),
new Among("atrices", -1, 2), new Among("ances", -1, 1),
new Among("ences", -1, 5), new Among("logies", -1, 3),
new Among("ables", -1, 1), new Among("ismes", -1, 1),
new Among("euses", -1, 11), new Among("istes", -1, 1),
new Among("ives", -1, 8), new Among("ifs", -1, 8),
new Among("usions", -1, 4), new Among("ations", -1, 2),
new Among("utions", -1, 4), new Among("ateurs", -1, 2),
new Among("ments", -1, 15), new Among("ements", 30, 6),
new Among("issements", 31, 12),
new Among("it\u00E9s", -1, 7), new Among("ment", -1, 15),
new Among("ement", 34, 6), new Among("issement", 35, 12),
new Among("amment", 34, 13), new Among("emment", 34, 14),
new Among("aux", -1, 10), new Among("eaux", 39, 9),
new Among("eux", -1, 1), new Among("it\u00E9", -1, 7)], a_5 = [
new Among("ira", -1, 1), new Among("ie", -1, 1),
new Among("isse", -1, 1), new Among("issante", -1, 1),
new Among("i", -1, 1), new Among("irai", 4, 1),
new Among("ir", -1, 1), new Among("iras", -1, 1),
new Among("ies", -1, 1), new Among("\u00EEmes", -1, 1),
new Among("isses", -1, 1), new Among("issantes", -1, 1),
new Among("\u00EEtes", -1, 1), new Among("is", -1, 1),
new Among("irais", 13, 1), new Among("issais", 13, 1),
new Among("irions", -1, 1), new Among("issions", -1, 1),
new Among("irons", -1, 1), new Among("issons", -1, 1),
new Among("issants", -1, 1), new Among("it", -1, 1),
new Among("irait", 21, 1), new Among("issait", 21, 1),
new Among("issant", -1, 1), new Among("iraIent", -1, 1),
new Among("issaIent", -1, 1), new Among("irent", -1, 1),
new Among("issent", -1, 1), new Among("iront", -1, 1),
new Among("\u00EEt", -1, 1), new Among("iriez", -1, 1),
new Among("issiez", -1, 1), new Among("irez", -1, 1),
new Among("issez", -1, 1)], a_6 = [new Among("a", -1, 3),
new Among("era", 0, 2), new Among("asse", -1, 3),
new Among("ante", -1, 3), new Among("\u00E9e", -1, 2),
new Among("ai", -1, 3), new Among("erai", 5, 2),
new Among("er", -1, 2), new Among("as", -1, 3),
new Among("eras", 8, 2), new Among("\u00E2mes", -1, 3),
new Among("asses", -1, 3), new Among("antes", -1, 3),
new Among("\u00E2tes", -1, 3),
new Among("\u00E9es", -1, 2), new Among("ais", -1, 3),
new Among("erais", 15, 2), new Among("ions", -1, 1),
new Among("erions", 17, 2), new Among("assions", 17, 3),
new Among("erons", -1, 2), new Among("ants", -1, 3),
new Among("\u00E9s", -1, 2), new Among("ait", -1, 3),
new Among("erait", 23, 2), new Among("ant", -1, 3),
new Among("aIent", -1, 3), new Among("eraIent", 26, 2),
new Among("\u00E8rent", -1, 2), new Among("assent", -1, 3),
new Among("eront", -1, 2), new Among("\u00E2t", -1, 3),
new Among("ez", -1, 2), new Among("iez", 32, 2),
new Among("eriez", 33, 2), new Among("assiez", 33, 3),
new Among("erez", 32, 2), new Among("\u00E9", -1, 2)], a_7 = [
new Among("e", -1, 3), new Among("I\u00E8re", 0, 2),
new Among("i\u00E8re", 0, 2), new Among("ion", -1, 1),
new Among("Ier", -1, 2), new Among("ier", -1, 2),
new Among("\u00EB", -1, 4)], a_8 = [
new Among("ell", -1, -1), new Among("eill", -1, -1),
new Among("enn", -1, -1), new Among("onn", -1, -1),
new Among("ett", -1, -1)], g_v = [17, 65, 16, 1, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 128, 130, 103, 8, 5], g_keep_with_s = [
1, 65, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128], I_p2, I_p1, I_pV, sbp = new SnowballProgram();
this.setCurrent = function(word) {
sbp.s_c(word);
};
this.getCurrent = function() {
return sbp.g_c();
};
function habr1(c1, c2, v_1) {
if (sbp.e_s(1, c1)) {
sbp.k = sbp.c;
if (sbp.i_g(g_v, 97, 251)) {
sbp.s_f(c2);
sbp.c = v_1;
return true;
}
}
return false;
}
function habr2(c1, c2, v_1) {
if (sbp.e_s(1, c1)) {
sbp.k = sbp.c;
sbp.s_f(c2);
sbp.c = v_1;
return true;
}
return false;
}
function r_prelude() {
var v_1, v_2;
while (true) {
v_1 = sbp.c;
if (sbp.i_g(g_v, 97, 251)) {
sbp.b = sbp.c;
v_2 = sbp.c;
if (habr1("u", "U", v_1))
continue;
sbp.c = v_2;
if (habr1("i", "I", v_1))
continue;
sbp.c = v_2;
if (habr2("y", "Y", v_1))
continue;
}
sbp.c = v_1;
sbp.b = v_1;
if (!habr1("y", "Y", v_1)) {
sbp.c = v_1;
if (sbp.e_s(1, "q")) {
sbp.b = sbp.c;
if (habr2("u", "U", v_1))
continue;
}
sbp.c = v_1;
if (v_1 >= sbp.l)
return;
sbp.c++;
}
}
}
function habr3() {
while (!sbp.i_g(g_v, 97, 251)) {
if (sbp.c >= sbp.l)
return true;
sbp.c++;
}
while (!sbp.o_g(g_v, 97, 251)) {
if (sbp.c >= sbp.l)
return true;
sbp.c++;
}
return false;
}
function r_mark_regions() {
var v_1 = sbp.c;
I_pV = sbp.l;
I_p1 = I_pV;
I_p2 = I_pV;
if (sbp.i_g(g_v, 97, 251)
&& sbp.i_g(g_v, 97, 251) && sbp.c < sbp.l)
sbp.c++;
else {
sbp.c = v_1;
if (!sbp.f_a(a_0, 3)) {
sbp.c = v_1;
do {
if (sbp.c >= sbp.l) {
sbp.c = I_pV;
break;
}
sbp.c++;
} while (!sbp.i_g(g_v, 97, 251));
}
}
I_pV = sbp.c;
sbp.c = v_1;
if (!habr3()) {
I_p1 = sbp.c;
if (!habr3())
I_p2 = sbp.c;
}
}
function r_postlude() {
var a_v, v_1;
while (true) {
v_1 = sbp.c;
sbp.b = v_1;
a_v = sbp.f_a(a_1, 4);
if (!a_v)
break;
sbp.k = sbp.c;
switch (a_v) {
case 1 :
sbp.s_f("i");
break;
case 2 :
sbp.s_f("u");
break;
case 3 :
sbp.s_f("y");
break;
case 4 :
if (sbp.c >= sbp.l)
return;
sbp.c++;
break;
}
}
}
function r_RV() {
return I_pV <= sbp.c;
}
function r_R1() {
return I_p1 <= sbp.c;
}
function r_R2() {
return I_p2 <= sbp.c;
}
function r_standard_suffix() {
var a_v, v_1;
sbp.k = sbp.c;
a_v = sbp.f_a_b(a_4, 43);
if (a_v) {
sbp.b = sbp.c;
switch (a_v) {
case 1 :
if (!r_R2())
return false;
sbp.s_d();
break;
case 2 :
if (!r_R2())
return false;
sbp.s_d();
sbp.k = sbp.c;
if (sbp.e_s_b(2, "ic")) {
sbp.b = sbp.c;
if (!r_R2())
sbp.s_f("iqU");
else
sbp.s_d();
}
break;
case 3 :
if (!r_R2())
return false;
sbp.s_f("log");
break;
case 4 :
if (!r_R2())
return false;
sbp.s_f("u");
break;
case 5 :
if (!r_R2())
return false;
sbp.s_f("ent");
break;
case 6 :
if (!r_RV())
return false;
sbp.s_d();
sbp.k = sbp.c;
a_v = sbp.f_a_b(a_2, 6);
if (a_v) {
sbp.b = sbp.c;
switch (a_v) {
case 1 :
if (r_R2()) {
sbp.s_d();
sbp.k = sbp.c;
if (sbp.e_s_b(2, "at")) {
sbp.b = sbp.c;
if (r_R2())
sbp.s_d();
}
}
break;
case 2 :
if (r_R2())
sbp.s_d();
else if (r_R1())
sbp.s_f("eux");
break;
case 3 :
if (r_R2())
sbp.s_d();
break;
case 4 :
if (r_RV())
sbp.s_f("i");
break;
}
}
break;
case 7 :
if (!r_R2())
return false;
sbp.s_d();
sbp.k = sbp.c;
a_v = sbp.f_a_b(a_3, 3);
if (a_v) {
sbp.b = sbp.c;
switch (a_v) {
case 1 :
if (r_R2())
sbp.s_d();
else
sbp.s_f("abl");
break;
case 2 :
if (r_R2())
sbp.s_d();
else
sbp.s_f("iqU");
break;
case 3 :
if (r_R2())
sbp.s_d();
break;
}
}
break;
case 8 :
if (!r_R2())
return false;
sbp.s_d();
sbp.k = sbp.c;
if (sbp.e_s_b(2, "at")) {
sbp.b = sbp.c;
if (r_R2()) {
sbp.s_d();
sbp.k = sbp.c;
if (sbp.e_s_b(2, "ic")) {
sbp.b = sbp.c;
if (r_R2())
sbp.s_d();
else
sbp.s_f("iqU");
break;
}
}
}
break;
case 9 :
sbp.s_f("eau");
break;
case 10 :
if (!r_R1())
return false;
sbp.s_f("al");
break;
case 11 :
if (r_R2())
sbp.s_d();
else if (!r_R1())
return false;
else
sbp.s_f("eux");
break;
case 12 :
if (!r_R1() || !sbp.o_g_b(g_v, 97, 251))
return false;
sbp.s_d();
break;
case 13 :
if (r_RV())
sbp.s_f("ant");
return false;
case 14 :
if (r_RV())
sbp.s_f("ent");
return false;
case 15 :
v_1 = sbp.l - sbp.c;
if (sbp.i_g_b(g_v, 97, 251) && r_RV()) {
sbp.c = sbp.l - v_1;
sbp.s_d();
}
return false;
}
return true;
}
return false;
}
function r_i_verb_suffix() {
var a_v, v_1;
if (sbp.c < I_pV)
return false;
v_1 = sbp.lb;
sbp.lb = I_pV;
sbp.k = sbp.c;
a_v = sbp.f_a_b(a_5, 35);
if (!a_v) {
sbp.lb = v_1;
return false;
}
sbp.b = sbp.c;
if (a_v == 1) {
if (!sbp.o_g_b(g_v, 97, 251)) {
sbp.lb = v_1;
return false;
}
sbp.s_d();
}
sbp.lb = v_1;
return true;
}
function r_verb_suffix() {
var a_v, v_2, v_3;
if (sbp.c < I_pV)
return false;
v_2 = sbp.lb;
sbp.lb = I_pV;
sbp.k = sbp.c;
a_v = sbp.f_a_b(a_6, 38);
if (!a_v) {
sbp.lb = v_2;
return false;
}
sbp.b = sbp.c;
switch (a_v) {
case 1 :
if (!r_R2()) {
sbp.lb = v_2;
return false;
}
sbp.s_d();
break;
case 2 :
sbp.s_d();
break;
case 3 :
sbp.s_d();
v_3 = sbp.l - sbp.c;
sbp.k = sbp.c;