middleman-search-gds 0.11.0a
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.travis.yml +5 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +191 -0
- data/lib/middleman-search.rb +7 -0
- data/lib/middleman-search/extension.rb +35 -0
- data/lib/middleman-search/search-index-resource.rb +157 -0
- data/lib/middleman-search/version.rb +3 -0
- data/lib/middleman_extension.rb +1 -0
- data/middleman-search.gemspec +27 -0
- data/vendor/assets/javascripts/lunr.da.js +273 -0
- data/vendor/assets/javascripts/lunr.de.js +373 -0
- data/vendor/assets/javascripts/lunr.du.js +437 -0
- data/vendor/assets/javascripts/lunr.es.js +588 -0
- data/vendor/assets/javascripts/lunr.fi.js +529 -0
- data/vendor/assets/javascripts/lunr.fr.js +691 -0
- data/vendor/assets/javascripts/lunr.hu.js +554 -0
- data/vendor/assets/javascripts/lunr.it.js +605 -0
- data/vendor/assets/javascripts/lunr.jp.js +118 -0
- data/vendor/assets/javascripts/lunr.min.js +7 -0
- data/vendor/assets/javascripts/lunr.no.js +246 -0
- data/vendor/assets/javascripts/lunr.pt.js +559 -0
- data/vendor/assets/javascripts/lunr.ro.js +547 -0
- data/vendor/assets/javascripts/lunr.ru.js +380 -0
- data/vendor/assets/javascripts/lunr.stemmer.support.js +282 -0
- data/vendor/assets/javascripts/lunr.sv.js +245 -0
- data/vendor/assets/javascripts/lunr.tr.js +1063 -0
- metadata +147 -0
@@ -0,0 +1,245 @@
|
|
1
|
+
/*!
|
2
|
+
* Lunr languages, `Swedish` language
|
3
|
+
* https://github.com/MihaiValentin/lunr-languages
|
4
|
+
*
|
5
|
+
* Copyright 2014, Mihai Valentin
|
6
|
+
* http://www.mozilla.org/MPL/
|
7
|
+
*/
|
8
|
+
/*!
|
9
|
+
* based on
|
10
|
+
* Snowball JavaScript Library v0.3
|
11
|
+
* http://code.google.com/p/urim/
|
12
|
+
* http://snowball.tartarus.org/
|
13
|
+
*
|
14
|
+
* Copyright 2010, Oleg Mazko
|
15
|
+
* http://www.mozilla.org/MPL/
|
16
|
+
*/
|
17
|
+
|
18
|
+
/**
|
19
|
+
* export the module via AMD, CommonJS or as a browser global
|
20
|
+
* Export code from https://github.com/umdjs/umd/blob/master/returnExports.js
|
21
|
+
*/
|
22
|
+
;
|
23
|
+
(function(root, factory) {
|
24
|
+
if (typeof define === 'function' && define.amd) {
|
25
|
+
// AMD. Register as an anonymous module.
|
26
|
+
define(factory)
|
27
|
+
} else if (typeof exports === 'object') {
|
28
|
+
/**
|
29
|
+
* Node. Does not work with strict CommonJS, but
|
30
|
+
* only CommonJS-like environments that support module.exports,
|
31
|
+
* like Node.
|
32
|
+
*/
|
33
|
+
module.exports = factory()
|
34
|
+
} else {
|
35
|
+
// Browser globals (root is window)
|
36
|
+
factory()(root.lunr);
|
37
|
+
}
|
38
|
+
}(this, function() {
|
39
|
+
/**
|
40
|
+
* Just return a value to define the module export.
|
41
|
+
* This example returns an object, but the module
|
42
|
+
* can return a function as the exported value.
|
43
|
+
*/
|
44
|
+
return function(lunr) {
|
45
|
+
/* throw error if lunr is not yet included */
|
46
|
+
if ('undefined' === typeof lunr) {
|
47
|
+
throw new Error('Lunr is not present. Please include / require Lunr before this script.');
|
48
|
+
}
|
49
|
+
|
50
|
+
/* throw error if lunr stemmer support is not yet included */
|
51
|
+
if ('undefined' === typeof lunr.stemmerSupport) {
|
52
|
+
throw new Error('Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.');
|
53
|
+
}
|
54
|
+
|
55
|
+
/* register specific locale function */
|
56
|
+
lunr.sv = function() {
|
57
|
+
this.pipeline.reset();
|
58
|
+
this.pipeline.add(
|
59
|
+
lunr.sv.stopWordFilter,
|
60
|
+
lunr.sv.stemmer
|
61
|
+
);
|
62
|
+
};
|
63
|
+
|
64
|
+
/* lunr stemmer function */
|
65
|
+
lunr.sv.stemmer = (function() {
|
66
|
+
/* create the wrapped stemmer object */
|
67
|
+
var Among = lunr.stemmerSupport.Among,
|
68
|
+
SnowballProgram = lunr.stemmerSupport.SnowballProgram,
|
69
|
+
st = new function SwedishStemmer() {
|
70
|
+
var a_0 = [new Among("a", -1, 1), new Among("arna", 0, 1),
|
71
|
+
new Among("erna", 0, 1), new Among("heterna", 2, 1),
|
72
|
+
new Among("orna", 0, 1), new Among("ad", -1, 1),
|
73
|
+
new Among("e", -1, 1), new Among("ade", 6, 1),
|
74
|
+
new Among("ande", 6, 1), new Among("arne", 6, 1),
|
75
|
+
new Among("are", 6, 1), new Among("aste", 6, 1),
|
76
|
+
new Among("en", -1, 1), new Among("anden", 12, 1),
|
77
|
+
new Among("aren", 12, 1), new Among("heten", 12, 1),
|
78
|
+
new Among("ern", -1, 1), new Among("ar", -1, 1),
|
79
|
+
new Among("er", -1, 1), new Among("heter", 18, 1),
|
80
|
+
new Among("or", -1, 1), new Among("s", -1, 2),
|
81
|
+
new Among("as", 21, 1), new Among("arnas", 22, 1),
|
82
|
+
new Among("ernas", 22, 1), new Among("ornas", 22, 1),
|
83
|
+
new Among("es", 21, 1), new Among("ades", 26, 1),
|
84
|
+
new Among("andes", 26, 1), new Among("ens", 21, 1),
|
85
|
+
new Among("arens", 29, 1), new Among("hetens", 29, 1),
|
86
|
+
new Among("erns", 21, 1), new Among("at", -1, 1),
|
87
|
+
new Among("andet", -1, 1), new Among("het", -1, 1),
|
88
|
+
new Among("ast", -1, 1)
|
89
|
+
],
|
90
|
+
a_1 = [new Among("dd", -1, -1),
|
91
|
+
new Among("gd", -1, -1), new Among("nn", -1, -1),
|
92
|
+
new Among("dt", -1, -1), new Among("gt", -1, -1),
|
93
|
+
new Among("kt", -1, -1), new Among("tt", -1, -1)
|
94
|
+
],
|
95
|
+
a_2 = [
|
96
|
+
new Among("ig", -1, 1), new Among("lig", 0, 1),
|
97
|
+
new Among("els", -1, 1), new Among("fullt", -1, 3),
|
98
|
+
new Among("l\u00F6st", -1, 2)
|
99
|
+
],
|
100
|
+
g_v = [17, 65, 16, 1, 0, 0, 0, 0,
|
101
|
+
0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 32
|
102
|
+
],
|
103
|
+
g_s_ending = [119, 127, 149],
|
104
|
+
I_x, I_p1, sbp = new SnowballProgram();
|
105
|
+
this.setCurrent = function(word) {
|
106
|
+
sbp.setCurrent(word);
|
107
|
+
};
|
108
|
+
this.getCurrent = function() {
|
109
|
+
return sbp.getCurrent();
|
110
|
+
};
|
111
|
+
|
112
|
+
function r_mark_regions() {
|
113
|
+
var v_1, c = sbp.cursor + 3;
|
114
|
+
I_p1 = sbp.limit;
|
115
|
+
if (0 <= c || c <= sbp.limit) {
|
116
|
+
I_x = c;
|
117
|
+
while (true) {
|
118
|
+
v_1 = sbp.cursor;
|
119
|
+
if (sbp.in_grouping(g_v, 97, 246)) {
|
120
|
+
sbp.cursor = v_1;
|
121
|
+
break;
|
122
|
+
}
|
123
|
+
sbp.cursor = v_1;
|
124
|
+
if (sbp.cursor >= sbp.limit)
|
125
|
+
return;
|
126
|
+
sbp.cursor++;
|
127
|
+
}
|
128
|
+
while (!sbp.out_grouping(g_v, 97, 246)) {
|
129
|
+
if (sbp.cursor >= sbp.limit)
|
130
|
+
return;
|
131
|
+
sbp.cursor++;
|
132
|
+
}
|
133
|
+
I_p1 = sbp.cursor;
|
134
|
+
if (I_p1 < I_x)
|
135
|
+
I_p1 = I_x;
|
136
|
+
}
|
137
|
+
}
|
138
|
+
|
139
|
+
function r_main_suffix() {
|
140
|
+
var among_var, v_2 = sbp.limit_backward;
|
141
|
+
if (sbp.cursor >= I_p1) {
|
142
|
+
sbp.limit_backward = I_p1;
|
143
|
+
sbp.cursor = sbp.limit;
|
144
|
+
sbp.ket = sbp.cursor;
|
145
|
+
among_var = sbp.find_among_b(a_0, 37);
|
146
|
+
sbp.limit_backward = v_2;
|
147
|
+
if (among_var) {
|
148
|
+
sbp.bra = sbp.cursor;
|
149
|
+
switch (among_var) {
|
150
|
+
case 1:
|
151
|
+
sbp.slice_del();
|
152
|
+
break;
|
153
|
+
case 2:
|
154
|
+
if (sbp.in_grouping_b(g_s_ending, 98, 121))
|
155
|
+
sbp.slice_del();
|
156
|
+
break;
|
157
|
+
}
|
158
|
+
}
|
159
|
+
}
|
160
|
+
}
|
161
|
+
|
162
|
+
function r_consonant_pair() {
|
163
|
+
var v_1 = sbp.limit_backward;
|
164
|
+
if (sbp.cursor >= I_p1) {
|
165
|
+
sbp.limit_backward = I_p1;
|
166
|
+
sbp.cursor = sbp.limit;
|
167
|
+
if (sbp.find_among_b(a_1, 7)) {
|
168
|
+
sbp.cursor = sbp.limit;
|
169
|
+
sbp.ket = sbp.cursor;
|
170
|
+
if (sbp.cursor > sbp.limit_backward) {
|
171
|
+
sbp.bra = --sbp.cursor;
|
172
|
+
sbp.slice_del();
|
173
|
+
}
|
174
|
+
}
|
175
|
+
sbp.limit_backward = v_1;
|
176
|
+
}
|
177
|
+
}
|
178
|
+
|
179
|
+
function r_other_suffix() {
|
180
|
+
var among_var, v_2;
|
181
|
+
if (sbp.cursor >= I_p1) {
|
182
|
+
v_2 = sbp.limit_backward;
|
183
|
+
sbp.limit_backward = I_p1;
|
184
|
+
sbp.cursor = sbp.limit;
|
185
|
+
sbp.ket = sbp.cursor;
|
186
|
+
among_var = sbp.find_among_b(a_2, 5);
|
187
|
+
if (among_var) {
|
188
|
+
sbp.bra = sbp.cursor;
|
189
|
+
switch (among_var) {
|
190
|
+
case 1:
|
191
|
+
sbp.slice_del();
|
192
|
+
break;
|
193
|
+
case 2:
|
194
|
+
sbp.slice_from("l\u00F6s");
|
195
|
+
break;
|
196
|
+
case 3:
|
197
|
+
sbp.slice_from("full");
|
198
|
+
break;
|
199
|
+
}
|
200
|
+
}
|
201
|
+
sbp.limit_backward = v_2;
|
202
|
+
}
|
203
|
+
}
|
204
|
+
this.stem = function() {
|
205
|
+
var v_1 = sbp.cursor;
|
206
|
+
r_mark_regions();
|
207
|
+
sbp.limit_backward = v_1;
|
208
|
+
sbp.cursor = sbp.limit;
|
209
|
+
r_main_suffix();
|
210
|
+
sbp.cursor = sbp.limit;
|
211
|
+
r_consonant_pair();
|
212
|
+
sbp.cursor = sbp.limit;
|
213
|
+
r_other_suffix();
|
214
|
+
return true;
|
215
|
+
}
|
216
|
+
};
|
217
|
+
|
218
|
+
/* and return a function that stems a word for the current locale */
|
219
|
+
return function(word) {
|
220
|
+
st.setCurrent(word);
|
221
|
+
st.stem();
|
222
|
+
return st.getCurrent();
|
223
|
+
}
|
224
|
+
})();
|
225
|
+
|
226
|
+
lunr.Pipeline.registerFunction(lunr.sv.stemmer, 'stemmer-sv');
|
227
|
+
|
228
|
+
/* stop word filter function */
|
229
|
+
lunr.sv.stopWordFilter = function(token) {
|
230
|
+
if (lunr.sv.stopWordFilter.stopWords.indexOf(token) === -1) {
|
231
|
+
return token;
|
232
|
+
}
|
233
|
+
};
|
234
|
+
|
235
|
+
lunr.sv.stopWordFilter.stopWords = new lunr.SortedSet();
|
236
|
+
lunr.sv.stopWordFilter.stopWords.length = 115;
|
237
|
+
|
238
|
+
// The space at the beginning is crucial: It marks the empty string
|
239
|
+
// as a stop word. lunr.js crashes during search when documents
|
240
|
+
// processed by the pipeline still contain the empty string.
|
241
|
+
lunr.sv.stopWordFilter.stopWords.elements = ' alla allt att av blev bli blir blivit de dem den denna deras dess dessa det detta dig din dina ditt du där då efter ej eller en er era ert ett från för ha hade han hans har henne hennes hon honom hur här i icke ingen inom inte jag ju kan kunde man med mellan men mig min mina mitt mot mycket ni nu när någon något några och om oss på samma sedan sig sin sina sitta själv skulle som så sådan sådana sådant till under upp ut utan vad var vara varför varit varje vars vart vem vi vid vilka vilkas vilken vilket vår våra vårt än är åt över'.split(' ');
|
242
|
+
|
243
|
+
lunr.Pipeline.registerFunction(lunr.sv.stopWordFilter, 'stopWordFilter-sv');
|
244
|
+
};
|
245
|
+
}))
|
@@ -0,0 +1,1063 @@
|
|
1
|
+
/*!
|
2
|
+
* Lunr languages, `Turkish` language
|
3
|
+
* https://github.com/MihaiValentin/lunr-languages
|
4
|
+
*
|
5
|
+
* Copyright 2014, Mihai Valentin
|
6
|
+
* http://www.mozilla.org/MPL/
|
7
|
+
*/
|
8
|
+
/*!
|
9
|
+
* based on
|
10
|
+
* Snowball JavaScript Library v0.3
|
11
|
+
* http://code.google.com/p/urim/
|
12
|
+
* http://snowball.tartarus.org/
|
13
|
+
*
|
14
|
+
* Copyright 2010, Oleg Mazko
|
15
|
+
* http://www.mozilla.org/MPL/
|
16
|
+
*/
|
17
|
+
|
18
|
+
/**
|
19
|
+
* export the module via AMD, CommonJS or as a browser global
|
20
|
+
* Export code from https://github.com/umdjs/umd/blob/master/returnExports.js
|
21
|
+
*/
|
22
|
+
;
|
23
|
+
(function(root, factory) {
|
24
|
+
if (typeof define === 'function' && define.amd) {
|
25
|
+
// AMD. Register as an anonymous module.
|
26
|
+
define(factory)
|
27
|
+
} else if (typeof exports === 'object') {
|
28
|
+
/**
|
29
|
+
* Node. Does not work with strict CommonJS, but
|
30
|
+
* only CommonJS-like environments that support module.exports,
|
31
|
+
* like Node.
|
32
|
+
*/
|
33
|
+
module.exports = factory()
|
34
|
+
} else {
|
35
|
+
// Browser globals (root is window)
|
36
|
+
factory()(root.lunr);
|
37
|
+
}
|
38
|
+
}(this, function() {
|
39
|
+
/**
|
40
|
+
* Just return a value to define the module export.
|
41
|
+
* This example returns an object, but the module
|
42
|
+
* can return a function as the exported value.
|
43
|
+
*/
|
44
|
+
return function(lunr) {
|
45
|
+
/* throw error if lunr is not yet included */
|
46
|
+
if ('undefined' === typeof lunr) {
|
47
|
+
throw new Error('Lunr is not present. Please include / require Lunr before this script.');
|
48
|
+
}
|
49
|
+
|
50
|
+
/* throw error if lunr stemmer support is not yet included */
|
51
|
+
if ('undefined' === typeof lunr.stemmerSupport) {
|
52
|
+
throw new Error('Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.');
|
53
|
+
}
|
54
|
+
|
55
|
+
/* register specific locale function */
|
56
|
+
lunr.tr = function() {
|
57
|
+
this.pipeline.reset();
|
58
|
+
this.pipeline.add(
|
59
|
+
lunr.tr.stopWordFilter,
|
60
|
+
lunr.tr.stemmer
|
61
|
+
);
|
62
|
+
};
|
63
|
+
|
64
|
+
/* lunr stemmer function */
|
65
|
+
lunr.tr.stemmer = (function() {
|
66
|
+
/* create the wrapped stemmer object */
|
67
|
+
var Among = lunr.stemmerSupport.Among,
|
68
|
+
SnowballProgram = lunr.stemmerSupport.SnowballProgram,
|
69
|
+
st = new function TurkishStemmer() {
|
70
|
+
var a_0 = [new Among("m", -1, -1), new Among("n", -1, -1),
|
71
|
+
new Among("miz", -1, -1), new Among("niz", -1, -1),
|
72
|
+
new Among("muz", -1, -1), new Among("nuz", -1, -1),
|
73
|
+
new Among("m\u00FCz", -1, -1), new Among("n\u00FCz", -1, -1),
|
74
|
+
new Among("m\u0131z", -1, -1), new Among("n\u0131z", -1, -1)
|
75
|
+
],
|
76
|
+
a_1 = [
|
77
|
+
new Among("leri", -1, -1), new Among("lar\u0131", -1, -1)
|
78
|
+
],
|
79
|
+
a_2 = [
|
80
|
+
new Among("ni", -1, -1), new Among("nu", -1, -1),
|
81
|
+
new Among("n\u00FC", -1, -1), new Among("n\u0131", -1, -1)
|
82
|
+
],
|
83
|
+
a_3 = [
|
84
|
+
new Among("in", -1, -1), new Among("un", -1, -1),
|
85
|
+
new Among("\u00FCn", -1, -1), new Among("\u0131n", -1, -1)
|
86
|
+
],
|
87
|
+
a_4 = [
|
88
|
+
new Among("a", -1, -1), new Among("e", -1, -1)
|
89
|
+
],
|
90
|
+
a_5 = [
|
91
|
+
new Among("na", -1, -1), new Among("ne", -1, -1)
|
92
|
+
],
|
93
|
+
a_6 = [
|
94
|
+
new Among("da", -1, -1), new Among("ta", -1, -1),
|
95
|
+
new Among("de", -1, -1), new Among("te", -1, -1)
|
96
|
+
],
|
97
|
+
a_7 = [
|
98
|
+
new Among("nda", -1, -1), new Among("nde", -1, -1)
|
99
|
+
],
|
100
|
+
a_8 = [
|
101
|
+
new Among("dan", -1, -1), new Among("tan", -1, -1),
|
102
|
+
new Among("den", -1, -1), new Among("ten", -1, -1)
|
103
|
+
],
|
104
|
+
a_9 = [
|
105
|
+
new Among("ndan", -1, -1), new Among("nden", -1, -1)
|
106
|
+
],
|
107
|
+
a_10 = [
|
108
|
+
new Among("la", -1, -1), new Among("le", -1, -1)
|
109
|
+
],
|
110
|
+
a_11 = [
|
111
|
+
new Among("ca", -1, -1), new Among("ce", -1, -1)
|
112
|
+
],
|
113
|
+
a_12 = [
|
114
|
+
new Among("im", -1, -1), new Among("um", -1, -1),
|
115
|
+
new Among("\u00FCm", -1, -1), new Among("\u0131m", -1, -1)
|
116
|
+
],
|
117
|
+
a_13 = [
|
118
|
+
new Among("sin", -1, -1), new Among("sun", -1, -1),
|
119
|
+
new Among("s\u00FCn", -1, -1), new Among("s\u0131n", -1, -1)
|
120
|
+
],
|
121
|
+
a_14 = [
|
122
|
+
new Among("iz", -1, -1), new Among("uz", -1, -1),
|
123
|
+
new Among("\u00FCz", -1, -1), new Among("\u0131z", -1, -1)
|
124
|
+
],
|
125
|
+
a_15 = [
|
126
|
+
new Among("siniz", -1, -1), new Among("sunuz", -1, -1),
|
127
|
+
new Among("s\u00FCn\u00FCz", -1, -1),
|
128
|
+
new Among("s\u0131n\u0131z", -1, -1)
|
129
|
+
],
|
130
|
+
a_16 = [
|
131
|
+
new Among("lar", -1, -1), new Among("ler", -1, -1)
|
132
|
+
],
|
133
|
+
a_17 = [
|
134
|
+
new Among("niz", -1, -1), new Among("nuz", -1, -1),
|
135
|
+
new Among("n\u00FCz", -1, -1), new Among("n\u0131z", -1, -1)
|
136
|
+
],
|
137
|
+
a_18 = [
|
138
|
+
new Among("dir", -1, -1), new Among("tir", -1, -1),
|
139
|
+
new Among("dur", -1, -1), new Among("tur", -1, -1),
|
140
|
+
new Among("d\u00FCr", -1, -1), new Among("t\u00FCr", -1, -1),
|
141
|
+
new Among("d\u0131r", -1, -1), new Among("t\u0131r", -1, -1)
|
142
|
+
],
|
143
|
+
a_19 = [
|
144
|
+
new Among("cas\u0131na", -1, -1), new Among("cesine", -1, -1)
|
145
|
+
],
|
146
|
+
a_20 = [
|
147
|
+
new Among("di", -1, -1), new Among("ti", -1, -1),
|
148
|
+
new Among("dik", -1, -1), new Among("tik", -1, -1),
|
149
|
+
new Among("duk", -1, -1), new Among("tuk", -1, -1),
|
150
|
+
new Among("d\u00FCk", -1, -1), new Among("t\u00FCk", -1, -1),
|
151
|
+
new Among("d\u0131k", -1, -1), new Among("t\u0131k", -1, -1),
|
152
|
+
new Among("dim", -1, -1), new Among("tim", -1, -1),
|
153
|
+
new Among("dum", -1, -1), new Among("tum", -1, -1),
|
154
|
+
new Among("d\u00FCm", -1, -1), new Among("t\u00FCm", -1, -1),
|
155
|
+
new Among("d\u0131m", -1, -1), new Among("t\u0131m", -1, -1),
|
156
|
+
new Among("din", -1, -1), new Among("tin", -1, -1),
|
157
|
+
new Among("dun", -1, -1), new Among("tun", -1, -1),
|
158
|
+
new Among("d\u00FCn", -1, -1), new Among("t\u00FCn", -1, -1),
|
159
|
+
new Among("d\u0131n", -1, -1), new Among("t\u0131n", -1, -1),
|
160
|
+
new Among("du", -1, -1), new Among("tu", -1, -1),
|
161
|
+
new Among("d\u00FC", -1, -1), new Among("t\u00FC", -1, -1),
|
162
|
+
new Among("d\u0131", -1, -1), new Among("t\u0131", -1, -1)
|
163
|
+
],
|
164
|
+
a_21 = [
|
165
|
+
new Among("sa", -1, -1), new Among("se", -1, -1),
|
166
|
+
new Among("sak", -1, -1), new Among("sek", -1, -1),
|
167
|
+
new Among("sam", -1, -1), new Among("sem", -1, -1),
|
168
|
+
new Among("san", -1, -1), new Among("sen", -1, -1)
|
169
|
+
],
|
170
|
+
a_22 = [
|
171
|
+
new Among("mi\u015F", -1, -1), new Among("mu\u015F", -1, -1),
|
172
|
+
new Among("m\u00FC\u015F", -1, -1),
|
173
|
+
new Among("m\u0131\u015F", -1, -1)
|
174
|
+
],
|
175
|
+
a_23 = [new Among("b", -1, 1),
|
176
|
+
new Among("c", -1, 2), new Among("d", -1, 3),
|
177
|
+
new Among("\u011F", -1, 4)
|
178
|
+
],
|
179
|
+
g_vowel = [17, 65, 16, 0, 0, 0, 0, 0,
|
180
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 8, 0, 0, 0, 0, 0, 0, 1
|
181
|
+
],
|
182
|
+
g_U = [
|
183
|
+
1, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0,
|
184
|
+
0, 0, 0, 1
|
185
|
+
],
|
186
|
+
g_vowel1 = [1, 64, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
187
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
|
188
|
+
],
|
189
|
+
g_vowel2 = [17, 0, 0, 0,
|
190
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 130
|
191
|
+
],
|
192
|
+
g_vowel3 = [1, 0,
|
193
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
194
|
+
0, 0, 1
|
195
|
+
],
|
196
|
+
g_vowel4 = [17],
|
197
|
+
g_vowel5 = [65],
|
198
|
+
g_vowel6 = [65],
|
199
|
+
B_c_s_n_s, I_strlen, g_habr = [
|
200
|
+
["a", g_vowel1, 97, 305],
|
201
|
+
["e", g_vowel2, 101, 252],
|
202
|
+
["\u0131", g_vowel3, 97, 305],
|
203
|
+
["i", g_vowel4, 101, 105],
|
204
|
+
["o", g_vowel5, 111, 117],
|
205
|
+
["\u00F6", g_vowel6, 246, 252],
|
206
|
+
["u", g_vowel5, 111, 117]
|
207
|
+
],
|
208
|
+
sbp = new SnowballProgram();
|
209
|
+
this.setCurrent = function(word) {
|
210
|
+
sbp.setCurrent(word);
|
211
|
+
};
|
212
|
+
this.getCurrent = function() {
|
213
|
+
return sbp.getCurrent();
|
214
|
+
};
|
215
|
+
|
216
|
+
function habr1(g_v, n1, n2) {
|
217
|
+
while (true) {
|
218
|
+
var v_1 = sbp.limit - sbp.cursor;
|
219
|
+
if (sbp.in_grouping_b(g_v, n1, n2)) {
|
220
|
+
sbp.cursor = sbp.limit - v_1;
|
221
|
+
break;
|
222
|
+
}
|
223
|
+
sbp.cursor = sbp.limit - v_1;
|
224
|
+
if (sbp.cursor <= sbp.limit_backward)
|
225
|
+
return false;
|
226
|
+
sbp.cursor--;
|
227
|
+
}
|
228
|
+
return true;
|
229
|
+
}
|
230
|
+
|
231
|
+
function r_check_vowel_harmony() {
|
232
|
+
var v_1, v_2;
|
233
|
+
v_1 = sbp.limit - sbp.cursor;
|
234
|
+
habr1(g_vowel, 97, 305);
|
235
|
+
for (var i = 0; i < g_habr.length; i++) {
|
236
|
+
v_2 = sbp.limit - sbp.cursor;
|
237
|
+
var habr = g_habr[i];
|
238
|
+
if (sbp.eq_s_b(1, habr[0]) && habr1(habr[1], habr[2], habr[3])) {
|
239
|
+
sbp.cursor = sbp.limit - v_1;
|
240
|
+
return true;
|
241
|
+
}
|
242
|
+
sbp.cursor = sbp.limit - v_2;
|
243
|
+
}
|
244
|
+
sbp.cursor = sbp.limit - v_2;
|
245
|
+
if (!sbp.eq_s_b(1, "\u00FC") || !habr1(g_vowel6, 246, 252))
|
246
|
+
return false;
|
247
|
+
sbp.cursor = sbp.limit - v_1;
|
248
|
+
return true;
|
249
|
+
}
|
250
|
+
|
251
|
+
function habr2(f1, f2) {
|
252
|
+
var v_1 = sbp.limit - sbp.cursor,
|
253
|
+
v_2;
|
254
|
+
if (f1()) {
|
255
|
+
sbp.cursor = sbp.limit - v_1;
|
256
|
+
if (sbp.cursor > sbp.limit_backward) {
|
257
|
+
sbp.cursor--;
|
258
|
+
v_2 = sbp.limit - sbp.cursor;
|
259
|
+
if (f2()) {
|
260
|
+
sbp.cursor = sbp.limit - v_2;
|
261
|
+
return true;
|
262
|
+
}
|
263
|
+
}
|
264
|
+
}
|
265
|
+
sbp.cursor = sbp.limit - v_1;
|
266
|
+
if (f1()) {
|
267
|
+
sbp.cursor = sbp.limit - v_1;
|
268
|
+
return false;
|
269
|
+
}
|
270
|
+
sbp.cursor = sbp.limit - v_1;
|
271
|
+
if (sbp.cursor <= sbp.limit_backward)
|
272
|
+
return false;
|
273
|
+
sbp.cursor--;
|
274
|
+
if (!f2())
|
275
|
+
return false;
|
276
|
+
sbp.cursor = sbp.limit - v_1;
|
277
|
+
return true;
|
278
|
+
}
|
279
|
+
|
280
|
+
function habr3(f1) {
|
281
|
+
return habr2(f1, function() {
|
282
|
+
return sbp.in_grouping_b(g_vowel, 97, 305);
|
283
|
+
});
|
284
|
+
}
|
285
|
+
|
286
|
+
function r_mark_suffix_with_optional_n_consonant() {
|
287
|
+
return habr3(function() {
|
288
|
+
return sbp.eq_s_b(1, "n");
|
289
|
+
});
|
290
|
+
}
|
291
|
+
|
292
|
+
function r_mark_suffix_with_optional_s_consonant() {
|
293
|
+
return habr3(function() {
|
294
|
+
return sbp.eq_s_b(1, "s");
|
295
|
+
});
|
296
|
+
}
|
297
|
+
|
298
|
+
function r_mark_suffix_with_optional_y_consonant() {
|
299
|
+
return habr3(function() {
|
300
|
+
return sbp.eq_s_b(1, "y");
|
301
|
+
});
|
302
|
+
}
|
303
|
+
|
304
|
+
function r_mark_suffix_with_optional_U_vowel() {
|
305
|
+
return habr2(function() {
|
306
|
+
return sbp.in_grouping_b(g_U, 105, 305);
|
307
|
+
}, function() {
|
308
|
+
return sbp.out_grouping_b(g_vowel, 97, 305);
|
309
|
+
});
|
310
|
+
}
|
311
|
+
|
312
|
+
function r_mark_possessives() {
|
313
|
+
return sbp.find_among_b(a_0, 10) && r_mark_suffix_with_optional_U_vowel();
|
314
|
+
}
|
315
|
+
|
316
|
+
function r_mark_sU() {
|
317
|
+
return r_check_vowel_harmony() && sbp.in_grouping_b(g_U, 105, 305) && r_mark_suffix_with_optional_s_consonant();
|
318
|
+
}
|
319
|
+
|
320
|
+
function r_mark_lArI() {
|
321
|
+
return sbp.find_among_b(a_1, 2);
|
322
|
+
}
|
323
|
+
|
324
|
+
function r_mark_yU() {
|
325
|
+
return r_check_vowel_harmony() && sbp.in_grouping_b(g_U, 105, 305) && r_mark_suffix_with_optional_y_consonant();
|
326
|
+
}
|
327
|
+
|
328
|
+
function r_mark_nU() {
|
329
|
+
return r_check_vowel_harmony() && sbp.find_among_b(a_2, 4);
|
330
|
+
}
|
331
|
+
|
332
|
+
function r_mark_nUn() {
|
333
|
+
return r_check_vowel_harmony() && sbp.find_among_b(a_3, 4) && r_mark_suffix_with_optional_n_consonant();
|
334
|
+
}
|
335
|
+
|
336
|
+
function r_mark_yA() {
|
337
|
+
return r_check_vowel_harmony() && sbp.find_among_b(a_4, 2) && r_mark_suffix_with_optional_y_consonant();
|
338
|
+
}
|
339
|
+
|
340
|
+
function r_mark_nA() {
|
341
|
+
return r_check_vowel_harmony() && sbp.find_among_b(a_5, 2);
|
342
|
+
}
|
343
|
+
|
344
|
+
function r_mark_DA() {
|
345
|
+
return r_check_vowel_harmony() && sbp.find_among_b(a_6, 4);
|
346
|
+
}
|
347
|
+
|
348
|
+
function r_mark_ndA() {
|
349
|
+
return r_check_vowel_harmony() && sbp.find_among_b(a_7, 2);
|
350
|
+
}
|
351
|
+
|
352
|
+
function r_mark_DAn() {
|
353
|
+
return r_check_vowel_harmony() && sbp.find_among_b(a_8, 4);
|
354
|
+
}
|
355
|
+
|
356
|
+
function r_mark_ndAn() {
|
357
|
+
return r_check_vowel_harmony() && sbp.find_among_b(a_9, 2);
|
358
|
+
}
|
359
|
+
|
360
|
+
function r_mark_ylA() {
|
361
|
+
return r_check_vowel_harmony() && sbp.find_among_b(a_10, 2) && r_mark_suffix_with_optional_y_consonant();
|
362
|
+
}
|
363
|
+
|
364
|
+
function r_mark_ki() {
|
365
|
+
return sbp.eq_s_b(2, "ki");
|
366
|
+
}
|
367
|
+
|
368
|
+
function r_mark_ncA() {
|
369
|
+
return r_check_vowel_harmony() && sbp.find_among_b(a_11, 2) && r_mark_suffix_with_optional_n_consonant();
|
370
|
+
}
|
371
|
+
|
372
|
+
function r_mark_yUm() {
|
373
|
+
return r_check_vowel_harmony() && sbp.find_among_b(a_12, 4) && r_mark_suffix_with_optional_y_consonant();
|
374
|
+
}
|
375
|
+
|
376
|
+
function r_mark_sUn() {
|
377
|
+
return r_check_vowel_harmony() && sbp.find_among_b(a_13, 4);
|
378
|
+
}
|
379
|
+
|
380
|
+
function r_mark_yUz() {
|
381
|
+
return r_check_vowel_harmony() && sbp.find_among_b(a_14, 4) && r_mark_suffix_with_optional_y_consonant();
|
382
|
+
}
|
383
|
+
|
384
|
+
function r_mark_sUnUz() {
|
385
|
+
return sbp.find_among_b(a_15, 4);
|
386
|
+
}
|
387
|
+
|
388
|
+
function r_mark_lAr() {
|
389
|
+
return r_check_vowel_harmony() && sbp.find_among_b(a_16, 2);
|
390
|
+
}
|
391
|
+
|
392
|
+
function r_mark_nUz() {
|
393
|
+
return r_check_vowel_harmony() && sbp.find_among_b(a_17, 4);
|
394
|
+
}
|
395
|
+
|
396
|
+
function r_mark_DUr() {
|
397
|
+
return r_check_vowel_harmony() && sbp.find_among_b(a_18, 8);
|
398
|
+
}
|
399
|
+
|
400
|
+
function r_mark_cAsInA() {
|
401
|
+
return sbp.find_among_b(a_19, 2);
|
402
|
+
}
|
403
|
+
|
404
|
+
function r_mark_yDU() {
|
405
|
+
return r_check_vowel_harmony() && sbp.find_among_b(a_20, 32) && r_mark_suffix_with_optional_y_consonant();
|
406
|
+
}
|
407
|
+
|
408
|
+
function r_mark_ysA() {
|
409
|
+
return sbp.find_among_b(a_21, 8) && r_mark_suffix_with_optional_y_consonant();
|
410
|
+
}
|
411
|
+
|
412
|
+
function r_mark_ymUs_() {
|
413
|
+
return r_check_vowel_harmony() && sbp.find_among_b(a_22, 4) && r_mark_suffix_with_optional_y_consonant();
|
414
|
+
}
|
415
|
+
|
416
|
+
function r_mark_yken() {
|
417
|
+
return sbp.eq_s_b(3, "ken") && r_mark_suffix_with_optional_y_consonant();
|
418
|
+
}
|
419
|
+
|
420
|
+
function habr4() {
|
421
|
+
var v_1 = sbp.limit - sbp.cursor;
|
422
|
+
if (!r_mark_ymUs_()) {
|
423
|
+
sbp.cursor = sbp.limit - v_1;
|
424
|
+
if (!r_mark_yDU()) {
|
425
|
+
sbp.cursor = sbp.limit - v_1;
|
426
|
+
if (!r_mark_ysA()) {
|
427
|
+
sbp.cursor = sbp.limit - v_1;
|
428
|
+
if (!r_mark_yken())
|
429
|
+
return true;
|
430
|
+
}
|
431
|
+
}
|
432
|
+
}
|
433
|
+
return false;
|
434
|
+
}
|
435
|
+
|
436
|
+
function habr5() {
|
437
|
+
if (r_mark_cAsInA()) {
|
438
|
+
var v_1 = sbp.limit - sbp.cursor;
|
439
|
+
if (!r_mark_sUnUz()) {
|
440
|
+
sbp.cursor = sbp.limit - v_1;
|
441
|
+
if (!r_mark_lAr()) {
|
442
|
+
sbp.cursor = sbp.limit - v_1;
|
443
|
+
if (!r_mark_yUm()) {
|
444
|
+
sbp.cursor = sbp.limit - v_1;
|
445
|
+
if (!r_mark_sUn()) {
|
446
|
+
sbp.cursor = sbp.limit - v_1;
|
447
|
+
if (!r_mark_yUz())
|
448
|
+
sbp.cursor = sbp.limit - v_1;
|
449
|
+
}
|
450
|
+
}
|
451
|
+
}
|
452
|
+
}
|
453
|
+
if (r_mark_ymUs_())
|
454
|
+
return false;
|
455
|
+
}
|
456
|
+
return true;
|
457
|
+
}
|
458
|
+
|
459
|
+
function habr6() {
|
460
|
+
if (r_mark_lAr()) {
|
461
|
+
sbp.bra = sbp.cursor;
|
462
|
+
sbp.slice_del();
|
463
|
+
var v_1 = sbp.limit - sbp.cursor;
|
464
|
+
sbp.ket = sbp.cursor;
|
465
|
+
if (!r_mark_DUr()) {
|
466
|
+
sbp.cursor = sbp.limit - v_1;
|
467
|
+
if (!r_mark_yDU()) {
|
468
|
+
sbp.cursor = sbp.limit - v_1;
|
469
|
+
if (!r_mark_ysA()) {
|
470
|
+
sbp.cursor = sbp.limit - v_1;
|
471
|
+
if (!r_mark_ymUs_())
|
472
|
+
sbp.cursor = sbp.limit - v_1;
|
473
|
+
}
|
474
|
+
}
|
475
|
+
}
|
476
|
+
B_c_s_n_s = false;
|
477
|
+
return false;
|
478
|
+
}
|
479
|
+
return true;
|
480
|
+
}
|
481
|
+
|
482
|
+
function habr7() {
|
483
|
+
if (!r_mark_nUz())
|
484
|
+
return true;
|
485
|
+
var v_1 = sbp.limit - sbp.cursor;
|
486
|
+
if (!r_mark_yDU()) {
|
487
|
+
sbp.cursor = sbp.limit - v_1;
|
488
|
+
if (!r_mark_ysA())
|
489
|
+
return true;
|
490
|
+
}
|
491
|
+
return false;
|
492
|
+
}
|
493
|
+
|
494
|
+
function habr8() {
|
495
|
+
var v_1 = sbp.limit - sbp.cursor,
|
496
|
+
v_2;
|
497
|
+
if (!r_mark_sUnUz()) {
|
498
|
+
sbp.cursor = sbp.limit - v_1;
|
499
|
+
if (!r_mark_yUz()) {
|
500
|
+
sbp.cursor = sbp.limit - v_1;
|
501
|
+
if (!r_mark_sUn()) {
|
502
|
+
sbp.cursor = sbp.limit - v_1;
|
503
|
+
if (!r_mark_yUm())
|
504
|
+
return true;
|
505
|
+
}
|
506
|
+
}
|
507
|
+
}
|
508
|
+
sbp.bra = sbp.cursor;
|
509
|
+
sbp.slice_del();
|
510
|
+
v_2 = sbp.limit - sbp.cursor;
|
511
|
+
sbp.ket = sbp.cursor;
|
512
|
+
if (!r_mark_ymUs_())
|
513
|
+
sbp.cursor = sbp.limit - v_2;
|
514
|
+
return false;
|
515
|
+
}
|
516
|
+
|
517
|
+
function r_stem_nominal_verb_suffixes() {
|
518
|
+
var v_1 = sbp.limit - sbp.cursor,
|
519
|
+
v_2;
|
520
|
+
sbp.ket = sbp.cursor;
|
521
|
+
B_c_s_n_s = true;
|
522
|
+
if (habr4()) {
|
523
|
+
sbp.cursor = sbp.limit - v_1;
|
524
|
+
if (habr5()) {
|
525
|
+
sbp.cursor = sbp.limit - v_1;
|
526
|
+
if (habr6()) {
|
527
|
+
sbp.cursor = sbp.limit - v_1;
|
528
|
+
if (habr7()) {
|
529
|
+
sbp.cursor = sbp.limit - v_1;
|
530
|
+
if (habr8()) {
|
531
|
+
sbp.cursor = sbp.limit - v_1;
|
532
|
+
if (!r_mark_DUr())
|
533
|
+
return;
|
534
|
+
sbp.bra = sbp.cursor;
|
535
|
+
sbp.slice_del();
|
536
|
+
sbp.ket = sbp.cursor;
|
537
|
+
v_2 = sbp.limit - sbp.cursor;
|
538
|
+
if (!r_mark_sUnUz()) {
|
539
|
+
sbp.cursor = sbp.limit - v_2;
|
540
|
+
if (!r_mark_lAr()) {
|
541
|
+
sbp.cursor = sbp.limit - v_2;
|
542
|
+
if (!r_mark_yUm()) {
|
543
|
+
sbp.cursor = sbp.limit - v_2;
|
544
|
+
if (!r_mark_sUn()) {
|
545
|
+
sbp.cursor = sbp.limit - v_2;
|
546
|
+
if (!r_mark_yUz())
|
547
|
+
sbp.cursor = sbp.limit - v_2;
|
548
|
+
}
|
549
|
+
}
|
550
|
+
}
|
551
|
+
}
|
552
|
+
if (!r_mark_ymUs_())
|
553
|
+
sbp.cursor = sbp.limit - v_2;
|
554
|
+
}
|
555
|
+
}
|
556
|
+
}
|
557
|
+
}
|
558
|
+
}
|
559
|
+
sbp.bra = sbp.cursor;
|
560
|
+
sbp.slice_del();
|
561
|
+
}
|
562
|
+
|
563
|
+
function r_stem_suffix_chain_before_ki() {
|
564
|
+
var v_1, v_2, v_3, v_4;
|
565
|
+
sbp.ket = sbp.cursor;
|
566
|
+
if (r_mark_ki()) {
|
567
|
+
v_1 = sbp.limit - sbp.cursor;
|
568
|
+
if (r_mark_DA()) {
|
569
|
+
sbp.bra = sbp.cursor;
|
570
|
+
sbp.slice_del();
|
571
|
+
v_2 = sbp.limit - sbp.cursor;
|
572
|
+
sbp.ket = sbp.cursor;
|
573
|
+
if (r_mark_lAr()) {
|
574
|
+
sbp.bra = sbp.cursor;
|
575
|
+
sbp.slice_del();
|
576
|
+
r_stem_suffix_chain_before_ki();
|
577
|
+
} else {
|
578
|
+
sbp.cursor = sbp.limit - v_2;
|
579
|
+
if (r_mark_possessives()) {
|
580
|
+
sbp.bra = sbp.cursor;
|
581
|
+
sbp.slice_del();
|
582
|
+
sbp.ket = sbp.cursor;
|
583
|
+
if (r_mark_lAr()) {
|
584
|
+
sbp.bra = sbp.cursor;
|
585
|
+
sbp.slice_del();
|
586
|
+
r_stem_suffix_chain_before_ki();
|
587
|
+
}
|
588
|
+
}
|
589
|
+
}
|
590
|
+
return true;
|
591
|
+
}
|
592
|
+
sbp.cursor = sbp.limit - v_1;
|
593
|
+
if (r_mark_nUn()) {
|
594
|
+
sbp.bra = sbp.cursor;
|
595
|
+
sbp.slice_del();
|
596
|
+
sbp.ket = sbp.cursor;
|
597
|
+
v_3 = sbp.limit - sbp.cursor;
|
598
|
+
if (r_mark_lArI()) {
|
599
|
+
sbp.bra = sbp.cursor;
|
600
|
+
sbp.slice_del();
|
601
|
+
} else {
|
602
|
+
sbp.cursor = sbp.limit - v_3;
|
603
|
+
sbp.ket = sbp.cursor;
|
604
|
+
if (!r_mark_possessives()) {
|
605
|
+
sbp.cursor = sbp.limit - v_3;
|
606
|
+
if (!r_mark_sU()) {
|
607
|
+
sbp.cursor = sbp.limit - v_3;
|
608
|
+
if (!r_stem_suffix_chain_before_ki())
|
609
|
+
return true;
|
610
|
+
}
|
611
|
+
}
|
612
|
+
sbp.bra = sbp.cursor;
|
613
|
+
sbp.slice_del();
|
614
|
+
sbp.ket = sbp.cursor;
|
615
|
+
if (r_mark_lAr()) {
|
616
|
+
sbp.bra = sbp.cursor;
|
617
|
+
sbp.slice_del();
|
618
|
+
r_stem_suffix_chain_before_ki()
|
619
|
+
}
|
620
|
+
}
|
621
|
+
return true;
|
622
|
+
}
|
623
|
+
sbp.cursor = sbp.limit - v_1;
|
624
|
+
if (r_mark_ndA()) {
|
625
|
+
v_4 = sbp.limit - sbp.cursor;
|
626
|
+
if (r_mark_lArI()) {
|
627
|
+
sbp.bra = sbp.cursor;
|
628
|
+
sbp.slice_del();
|
629
|
+
} else {
|
630
|
+
sbp.cursor = sbp.limit - v_4;
|
631
|
+
if (r_mark_sU()) {
|
632
|
+
sbp.bra = sbp.cursor;
|
633
|
+
sbp.slice_del();
|
634
|
+
sbp.ket = sbp.cursor;
|
635
|
+
if (r_mark_lAr()) {
|
636
|
+
sbp.bra = sbp.cursor;
|
637
|
+
sbp.slice_del();
|
638
|
+
r_stem_suffix_chain_before_ki();
|
639
|
+
}
|
640
|
+
} else {
|
641
|
+
sbp.cursor = sbp.limit - v_4;
|
642
|
+
if (!r_stem_suffix_chain_before_ki())
|
643
|
+
return false;
|
644
|
+
}
|
645
|
+
}
|
646
|
+
return true;
|
647
|
+
}
|
648
|
+
}
|
649
|
+
return false;
|
650
|
+
}
|
651
|
+
|
652
|
+
function habr9(v_1) {
|
653
|
+
sbp.ket = sbp.cursor;
|
654
|
+
if (!r_mark_ndA()) {
|
655
|
+
sbp.cursor = sbp.limit - v_1;
|
656
|
+
if (!r_mark_nA())
|
657
|
+
return false;
|
658
|
+
}
|
659
|
+
var v_2 = sbp.limit - sbp.cursor;
|
660
|
+
if (r_mark_lArI()) {
|
661
|
+
sbp.bra = sbp.cursor;
|
662
|
+
sbp.slice_del();
|
663
|
+
} else {
|
664
|
+
sbp.cursor = sbp.limit - v_2;
|
665
|
+
if (r_mark_sU()) {
|
666
|
+
sbp.bra = sbp.cursor;
|
667
|
+
sbp.slice_del();
|
668
|
+
sbp.ket = sbp.cursor;
|
669
|
+
if (r_mark_lAr()) {
|
670
|
+
sbp.bra = sbp.cursor;
|
671
|
+
sbp.slice_del();
|
672
|
+
r_stem_suffix_chain_before_ki();
|
673
|
+
}
|
674
|
+
} else {
|
675
|
+
sbp.cursor = sbp.limit - v_2;
|
676
|
+
if (!r_stem_suffix_chain_before_ki())
|
677
|
+
return false;
|
678
|
+
}
|
679
|
+
}
|
680
|
+
return true;
|
681
|
+
}
|
682
|
+
|
683
|
+
function habr10(v_1) {
|
684
|
+
sbp.ket = sbp.cursor;
|
685
|
+
if (!r_mark_ndAn()) {
|
686
|
+
sbp.cursor = sbp.limit - v_1;
|
687
|
+
if (!r_mark_nU())
|
688
|
+
return false;
|
689
|
+
}
|
690
|
+
var v_2 = sbp.limit - sbp.cursor;
|
691
|
+
if (!r_mark_sU()) {
|
692
|
+
sbp.cursor = sbp.limit - v_2;
|
693
|
+
if (!r_mark_lArI())
|
694
|
+
return false;
|
695
|
+
}
|
696
|
+
sbp.bra = sbp.cursor;
|
697
|
+
sbp.slice_del();
|
698
|
+
sbp.ket = sbp.cursor;
|
699
|
+
if (r_mark_lAr()) {
|
700
|
+
sbp.bra = sbp.cursor;
|
701
|
+
sbp.slice_del();
|
702
|
+
r_stem_suffix_chain_before_ki();
|
703
|
+
}
|
704
|
+
return true;
|
705
|
+
}
|
706
|
+
|
707
|
+
function habr11() {
|
708
|
+
var v_1 = sbp.limit - sbp.cursor,
|
709
|
+
v_2;
|
710
|
+
sbp.ket = sbp.cursor;
|
711
|
+
if (!r_mark_nUn()) {
|
712
|
+
sbp.cursor = sbp.limit - v_1;
|
713
|
+
if (!r_mark_ylA())
|
714
|
+
return false;
|
715
|
+
}
|
716
|
+
sbp.bra = sbp.cursor;
|
717
|
+
sbp.slice_del();
|
718
|
+
v_2 = sbp.limit - sbp.cursor;
|
719
|
+
sbp.ket = sbp.cursor;
|
720
|
+
if (r_mark_lAr()) {
|
721
|
+
sbp.bra = sbp.cursor;
|
722
|
+
sbp.slice_del();
|
723
|
+
if (r_stem_suffix_chain_before_ki())
|
724
|
+
return true;
|
725
|
+
}
|
726
|
+
sbp.cursor = sbp.limit - v_2;
|
727
|
+
sbp.ket = sbp.cursor;
|
728
|
+
if (!r_mark_possessives()) {
|
729
|
+
sbp.cursor = sbp.limit - v_2;
|
730
|
+
if (!r_mark_sU()) {
|
731
|
+
sbp.cursor = sbp.limit - v_2;
|
732
|
+
if (!r_stem_suffix_chain_before_ki())
|
733
|
+
return true;
|
734
|
+
}
|
735
|
+
}
|
736
|
+
sbp.bra = sbp.cursor;
|
737
|
+
sbp.slice_del();
|
738
|
+
sbp.ket = sbp.cursor;
|
739
|
+
if (r_mark_lAr()) {
|
740
|
+
sbp.bra = sbp.cursor;
|
741
|
+
sbp.slice_del();
|
742
|
+
r_stem_suffix_chain_before_ki();
|
743
|
+
}
|
744
|
+
return true;
|
745
|
+
}
|
746
|
+
|
747
|
+
function habr12() {
|
748
|
+
var v_1 = sbp.limit - sbp.cursor,
|
749
|
+
v_2, v_3;
|
750
|
+
sbp.ket = sbp.cursor;
|
751
|
+
if (!r_mark_DA()) {
|
752
|
+
sbp.cursor = sbp.limit - v_1;
|
753
|
+
if (!r_mark_yU()) {
|
754
|
+
sbp.cursor = sbp.limit - v_1;
|
755
|
+
if (!r_mark_yA())
|
756
|
+
return false;
|
757
|
+
}
|
758
|
+
}
|
759
|
+
sbp.bra = sbp.cursor;
|
760
|
+
sbp.slice_del();
|
761
|
+
sbp.ket = sbp.cursor;
|
762
|
+
v_2 = sbp.limit - sbp.cursor;
|
763
|
+
if (r_mark_possessives()) {
|
764
|
+
sbp.bra = sbp.cursor;
|
765
|
+
sbp.slice_del();
|
766
|
+
v_3 = sbp.limit - sbp.cursor;
|
767
|
+
sbp.ket = sbp.cursor;
|
768
|
+
if (!r_mark_lAr())
|
769
|
+
sbp.cursor = sbp.limit - v_3;
|
770
|
+
} else {
|
771
|
+
sbp.cursor = sbp.limit - v_2;
|
772
|
+
if (!r_mark_lAr())
|
773
|
+
return true;
|
774
|
+
}
|
775
|
+
sbp.bra = sbp.cursor;
|
776
|
+
sbp.slice_del();
|
777
|
+
sbp.ket = sbp.cursor;
|
778
|
+
r_stem_suffix_chain_before_ki();
|
779
|
+
return true;
|
780
|
+
}
|
781
|
+
|
782
|
+
function r_stem_noun_suffixes() {
|
783
|
+
var v_1 = sbp.limit - sbp.cursor,
|
784
|
+
v_2, v_3;
|
785
|
+
sbp.ket = sbp.cursor;
|
786
|
+
if (r_mark_lAr()) {
|
787
|
+
sbp.bra = sbp.cursor;
|
788
|
+
sbp.slice_del();
|
789
|
+
r_stem_suffix_chain_before_ki();
|
790
|
+
return;
|
791
|
+
}
|
792
|
+
sbp.cursor = sbp.limit - v_1;
|
793
|
+
sbp.ket = sbp.cursor;
|
794
|
+
if (r_mark_ncA()) {
|
795
|
+
sbp.bra = sbp.cursor;
|
796
|
+
sbp.slice_del();
|
797
|
+
v_2 = sbp.limit - sbp.cursor;
|
798
|
+
sbp.ket = sbp.cursor;
|
799
|
+
if (r_mark_lArI()) {
|
800
|
+
sbp.bra = sbp.cursor;
|
801
|
+
sbp.slice_del();
|
802
|
+
} else {
|
803
|
+
sbp.cursor = sbp.limit - v_2;
|
804
|
+
sbp.ket = sbp.cursor;
|
805
|
+
if (!r_mark_possessives()) {
|
806
|
+
sbp.cursor = sbp.limit - v_2;
|
807
|
+
if (!r_mark_sU()) {
|
808
|
+
sbp.cursor = sbp.limit - v_2;
|
809
|
+
sbp.ket = sbp.cursor;
|
810
|
+
if (!r_mark_lAr())
|
811
|
+
return;
|
812
|
+
sbp.bra = sbp.cursor;
|
813
|
+
sbp.slice_del();
|
814
|
+
if (!r_stem_suffix_chain_before_ki())
|
815
|
+
return;
|
816
|
+
}
|
817
|
+
}
|
818
|
+
sbp.bra = sbp.cursor;
|
819
|
+
sbp.slice_del();
|
820
|
+
sbp.ket = sbp.cursor;
|
821
|
+
if (r_mark_lAr()) {
|
822
|
+
sbp.bra = sbp.cursor;
|
823
|
+
sbp.slice_del();
|
824
|
+
r_stem_suffix_chain_before_ki();
|
825
|
+
}
|
826
|
+
}
|
827
|
+
return;
|
828
|
+
}
|
829
|
+
sbp.cursor = sbp.limit - v_1;
|
830
|
+
if (habr9(v_1))
|
831
|
+
return;
|
832
|
+
sbp.cursor = sbp.limit - v_1;
|
833
|
+
if (habr10(v_1))
|
834
|
+
return;
|
835
|
+
sbp.cursor = sbp.limit - v_1;
|
836
|
+
sbp.ket = sbp.cursor;
|
837
|
+
if (r_mark_DAn()) {
|
838
|
+
sbp.bra = sbp.cursor;
|
839
|
+
sbp.slice_del();
|
840
|
+
sbp.ket = sbp.cursor;
|
841
|
+
v_3 = sbp.limit - sbp.cursor;
|
842
|
+
if (r_mark_possessives()) {
|
843
|
+
sbp.bra = sbp.cursor;
|
844
|
+
sbp.slice_del();
|
845
|
+
sbp.ket = sbp.cursor;
|
846
|
+
if (r_mark_lAr()) {
|
847
|
+
sbp.bra = sbp.cursor;
|
848
|
+
sbp.slice_del();
|
849
|
+
r_stem_suffix_chain_before_ki();
|
850
|
+
}
|
851
|
+
} else {
|
852
|
+
sbp.cursor = sbp.limit - v_3;
|
853
|
+
if (r_mark_lAr()) {
|
854
|
+
sbp.bra = sbp.cursor;
|
855
|
+
sbp.slice_del();
|
856
|
+
r_stem_suffix_chain_before_ki();
|
857
|
+
} else {
|
858
|
+
sbp.cursor = sbp.limit - v_3;
|
859
|
+
r_stem_suffix_chain_before_ki();
|
860
|
+
}
|
861
|
+
}
|
862
|
+
return;
|
863
|
+
}
|
864
|
+
sbp.cursor = sbp.limit - v_1;
|
865
|
+
if (habr11())
|
866
|
+
return;
|
867
|
+
sbp.cursor = sbp.limit - v_1;
|
868
|
+
if (r_mark_lArI()) {
|
869
|
+
sbp.bra = sbp.cursor;
|
870
|
+
sbp.slice_del();
|
871
|
+
return;
|
872
|
+
}
|
873
|
+
sbp.cursor = sbp.limit - v_1;
|
874
|
+
if (r_stem_suffix_chain_before_ki())
|
875
|
+
return;
|
876
|
+
sbp.cursor = sbp.limit - v_1;
|
877
|
+
if (habr12())
|
878
|
+
return;
|
879
|
+
sbp.cursor = sbp.limit - v_1;
|
880
|
+
sbp.ket = sbp.cursor;
|
881
|
+
if (!r_mark_possessives()) {
|
882
|
+
sbp.cursor = sbp.limit - v_1;
|
883
|
+
if (!r_mark_sU())
|
884
|
+
return;
|
885
|
+
}
|
886
|
+
sbp.bra = sbp.cursor;
|
887
|
+
sbp.slice_del();
|
888
|
+
sbp.ket = sbp.cursor;
|
889
|
+
if (r_mark_lAr()) {
|
890
|
+
sbp.bra = sbp.cursor;
|
891
|
+
sbp.slice_del();
|
892
|
+
r_stem_suffix_chain_before_ki();
|
893
|
+
}
|
894
|
+
}
|
895
|
+
|
896
|
+
function r_post_process_last_consonants() {
|
897
|
+
var among_var;
|
898
|
+
sbp.ket = sbp.cursor;
|
899
|
+
among_var = sbp.find_among_b(a_23, 4);
|
900
|
+
if (among_var) {
|
901
|
+
sbp.bra = sbp.cursor;
|
902
|
+
switch (among_var) {
|
903
|
+
case 1:
|
904
|
+
sbp.slice_from("p");
|
905
|
+
break;
|
906
|
+
case 2:
|
907
|
+
sbp.slice_from("\u00E7");
|
908
|
+
break;
|
909
|
+
case 3:
|
910
|
+
sbp.slice_from("t");
|
911
|
+
break;
|
912
|
+
case 4:
|
913
|
+
sbp.slice_from("k");
|
914
|
+
break;
|
915
|
+
}
|
916
|
+
}
|
917
|
+
}
|
918
|
+
|
919
|
+
function habr13() {
|
920
|
+
while (true) {
|
921
|
+
var v_1 = sbp.limit - sbp.cursor;
|
922
|
+
if (sbp.in_grouping_b(g_vowel, 97, 305)) {
|
923
|
+
sbp.cursor = sbp.limit - v_1;
|
924
|
+
break;
|
925
|
+
}
|
926
|
+
sbp.cursor = sbp.limit - v_1;
|
927
|
+
if (sbp.cursor <= sbp.limit_backward)
|
928
|
+
return false;
|
929
|
+
sbp.cursor--;
|
930
|
+
}
|
931
|
+
return true;
|
932
|
+
}
|
933
|
+
|
934
|
+
function habr14(v_1, c1, c2) {
|
935
|
+
sbp.cursor = sbp.limit - v_1;
|
936
|
+
if (habr13()) {
|
937
|
+
var v_2 = sbp.limit - sbp.cursor;
|
938
|
+
if (!sbp.eq_s_b(1, c1)) {
|
939
|
+
sbp.cursor = sbp.limit - v_2;
|
940
|
+
if (!sbp.eq_s_b(1, c2))
|
941
|
+
return true;
|
942
|
+
}
|
943
|
+
sbp.cursor = sbp.limit - v_1;
|
944
|
+
var c = sbp.cursor;
|
945
|
+
sbp.insert(sbp.cursor, sbp.cursor, c2);
|
946
|
+
sbp.cursor = c;
|
947
|
+
return false;
|
948
|
+
}
|
949
|
+
return true;
|
950
|
+
}
|
951
|
+
|
952
|
+
function r_append_U_to_stems_ending_with_d_or_g() {
|
953
|
+
var v_1 = sbp.limit - sbp.cursor;
|
954
|
+
if (!sbp.eq_s_b(1, "d")) {
|
955
|
+
sbp.cursor = sbp.limit - v_1;
|
956
|
+
if (!sbp.eq_s_b(1, "g"))
|
957
|
+
return;
|
958
|
+
}
|
959
|
+
if (habr14(v_1, "a", "\u0131"))
|
960
|
+
if (habr14(v_1, "e", "i"))
|
961
|
+
if (habr14(v_1, "o", "u"))
|
962
|
+
habr14(v_1, "\u00F6", "\u00FC")
|
963
|
+
}
|
964
|
+
|
965
|
+
function r_more_than_one_syllable_word() {
|
966
|
+
var v_1 = sbp.cursor,
|
967
|
+
v_2 = 2,
|
968
|
+
v_3;
|
969
|
+
while (true) {
|
970
|
+
v_3 = sbp.cursor;
|
971
|
+
while (!sbp.in_grouping(g_vowel, 97, 305)) {
|
972
|
+
if (sbp.cursor >= sbp.limit) {
|
973
|
+
sbp.cursor = v_3;
|
974
|
+
if (v_2 > 0)
|
975
|
+
return false;
|
976
|
+
sbp.cursor = v_1;
|
977
|
+
return true;
|
978
|
+
}
|
979
|
+
sbp.cursor++;
|
980
|
+
}
|
981
|
+
v_2--;
|
982
|
+
}
|
983
|
+
}
|
984
|
+
|
985
|
+
function habr15(v_1, n1, c1) {
|
986
|
+
while (!sbp.eq_s(n1, c1)) {
|
987
|
+
if (sbp.cursor >= sbp.limit)
|
988
|
+
return true;
|
989
|
+
sbp.cursor++;
|
990
|
+
}
|
991
|
+
I_strlen = n1;
|
992
|
+
if (I_strlen != sbp.limit)
|
993
|
+
return true;
|
994
|
+
sbp.cursor = v_1;
|
995
|
+
return false;
|
996
|
+
}
|
997
|
+
|
998
|
+
function r_is_reserved_word() {
|
999
|
+
var v_1 = sbp.cursor;
|
1000
|
+
if (habr15(v_1, 2, "ad")) {
|
1001
|
+
sbp.cursor = v_1;
|
1002
|
+
if (habr15(v_1, 5, "soyad"))
|
1003
|
+
return false;
|
1004
|
+
}
|
1005
|
+
return true;
|
1006
|
+
}
|
1007
|
+
|
1008
|
+
function r_postlude() {
|
1009
|
+
var v_1 = sbp.cursor;
|
1010
|
+
if (r_is_reserved_word())
|
1011
|
+
return false;
|
1012
|
+
sbp.limit_backward = v_1;
|
1013
|
+
sbp.cursor = sbp.limit;
|
1014
|
+
r_append_U_to_stems_ending_with_d_or_g();
|
1015
|
+
sbp.cursor = sbp.limit;
|
1016
|
+
r_post_process_last_consonants();
|
1017
|
+
return true;
|
1018
|
+
}
|
1019
|
+
this.stem = function() {
|
1020
|
+
if (r_more_than_one_syllable_word()) {
|
1021
|
+
sbp.limit_backward = sbp.cursor;
|
1022
|
+
sbp.cursor = sbp.limit;
|
1023
|
+
r_stem_nominal_verb_suffixes();
|
1024
|
+
sbp.cursor = sbp.limit;
|
1025
|
+
if (B_c_s_n_s) {
|
1026
|
+
r_stem_noun_suffixes();
|
1027
|
+
sbp.cursor = sbp.limit_backward;
|
1028
|
+
if (r_postlude())
|
1029
|
+
return true;
|
1030
|
+
}
|
1031
|
+
}
|
1032
|
+
return false;
|
1033
|
+
}
|
1034
|
+
};
|
1035
|
+
|
1036
|
+
/* and return a function that stems a word for the current locale */
|
1037
|
+
return function(word) {
|
1038
|
+
st.setCurrent(word);
|
1039
|
+
st.stem();
|
1040
|
+
return st.getCurrent();
|
1041
|
+
}
|
1042
|
+
})();
|
1043
|
+
|
1044
|
+
lunr.Pipeline.registerFunction(lunr.tr.stemmer, 'stemmer-tr');
|
1045
|
+
|
1046
|
+
/* stop word filter function */
|
1047
|
+
lunr.tr.stopWordFilter = function(token) {
|
1048
|
+
if (lunr.tr.stopWordFilter.stopWords.indexOf(token) === -1) {
|
1049
|
+
return token;
|
1050
|
+
}
|
1051
|
+
};
|
1052
|
+
|
1053
|
+
lunr.tr.stopWordFilter.stopWords = new lunr.SortedSet();
|
1054
|
+
lunr.tr.stopWordFilter.stopWords.length = 210;
|
1055
|
+
|
1056
|
+
// The space at the beginning is crucial: It marks the empty string
|
1057
|
+
// as a stop word. lunr.js crashes during search when documents
|
1058
|
+
// processed by the pipeline still contain the empty string.
|
1059
|
+
lunr.tr.stopWordFilter.stopWords.elements = ' acaba altmış altı ama ancak arada aslında ayrıca bana bazı belki ben benden beni benim beri beş bile bin bir biri birkaç birkez birçok birşey birşeyi biz bizden bize bizi bizim bu buna bunda bundan bunlar bunları bunların bunu bunun burada böyle böylece da daha dahi de defa değil diye diğer doksan dokuz dolayı dolayısıyla dört edecek eden ederek edilecek ediliyor edilmesi ediyor elli en etmesi etti ettiği ettiğini eğer gibi göre halen hangi hatta hem henüz hep hepsi her herhangi herkesin hiç hiçbir iki ile ilgili ise itibaren itibariyle için işte kadar karşın katrilyon kendi kendilerine kendini kendisi kendisine kendisini kez ki kim kimden kime kimi kimse kırk milyar milyon mu mü mı nasıl ne neden nedenle nerde nerede nereye niye niçin o olan olarak oldu olduklarını olduğu olduğunu olmadı olmadığı olmak olması olmayan olmaz olsa olsun olup olur olursa oluyor on ona ondan onlar onlardan onları onların onu onun otuz oysa pek rağmen sadece sanki sekiz seksen sen senden seni senin siz sizden sizi sizin tarafından trilyon tüm var vardı ve veya ya yani yapacak yapmak yaptı yaptıkları yaptığı yaptığını yapılan yapılması yapıyor yedi yerine yetmiş yine yirmi yoksa yüz zaten çok çünkü öyle üzere üç şey şeyden şeyi şeyler şu şuna şunda şundan şunları şunu şöyle'.split(' ');
|
1060
|
+
|
1061
|
+
lunr.Pipeline.registerFunction(lunr.tr.stopWordFilter, 'stopWordFilter-tr');
|
1062
|
+
};
|
1063
|
+
}))
|