middleman-search-gds 0.11.0a

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,554 @@
1
+ /*!
2
+ * Lunr languages, `Hungarian` 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.hu = function() {
57
+ this.pipeline.reset();
58
+ this.pipeline.add(
59
+ lunr.hu.stopWordFilter,
60
+ lunr.hu.stemmer
61
+ );
62
+ };
63
+
64
+ /* lunr stemmer function */
65
+ lunr.hu.stemmer = (function() {
66
+ /* create the wrapped stemmer object */
67
+ var Among = lunr.stemmerSupport.Among,
68
+ SnowballProgram = lunr.stemmerSupport.SnowballProgram,
69
+ st = new function HungarianStemmer() {
70
+ var a_0 = [new Among("cs", -1, -1), new Among("dzs", -1, -1),
71
+ new Among("gy", -1, -1), new Among("ly", -1, -1),
72
+ new Among("ny", -1, -1), new Among("sz", -1, -1),
73
+ new Among("ty", -1, -1), new Among("zs", -1, -1)
74
+ ],
75
+ a_1 = [
76
+ new Among("\u00E1", -1, 1), new Among("\u00E9", -1, 2)
77
+ ],
78
+ a_2 = [
79
+ new Among("bb", -1, -1), new Among("cc", -1, -1),
80
+ new Among("dd", -1, -1), new Among("ff", -1, -1),
81
+ new Among("gg", -1, -1), new Among("jj", -1, -1),
82
+ new Among("kk", -1, -1), new Among("ll", -1, -1),
83
+ new Among("mm", -1, -1), new Among("nn", -1, -1),
84
+ new Among("pp", -1, -1), new Among("rr", -1, -1),
85
+ new Among("ccs", -1, -1), new Among("ss", -1, -1),
86
+ new Among("zzs", -1, -1), new Among("tt", -1, -1),
87
+ new Among("vv", -1, -1), new Among("ggy", -1, -1),
88
+ new Among("lly", -1, -1), new Among("nny", -1, -1),
89
+ new Among("tty", -1, -1), new Among("ssz", -1, -1),
90
+ new Among("zz", -1, -1)
91
+ ],
92
+ a_3 = [new Among("al", -1, 1),
93
+ new Among("el", -1, 2)
94
+ ],
95
+ a_4 = [new Among("ba", -1, -1),
96
+ new Among("ra", -1, -1), new Among("be", -1, -1),
97
+ new Among("re", -1, -1), new Among("ig", -1, -1),
98
+ new Among("nak", -1, -1), new Among("nek", -1, -1),
99
+ new Among("val", -1, -1), new Among("vel", -1, -1),
100
+ new Among("ul", -1, -1), new Among("n\u00E1l", -1, -1),
101
+ new Among("n\u00E9l", -1, -1), new Among("b\u00F3l", -1, -1),
102
+ new Among("r\u00F3l", -1, -1), new Among("t\u00F3l", -1, -1),
103
+ new Among("b\u00F5l", -1, -1), new Among("r\u00F5l", -1, -1),
104
+ new Among("t\u00F5l", -1, -1), new Among("\u00FCl", -1, -1),
105
+ new Among("n", -1, -1), new Among("an", 19, -1),
106
+ new Among("ban", 20, -1), new Among("en", 19, -1),
107
+ new Among("ben", 22, -1), new Among("k\u00E9ppen", 22, -1),
108
+ new Among("on", 19, -1), new Among("\u00F6n", 19, -1),
109
+ new Among("k\u00E9pp", -1, -1), new Among("kor", -1, -1),
110
+ new Among("t", -1, -1), new Among("at", 29, -1),
111
+ new Among("et", 29, -1), new Among("k\u00E9nt", 29, -1),
112
+ new Among("ank\u00E9nt", 32, -1), new Among("enk\u00E9nt", 32, -1),
113
+ new Among("onk\u00E9nt", 32, -1), new Among("ot", 29, -1),
114
+ new Among("\u00E9rt", 29, -1), new Among("\u00F6t", 29, -1),
115
+ new Among("hez", -1, -1), new Among("hoz", -1, -1),
116
+ new Among("h\u00F6z", -1, -1), new Among("v\u00E1", -1, -1),
117
+ new Among("v\u00E9", -1, -1)
118
+ ],
119
+ a_5 = [new Among("\u00E1n", -1, 2),
120
+ new Among("\u00E9n", -1, 1), new Among("\u00E1nk\u00E9nt", -1, 3)
121
+ ],
122
+ a_6 = [
123
+ new Among("stul", -1, 2), new Among("astul", 0, 1),
124
+ new Among("\u00E1stul", 0, 3), new Among("st\u00FCl", -1, 2),
125
+ new Among("est\u00FCl", 3, 1), new Among("\u00E9st\u00FCl", 3, 4)
126
+ ],
127
+ a_7 = [
128
+ new Among("\u00E1", -1, 1), new Among("\u00E9", -1, 2)
129
+ ],
130
+ a_8 = [
131
+ new Among("k", -1, 7), new Among("ak", 0, 4),
132
+ new Among("ek", 0, 6), new Among("ok", 0, 5),
133
+ new Among("\u00E1k", 0, 1), new Among("\u00E9k", 0, 2),
134
+ new Among("\u00F6k", 0, 3)
135
+ ],
136
+ a_9 = [new Among("\u00E9i", -1, 7),
137
+ new Among("\u00E1\u00E9i", 0, 6), new Among("\u00E9\u00E9i", 0, 5),
138
+ new Among("\u00E9", -1, 9), new Among("k\u00E9", 3, 4),
139
+ new Among("ak\u00E9", 4, 1), new Among("ek\u00E9", 4, 1),
140
+ new Among("ok\u00E9", 4, 1), new Among("\u00E1k\u00E9", 4, 3),
141
+ new Among("\u00E9k\u00E9", 4, 2), new Among("\u00F6k\u00E9", 4, 1),
142
+ new Among("\u00E9\u00E9", 3, 8)
143
+ ],
144
+ a_10 = [new Among("a", -1, 18),
145
+ new Among("ja", 0, 17), new Among("d", -1, 16),
146
+ new Among("ad", 2, 13), new Among("ed", 2, 13),
147
+ new Among("od", 2, 13), new Among("\u00E1d", 2, 14),
148
+ new Among("\u00E9d", 2, 15), new Among("\u00F6d", 2, 13),
149
+ new Among("e", -1, 18), new Among("je", 9, 17),
150
+ new Among("nk", -1, 4), new Among("unk", 11, 1),
151
+ new Among("\u00E1nk", 11, 2), new Among("\u00E9nk", 11, 3),
152
+ new Among("\u00FCnk", 11, 1), new Among("uk", -1, 8),
153
+ new Among("juk", 16, 7), new Among("\u00E1juk", 17, 5),
154
+ new Among("\u00FCk", -1, 8), new Among("j\u00FCk", 19, 7),
155
+ new Among("\u00E9j\u00FCk", 20, 6), new Among("m", -1, 12),
156
+ new Among("am", 22, 9), new Among("em", 22, 9),
157
+ new Among("om", 22, 9), new Among("\u00E1m", 22, 10),
158
+ new Among("\u00E9m", 22, 11), new Among("o", -1, 18),
159
+ new Among("\u00E1", -1, 19), new Among("\u00E9", -1, 20)
160
+ ],
161
+ a_11 = [
162
+ new Among("id", -1, 10), new Among("aid", 0, 9),
163
+ new Among("jaid", 1, 6), new Among("eid", 0, 9),
164
+ new Among("jeid", 3, 6), new Among("\u00E1id", 0, 7),
165
+ new Among("\u00E9id", 0, 8), new Among("i", -1, 15),
166
+ new Among("ai", 7, 14), new Among("jai", 8, 11),
167
+ new Among("ei", 7, 14), new Among("jei", 10, 11),
168
+ new Among("\u00E1i", 7, 12), new Among("\u00E9i", 7, 13),
169
+ new Among("itek", -1, 24), new Among("eitek", 14, 21),
170
+ new Among("jeitek", 15, 20), new Among("\u00E9itek", 14, 23),
171
+ new Among("ik", -1, 29), new Among("aik", 18, 26),
172
+ new Among("jaik", 19, 25), new Among("eik", 18, 26),
173
+ new Among("jeik", 21, 25), new Among("\u00E1ik", 18, 27),
174
+ new Among("\u00E9ik", 18, 28), new Among("ink", -1, 20),
175
+ new Among("aink", 25, 17), new Among("jaink", 26, 16),
176
+ new Among("eink", 25, 17), new Among("jeink", 28, 16),
177
+ new Among("\u00E1ink", 25, 18), new Among("\u00E9ink", 25, 19),
178
+ new Among("aitok", -1, 21), new Among("jaitok", 32, 20),
179
+ new Among("\u00E1itok", -1, 22), new Among("im", -1, 5),
180
+ new Among("aim", 35, 4), new Among("jaim", 36, 1),
181
+ new Among("eim", 35, 4), new Among("jeim", 38, 1),
182
+ new Among("\u00E1im", 35, 2), new Among("\u00E9im", 35, 3)
183
+ ],
184
+ g_v = [
185
+ 17, 65, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 17, 52, 14
186
+ ],
187
+ I_p1, sbp = new SnowballProgram();
188
+ this.setCurrent = function(word) {
189
+ sbp.setCurrent(word);
190
+ };
191
+ this.getCurrent = function() {
192
+ return sbp.getCurrent();
193
+ };
194
+
195
+ function r_mark_regions() {
196
+ var v_1 = sbp.cursor,
197
+ v_2;
198
+ I_p1 = sbp.limit;
199
+ if (sbp.in_grouping(g_v, 97, 252)) {
200
+ while (true) {
201
+ v_2 = sbp.cursor;
202
+ if (sbp.out_grouping(g_v, 97, 252)) {
203
+ sbp.cursor = v_2;
204
+ if (!sbp.find_among(a_0, 8)) {
205
+ sbp.cursor = v_2;
206
+ if (v_2 < sbp.limit)
207
+ sbp.cursor++;
208
+ }
209
+ I_p1 = sbp.cursor;
210
+ return;
211
+ }
212
+ sbp.cursor = v_2;
213
+ if (v_2 >= sbp.limit) {
214
+ I_p1 = v_2;
215
+ return;
216
+ }
217
+ sbp.cursor++;
218
+ }
219
+ }
220
+ sbp.cursor = v_1;
221
+ if (sbp.out_grouping(g_v, 97, 252)) {
222
+ while (!sbp.in_grouping(g_v, 97, 252)) {
223
+ if (sbp.cursor >= sbp.limit)
224
+ return;
225
+ sbp.cursor++;
226
+ }
227
+ I_p1 = sbp.cursor;
228
+ }
229
+ }
230
+
231
+ function r_R1() {
232
+ return I_p1 <= sbp.cursor;
233
+ }
234
+
235
+ function r_v_ending() {
236
+ var among_var;
237
+ sbp.ket = sbp.cursor;
238
+ among_var = sbp.find_among_b(a_1, 2);
239
+ if (among_var) {
240
+ sbp.bra = sbp.cursor;
241
+ if (r_R1()) {
242
+ switch (among_var) {
243
+ case 1:
244
+ sbp.slice_from("a");
245
+ break;
246
+ case 2:
247
+ sbp.slice_from("e");
248
+ break;
249
+ }
250
+ }
251
+ }
252
+ }
253
+
254
+ function r_double() {
255
+ var v_1 = sbp.limit - sbp.cursor;
256
+ if (!sbp.find_among_b(a_2, 23))
257
+ return false;
258
+ sbp.cursor = sbp.limit - v_1;
259
+ return true;
260
+ }
261
+
262
+ function r_undouble() {
263
+ if (sbp.cursor > sbp.limit_backward) {
264
+ sbp.cursor--;
265
+ sbp.ket = sbp.cursor;
266
+ var c = sbp.cursor - 1;
267
+ if (sbp.limit_backward <= c && c <= sbp.limit) {
268
+ sbp.cursor = c;
269
+ sbp.bra = c;
270
+ sbp.slice_del();
271
+ }
272
+ }
273
+ }
274
+
275
+ function r_instrum() {
276
+ var among_var;
277
+ sbp.ket = sbp.cursor;
278
+ among_var = sbp.find_among_b(a_3, 2);
279
+ if (among_var) {
280
+ sbp.bra = sbp.cursor;
281
+ if (r_R1()) {
282
+ if (among_var == 1 || among_var == 2)
283
+ if (!r_double())
284
+ return;
285
+ sbp.slice_del();
286
+ r_undouble();
287
+ }
288
+ }
289
+ }
290
+
291
+ function r_case() {
292
+ sbp.ket = sbp.cursor;
293
+ if (sbp.find_among_b(a_4, 44)) {
294
+ sbp.bra = sbp.cursor;
295
+ if (r_R1()) {
296
+ sbp.slice_del();
297
+ r_v_ending();
298
+ }
299
+ }
300
+ }
301
+
302
+ function r_case_special() {
303
+ var among_var;
304
+ sbp.ket = sbp.cursor;
305
+ among_var = sbp.find_among_b(a_5, 3);
306
+ if (among_var) {
307
+ sbp.bra = sbp.cursor;
308
+ if (r_R1()) {
309
+ switch (among_var) {
310
+ case 1:
311
+ sbp.slice_from("e");
312
+ break;
313
+ case 2:
314
+ case 3:
315
+ sbp.slice_from("a");
316
+ break;
317
+ }
318
+ }
319
+ }
320
+ }
321
+
322
+ function r_case_other() {
323
+ var among_var;
324
+ sbp.ket = sbp.cursor;
325
+ among_var = sbp.find_among_b(a_6, 6);
326
+ if (among_var) {
327
+ sbp.bra = sbp.cursor;
328
+ if (r_R1()) {
329
+ switch (among_var) {
330
+ case 1:
331
+ case 2:
332
+ sbp.slice_del();
333
+ break;
334
+ case 3:
335
+ sbp.slice_from("a");
336
+ break;
337
+ case 4:
338
+ sbp.slice_from("e");
339
+ break;
340
+ }
341
+ }
342
+ }
343
+ }
344
+
345
+ function r_factive() {
346
+ var among_var;
347
+ sbp.ket = sbp.cursor;
348
+ among_var = sbp.find_among_b(a_7, 2);
349
+ if (among_var) {
350
+ sbp.bra = sbp.cursor;
351
+ if (r_R1()) {
352
+ if (among_var == 1 || among_var == 2)
353
+ if (!r_double())
354
+ return;
355
+ sbp.slice_del();
356
+ r_undouble()
357
+ }
358
+ }
359
+ }
360
+
361
+ function r_plural() {
362
+ var among_var;
363
+ sbp.ket = sbp.cursor;
364
+ among_var = sbp.find_among_b(a_8, 7);
365
+ if (among_var) {
366
+ sbp.bra = sbp.cursor;
367
+ if (r_R1()) {
368
+ switch (among_var) {
369
+ case 1:
370
+ sbp.slice_from("a");
371
+ break;
372
+ case 2:
373
+ sbp.slice_from("e");
374
+ break;
375
+ case 3:
376
+ case 4:
377
+ case 5:
378
+ case 6:
379
+ case 7:
380
+ sbp.slice_del();
381
+ break;
382
+ }
383
+ }
384
+ }
385
+ }
386
+
387
+ function r_owned() {
388
+ var among_var;
389
+ sbp.ket = sbp.cursor;
390
+ among_var = sbp.find_among_b(a_9, 12);
391
+ if (among_var) {
392
+ sbp.bra = sbp.cursor;
393
+ if (r_R1()) {
394
+ switch (among_var) {
395
+ case 1:
396
+ case 4:
397
+ case 7:
398
+ case 9:
399
+ sbp.slice_del();
400
+ break;
401
+ case 2:
402
+ case 5:
403
+ case 8:
404
+ sbp.slice_from("e");
405
+ break;
406
+ case 3:
407
+ case 6:
408
+ sbp.slice_from("a");
409
+ break;
410
+ }
411
+ }
412
+ }
413
+ }
414
+
415
+ function r_sing_owner() {
416
+ var among_var;
417
+ sbp.ket = sbp.cursor;
418
+ among_var = sbp.find_among_b(a_10, 31);
419
+ if (among_var) {
420
+ sbp.bra = sbp.cursor;
421
+ if (r_R1()) {
422
+ switch (among_var) {
423
+ case 1:
424
+ case 4:
425
+ case 7:
426
+ case 8:
427
+ case 9:
428
+ case 12:
429
+ case 13:
430
+ case 16:
431
+ case 17:
432
+ case 18:
433
+ sbp.slice_del();
434
+ break;
435
+ case 2:
436
+ case 5:
437
+ case 10:
438
+ case 14:
439
+ case 19:
440
+ sbp.slice_from("a");
441
+ break;
442
+ case 3:
443
+ case 6:
444
+ case 11:
445
+ case 15:
446
+ case 20:
447
+ sbp.slice_from("e");
448
+ break;
449
+ }
450
+ }
451
+ }
452
+ }
453
+
454
+ function r_plur_owner() {
455
+ var among_var;
456
+ sbp.ket = sbp.cursor;
457
+ among_var = sbp.find_among_b(a_11, 42);
458
+ if (among_var) {
459
+ sbp.bra = sbp.cursor;
460
+ if (r_R1()) {
461
+ switch (among_var) {
462
+ case 1:
463
+ case 4:
464
+ case 5:
465
+ case 6:
466
+ case 9:
467
+ case 10:
468
+ case 11:
469
+ case 14:
470
+ case 15:
471
+ case 16:
472
+ case 17:
473
+ case 20:
474
+ case 21:
475
+ case 24:
476
+ case 25:
477
+ case 26:
478
+ case 29:
479
+ sbp.slice_del();
480
+ break;
481
+ case 2:
482
+ case 7:
483
+ case 12:
484
+ case 18:
485
+ case 22:
486
+ case 27:
487
+ sbp.slice_from("a");
488
+ break;
489
+ case 3:
490
+ case 8:
491
+ case 13:
492
+ case 19:
493
+ case 23:
494
+ case 28:
495
+ sbp.slice_from("e");
496
+ break;
497
+ }
498
+ }
499
+ }
500
+ }
501
+ this.stem = function() {
502
+ var v_1 = sbp.cursor;
503
+ r_mark_regions();
504
+ sbp.limit_backward = v_1;
505
+ sbp.cursor = sbp.limit;
506
+ r_instrum();
507
+ sbp.cursor = sbp.limit;
508
+ r_case();
509
+ sbp.cursor = sbp.limit;
510
+ r_case_special();
511
+ sbp.cursor = sbp.limit;
512
+ r_case_other();
513
+ sbp.cursor = sbp.limit;
514
+ r_factive();
515
+ sbp.cursor = sbp.limit;
516
+ r_owned();
517
+ sbp.cursor = sbp.limit;
518
+ r_sing_owner();
519
+ sbp.cursor = sbp.limit;
520
+ r_plur_owner();
521
+ sbp.cursor = sbp.limit;
522
+ r_plural();
523
+ return true;
524
+ }
525
+ };
526
+
527
+ /* and return a function that stems a word for the current locale */
528
+ return function(word) {
529
+ st.setCurrent(word);
530
+ st.stem();
531
+ return st.getCurrent();
532
+ }
533
+ })();
534
+
535
+ lunr.Pipeline.registerFunction(lunr.hu.stemmer, 'stemmer-hu');
536
+
537
+ /* stop word filter function */
538
+ lunr.hu.stopWordFilter = function(token) {
539
+ if (lunr.hu.stopWordFilter.stopWords.indexOf(token) === -1) {
540
+ return token;
541
+ }
542
+ };
543
+
544
+ lunr.hu.stopWordFilter.stopWords = new lunr.SortedSet();
545
+ lunr.hu.stopWordFilter.stopWords.length = 200;
546
+
547
+ // The space at the beginning is crucial: It marks the empty string
548
+ // as a stop word. lunr.js crashes during search when documents
549
+ // processed by the pipeline still contain the empty string.
550
+ lunr.hu.stopWordFilter.stopWords.elements = ' a abban ahhoz ahogy ahol aki akik akkor alatt amely amelyek amelyekben amelyeket amelyet amelynek ami amikor amit amolyan amíg annak arra arról az azok azon azonban azt aztán azután azzal azért be belül benne bár cikk cikkek cikkeket csak de e ebben eddig egy egyes egyetlen egyik egyre egyéb egész ehhez ekkor el ellen elsõ elég elõ elõször elõtt emilyen ennek erre ez ezek ezen ezt ezzel ezért fel felé hanem hiszen hogy hogyan igen ill ill. illetve ilyen ilyenkor ismét ison itt jobban jó jól kell kellett keressünk keresztül ki kívül között közül legalább legyen lehet lehetett lenne lenni lesz lett maga magát majd majd meg mellett mely melyek mert mi mikor milyen minden mindenki mindent mindig mint mintha mit mivel miért most már más másik még míg nagy nagyobb nagyon ne nekem neki nem nincs néha néhány nélkül olyan ott pedig persze rá s saját sem semmi sok sokat sokkal szemben szerint szinte számára talán tehát teljes tovább továbbá több ugyanis utolsó után utána vagy vagyis vagyok valaki valami valamint való van vannak vele vissza viszont volna volt voltak voltam voltunk által általában át én éppen és így õ õk õket össze úgy új újabb újra'.split(' ');
551
+
552
+ lunr.Pipeline.registerFunction(lunr.hu.stopWordFilter, 'stopWordFilter-hu');
553
+ };
554
+ }))