summaryrefslogtreecommitdiff
path: root/themes/CodeIT/assets/lib/lunr/lunr.es.js
blob: c71ff9a64da5c2572886c0fe1f924cc3e57a15fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
/*!
 * Lunr languages, `Spanish` language
 * https://github.com/MihaiValentin/lunr-languages
 *
 * Copyright 2014, Mihai Valentin
 * http://www.mozilla.org/MPL/
 */
/*!
 * based on
 * Snowball JavaScript Library v0.3
 * http://code.google.com/p/urim/
 * http://snowball.tartarus.org/
 *
 * Copyright 2010, Oleg Mazko
 * http://www.mozilla.org/MPL/
 */

/**
 * export the module via AMD, CommonJS or as a browser global
 * Export code from https://github.com/umdjs/umd/blob/master/returnExports.js
 */

(function (root, factory) {
  if (typeof define === "function" && define.amd) {
    // AMD. Register as an anonymous module.
    define(factory);
  } else if (typeof exports === "object") {
    /**
     * Node. Does not work with strict CommonJS, but
     * only CommonJS-like environments that support module.exports,
     * like Node.
     */
    module.exports = factory();
  } else {
    // Browser globals (root is window)
    factory()(root.lunr);
  }
})(this, function () {
  /**
   * Just return a value to define the module export.
   * This example returns an object, but the module
   * can return a function as the exported value.
   */
  return function (lunr) {
    /* throw error if lunr is not yet included */
    if ("undefined" === typeof lunr) {
      throw new Error(
        "Lunr is not present. Please include / require Lunr before this script."
      );
    }

    /* throw error if lunr stemmer support is not yet included */
    if ("undefined" === typeof lunr.stemmerSupport) {
      throw new Error(
        "Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script."
      );
    }

    /* register specific locale function */
    lunr.es = function () {
      this.pipeline.reset();
      this.pipeline.add(
        lunr.es.trimmer,
        lunr.es.stopWordFilter,
        lunr.es.stemmer
      );

      // for lunr version 2
      // this is necessary so that every searched word is also stemmed before
      // in lunr <= 1 this is not needed, as it is done using the normal pipeline
      if (this.searchPipeline) {
        this.searchPipeline.reset();
        this.searchPipeline.add(lunr.es.stemmer);
      }
    };

    /* lunr trimmer function */
    lunr.es.wordCharacters =
      "A-Za-z\xAA\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u02E0-\u02E4\u1D00-\u1D25\u1D2C-\u1D5C\u1D62-\u1D65\u1D6B-\u1D77\u1D79-\u1DBE\u1E00-\u1EFF\u2071\u207F\u2090-\u209C\u212A\u212B\u2132\u214E\u2160-\u2188\u2C60-\u2C7F\uA722-\uA787\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA7FF\uAB30-\uAB5A\uAB5C-\uAB64\uFB00-\uFB06\uFF21-\uFF3A\uFF41-\uFF5A";
    lunr.es.trimmer = lunr.trimmerSupport.generateTrimmer(
      lunr.es.wordCharacters
    );

    lunr.Pipeline.registerFunction(lunr.es.trimmer, "trimmer-es");

    /* lunr stemmer function */
    lunr.es.stemmer = (function () {
      /* create the wrapped stemmer object */
      var Among = lunr.stemmerSupport.Among,
        SnowballProgram = lunr.stemmerSupport.SnowballProgram,
        st = new (function SpanishStemmer() {
          var a_0 = [
              new Among("", -1, 6),
              new Among("\u00E1", 0, 1),
              new Among("\u00E9", 0, 2),
              new Among("\u00ED", 0, 3),
              new Among("\u00F3", 0, 4),
              new Among("\u00FA", 0, 5),
            ],
            a_1 = [
              new Among("la", -1, -1),
              new Among("sela", 0, -1),
              new Among("le", -1, -1),
              new Among("me", -1, -1),
              new Among("se", -1, -1),
              new Among("lo", -1, -1),
              new Among("selo", 5, -1),
              new Among("las", -1, -1),
              new Among("selas", 7, -1),
              new Among("les", -1, -1),
              new Among("los", -1, -1),
              new Among("selos", 10, -1),
              new Among("nos", -1, -1),
            ],
            a_2 = [
              new Among("ando", -1, 6),
              new Among("iendo", -1, 6),
              new Among("yendo", -1, 7),
              new Among("\u00E1ndo", -1, 2),
              new Among("i\u00E9ndo", -1, 1),
              new Among("ar", -1, 6),
              new Among("er", -1, 6),
              new Among("ir", -1, 6),
              new Among("\u00E1r", -1, 3),
              new Among("\u00E9r", -1, 4),
              new Among("\u00EDr", -1, 5),
            ],
            a_3 = [
              new Among("ic", -1, -1),
              new Among("ad", -1, -1),
              new Among("os", -1, -1),
              new Among("iv", -1, 1),
            ],
            a_4 = [
              new Among("able", -1, 1),
              new Among("ible", -1, 1),
              new Among("ante", -1, 1),
            ],
            a_5 = [
              new Among("ic", -1, 1),
              new Among("abil", -1, 1),
              new Among("iv", -1, 1),
            ],
            a_6 = [
              new Among("ica", -1, 1),
              new Among("ancia", -1, 2),
              new Among("encia", -1, 5),
              new Among("adora", -1, 2),
              new Among("osa", -1, 1),
              new Among("ista", -1, 1),
              new Among("iva", -1, 9),
              new Among("anza", -1, 1),
              new Among("log\u00EDa", -1, 3),
              new Among("idad", -1, 8),
              new Among("able", -1, 1),
              new Among("ible", -1, 1),
              new Among("ante", -1, 2),
              new Among("mente", -1, 7),
              new Among("amente", 13, 6),
              new Among("aci\u00F3n", -1, 2),
              new Among("uci\u00F3n", -1, 4),
              new Among("ico", -1, 1),
              new Among("ismo", -1, 1),
              new Among("oso", -1, 1),
              new Among("amiento", -1, 1),
              new Among("imiento", -1, 1),
              new Among("ivo", -1, 9),
              new Among("ador", -1, 2),
              new Among("icas", -1, 1),
              new Among("ancias", -1, 2),
              new Among("encias", -1, 5),
              new Among("adoras", -1, 2),
              new Among("osas", -1, 1),
              new Among("istas", -1, 1),
              new Among("ivas", -1, 9),
              new Among("anzas", -1, 1),
              new Among("log\u00EDas", -1, 3),
              new Among("idades", -1, 8),
              new Among("ables", -1, 1),
              new Among("ibles", -1, 1),
              new Among("aciones", -1, 2),
              new Among("uciones", -1, 4),
              new Among("adores", -1, 2),
              new Among("antes", -1, 2),
              new Among("icos", -1, 1),
              new Among("ismos", -1, 1),
              new Among("osos", -1, 1),
              new Among("amientos", -1, 1),
              new Among("imientos", -1, 1),
              new Among("ivos", -1, 9),
            ],
            a_7 = [
              new Among("ya", -1, 1),
              new Among("ye", -1, 1),
              new Among("yan", -1, 1),
              new Among("yen", -1, 1),
              new Among("yeron", -1, 1),
              new Among("yendo", -1, 1),
              new Among("yo", -1, 1),
              new Among("yas", -1, 1),
              new Among("yes", -1, 1),
              new Among("yais", -1, 1),
              new Among("yamos", -1, 1),
              new Among("y\u00F3", -1, 1),
            ],
            a_8 = [
              new Among("aba", -1, 2),
              new Among("ada", -1, 2),
              new Among("ida", -1, 2),
              new Among("ara", -1, 2),
              new Among("iera", -1, 2),
              new Among("\u00EDa", -1, 2),
              new Among("ar\u00EDa", 5, 2),
              new Among("er\u00EDa", 5, 2),
              new Among("ir\u00EDa", 5, 2),
              new Among("ad", -1, 2),
              new Among("ed", -1, 2),
              new Among("id", -1, 2),
              new Among("ase", -1, 2),
              new Among("iese", -1, 2),
              new Among("aste", -1, 2),
              new Among("iste", -1, 2),
              new Among("an", -1, 2),
              new Among("aban", 16, 2),
              new Among("aran", 16, 2),
              new Among("ieran", 16, 2),
              new Among("\u00EDan", 16, 2),
              new Among("ar\u00EDan", 20, 2),
              new Among("er\u00EDan", 20, 2),
              new Among("ir\u00EDan", 20, 2),
              new Among("en", -1, 1),
              new Among("asen", 24, 2),
              new Among("iesen", 24, 2),
              new Among("aron", -1, 2),
              new Among("ieron", -1, 2),
              new Among("ar\u00E1n", -1, 2),
              new Among("er\u00E1n", -1, 2),
              new Among("ir\u00E1n", -1, 2),
              new Among("ado", -1, 2),
              new Among("ido", -1, 2),
              new Among("ando", -1, 2),
              new Among("iendo", -1, 2),
              new Among("ar", -1, 2),
              new Among("er", -1, 2),
              new Among("ir", -1, 2),
              new Among("as", -1, 2),
              new Among("abas", 39, 2),
              new Among("adas", 39, 2),
              new Among("idas", 39, 2),
              new Among("aras", 39, 2),
              new Among("ieras", 39, 2),
              new Among("\u00EDas", 39, 2),
              new Among("ar\u00EDas", 45, 2),
              new Among("er\u00EDas", 45, 2),
              new Among("ir\u00EDas", 45, 2),
              new Among("es", -1, 1),
              new Among("ases", 49, 2),
              new Among("ieses", 49, 2),
              new Among("abais", -1, 2),
              new Among("arais", -1, 2),
              new Among("ierais", -1, 2),
              new Among("\u00EDais", -1, 2),
              new Among("ar\u00EDais", 55, 2),
              new Among("er\u00EDais", 55, 2),
              new Among("ir\u00EDais", 55, 2),
              new Among("aseis", -1, 2),
              new Among("ieseis", -1, 2),
              new Among("asteis", -1, 2),
              new Among("isteis", -1, 2),
              new Among("\u00E1is", -1, 2),
              new Among("\u00E9is", -1, 1),
              new Among("ar\u00E9is", 64, 2),
              new Among("er\u00E9is", 64, 2),
              new Among("ir\u00E9is", 64, 2),
              new Among("ados", -1, 2),
              new Among("idos", -1, 2),
              new Among("amos", -1, 2),
              new Among("\u00E1bamos", 70, 2),
              new Among("\u00E1ramos", 70, 2),
              new Among("i\u00E9ramos", 70, 2),
              new Among("\u00EDamos", 70, 2),
              new Among("ar\u00EDamos", 74, 2),
              new Among("er\u00EDamos", 74, 2),
              new Among("ir\u00EDamos", 74, 2),
              new Among("emos", -1, 1),
              new Among("aremos", 78, 2),
              new Among("eremos", 78, 2),
              new Among("iremos", 78, 2),
              new Among("\u00E1semos", 78, 2),
              new Among("i\u00E9semos", 78, 2),
              new Among("imos", -1, 2),
              new Among("ar\u00E1s", -1, 2),
              new Among("er\u00E1s", -1, 2),
              new Among("ir\u00E1s", -1, 2),
              new Among("\u00EDs", -1, 2),
              new Among("ar\u00E1", -1, 2),
              new Among("er\u00E1", -1, 2),
              new Among("ir\u00E1", -1, 2),
              new Among("ar\u00E9", -1, 2),
              new Among("er\u00E9", -1, 2),
              new Among("ir\u00E9", -1, 2),
              new Among("i\u00F3", -1, 2),
            ],
            a_9 = [
              new Among("a", -1, 1),
              new Among("e", -1, 2),
              new Among("o", -1, 1),
              new Among("os", -1, 1),
              new Among("\u00E1", -1, 1),
              new Among("\u00E9", -1, 2),
              new Among("\u00ED", -1, 1),
              new Among("\u00F3", -1, 1),
            ],
            g_v = [
              17,
              65,
              16,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              1,
              17,
              4,
              10,
            ],
            I_p2,
            I_p1,
            I_pV,
            sbp = new SnowballProgram();
          this.setCurrent = function (word) {
            sbp.setCurrent(word);
          };
          this.getCurrent = function () {
            return sbp.getCurrent();
          };

          function habr1() {
            if (sbp.out_grouping(g_v, 97, 252)) {
              while (!sbp.in_grouping(g_v, 97, 252)) {
                if (sbp.cursor >= sbp.limit) return true;
                sbp.cursor++;
              }
              return false;
            }
            return true;
          }

          function habr2() {
            if (sbp.in_grouping(g_v, 97, 252)) {
              var v_1 = sbp.cursor;
              if (habr1()) {
                sbp.cursor = v_1;
                if (!sbp.in_grouping(g_v, 97, 252)) return true;
                while (!sbp.out_grouping(g_v, 97, 252)) {
                  if (sbp.cursor >= sbp.limit) return true;
                  sbp.cursor++;
                }
              }
              return false;
            }
            return true;
          }

          function habr3() {
            var v_1 = sbp.cursor,
              v_2;
            if (habr2()) {
              sbp.cursor = v_1;
              if (!sbp.out_grouping(g_v, 97, 252)) return;
              v_2 = sbp.cursor;
              if (habr1()) {
                sbp.cursor = v_2;
                if (!sbp.in_grouping(g_v, 97, 252) || sbp.cursor >= sbp.limit)
                  return;
                sbp.cursor++;
              }
            }
            I_pV = sbp.cursor;
          }

          function habr4() {
            while (!sbp.in_grouping(g_v, 97, 252)) {
              if (sbp.cursor >= sbp.limit) return false;
              sbp.cursor++;
            }
            while (!sbp.out_grouping(g_v, 97, 252)) {
              if (sbp.cursor >= sbp.limit) return false;
              sbp.cursor++;
            }
            return true;
          }

          function r_mark_regions() {
            var v_1 = sbp.cursor;
            I_pV = sbp.limit;
            I_p1 = I_pV;
            I_p2 = I_pV;
            habr3();
            sbp.cursor = v_1;
            if (habr4()) {
              I_p1 = sbp.cursor;
              if (habr4()) I_p2 = sbp.cursor;
            }
          }

          function r_postlude() {
            var among_var;
            while (true) {
              sbp.bra = sbp.cursor;
              among_var = sbp.find_among(a_0, 6);
              if (among_var) {
                sbp.ket = sbp.cursor;
                switch (among_var) {
                  case 1:
                    sbp.slice_from("a");
                    continue;
                  case 2:
                    sbp.slice_from("e");
                    continue;
                  case 3:
                    sbp.slice_from("i");
                    continue;
                  case 4:
                    sbp.slice_from("o");
                    continue;
                  case 5:
                    sbp.slice_from("u");
                    continue;
                  case 6:
                    if (sbp.cursor >= sbp.limit) break;
                    sbp.cursor++;
                    continue;
                }
              }
              break;
            }
          }

          function r_RV() {
            return I_pV <= sbp.cursor;
          }

          function r_R1() {
            return I_p1 <= sbp.cursor;
          }

          function r_R2() {
            return I_p2 <= sbp.cursor;
          }

          function r_attached_pronoun() {
            var among_var;
            sbp.ket = sbp.cursor;
            if (sbp.find_among_b(a_1, 13)) {
              sbp.bra = sbp.cursor;
              among_var = sbp.find_among_b(a_2, 11);
              if (among_var && r_RV())
                switch (among_var) {
                  case 1:
                    sbp.bra = sbp.cursor;
                    sbp.slice_from("iendo");
                    break;
                  case 2:
                    sbp.bra = sbp.cursor;
                    sbp.slice_from("ando");
                    break;
                  case 3:
                    sbp.bra = sbp.cursor;
                    sbp.slice_from("ar");
                    break;
                  case 4:
                    sbp.bra = sbp.cursor;
                    sbp.slice_from("er");
                    break;
                  case 5:
                    sbp.bra = sbp.cursor;
                    sbp.slice_from("ir");
                    break;
                  case 6:
                    sbp.slice_del();
                    break;
                  case 7:
                    if (sbp.eq_s_b(1, "u")) sbp.slice_del();
                    break;
                }
            }
          }

          function habr5(a, n) {
            if (!r_R2()) return true;
            sbp.slice_del();
            sbp.ket = sbp.cursor;
            var among_var = sbp.find_among_b(a, n);
            if (among_var) {
              sbp.bra = sbp.cursor;
              if (among_var == 1 && r_R2()) sbp.slice_del();
            }
            return false;
          }

          function habr6(c1) {
            if (!r_R2()) return true;
            sbp.slice_del();
            sbp.ket = sbp.cursor;
            if (sbp.eq_s_b(2, c1)) {
              sbp.bra = sbp.cursor;
              if (r_R2()) sbp.slice_del();
            }
            return false;
          }

          function r_standard_suffix() {
            var among_var;
            sbp.ket = sbp.cursor;
            among_var = sbp.find_among_b(a_6, 46);
            if (among_var) {
              sbp.bra = sbp.cursor;
              switch (among_var) {
                case 1:
                  if (!r_R2()) return false;
                  sbp.slice_del();
                  break;
                case 2:
                  if (habr6("ic")) return false;
                  break;
                case 3:
                  if (!r_R2()) return false;
                  sbp.slice_from("log");
                  break;
                case 4:
                  if (!r_R2()) return false;
                  sbp.slice_from("u");
                  break;
                case 5:
                  if (!r_R2()) return false;
                  sbp.slice_from("ente");
                  break;
                case 6:
                  if (!r_R1()) return false;
                  sbp.slice_del();
                  sbp.ket = sbp.cursor;
                  among_var = sbp.find_among_b(a_3, 4);
                  if (among_var) {
                    sbp.bra = sbp.cursor;
                    if (r_R2()) {
                      sbp.slice_del();
                      if (among_var == 1) {
                        sbp.ket = sbp.cursor;
                        if (sbp.eq_s_b(2, "at")) {
                          sbp.bra = sbp.cursor;
                          if (r_R2()) sbp.slice_del();
                        }
                      }
                    }
                  }
                  break;
                case 7:
                  if (habr5(a_4, 3)) return false;
                  break;
                case 8:
                  if (habr5(a_5, 3)) return false;
                  break;
                case 9:
                  if (habr6("at")) return false;
                  break;
              }
              return true;
            }
            return false;
          }

          function r_y_verb_suffix() {
            var among_var, v_1;
            if (sbp.cursor >= I_pV) {
              v_1 = sbp.limit_backward;
              sbp.limit_backward = I_pV;
              sbp.ket = sbp.cursor;
              among_var = sbp.find_among_b(a_7, 12);
              sbp.limit_backward = v_1;
              if (among_var) {
                sbp.bra = sbp.cursor;
                if (among_var == 1) {
                  if (!sbp.eq_s_b(1, "u")) return false;
                  sbp.slice_del();
                }
                return true;
              }
            }
            return false;
          }

          function r_verb_suffix() {
            var among_var, v_1, v_2, v_3;
            if (sbp.cursor >= I_pV) {
              v_1 = sbp.limit_backward;
              sbp.limit_backward = I_pV;
              sbp.ket = sbp.cursor;
              among_var = sbp.find_among_b(a_8, 96);
              sbp.limit_backward = v_1;
              if (among_var) {
                sbp.bra = sbp.cursor;
                switch (among_var) {
                  case 1:
                    v_2 = sbp.limit - sbp.cursor;
                    if (sbp.eq_s_b(1, "u")) {
                      v_3 = sbp.limit - sbp.cursor;
                      if (sbp.eq_s_b(1, "g")) sbp.cursor = sbp.limit - v_3;
                      else sbp.cursor = sbp.limit - v_2;
                    } else sbp.cursor = sbp.limit - v_2;
                    sbp.bra = sbp.cursor;
                  case 2:
                    sbp.slice_del();
                    break;
                }
              }
            }
          }

          function r_residual_suffix() {
            var among_var, v_1;
            sbp.ket = sbp.cursor;
            among_var = sbp.find_among_b(a_9, 8);
            if (among_var) {
              sbp.bra = sbp.cursor;
              switch (among_var) {
                case 1:
                  if (r_RV()) sbp.slice_del();
                  break;
                case 2:
                  if (r_RV()) {
                    sbp.slice_del();
                    sbp.ket = sbp.cursor;
                    if (sbp.eq_s_b(1, "u")) {
                      sbp.bra = sbp.cursor;
                      v_1 = sbp.limit - sbp.cursor;
                      if (sbp.eq_s_b(1, "g")) {
                        sbp.cursor = sbp.limit - v_1;
                        if (r_RV()) sbp.slice_del();
                      }
                    }
                  }
                  break;
              }
            }
          }
          this.stem = function () {
            var v_1 = sbp.cursor;
            r_mark_regions();
            sbp.limit_backward = v_1;
            sbp.cursor = sbp.limit;
            r_attached_pronoun();
            sbp.cursor = sbp.limit;
            if (!r_standard_suffix()) {
              sbp.cursor = sbp.limit;
              if (!r_y_verb_suffix()) {
                sbp.cursor = sbp.limit;
                r_verb_suffix();
              }
            }
            sbp.cursor = sbp.limit;
            r_residual_suffix();
            sbp.cursor = sbp.limit_backward;
            r_postlude();
            return true;
          };
        })();

      /* and return a function that stems a word for the current locale */
      return function (token) {
        // for lunr version 2
        if (typeof token.update === "function") {
          return token.update(function (word) {
            st.setCurrent(word);
            st.stem();
            return st.getCurrent();
          });
        } else {
          // for lunr version <= 1
          st.setCurrent(token);
          st.stem();
          return st.getCurrent();
        }
      };
    })();

    lunr.Pipeline.registerFunction(lunr.es.stemmer, "stemmer-es");

    lunr.es.stopWordFilter = lunr.generateStopWordFilter(
      "a al algo algunas algunos ante antes como con contra cual cuando de del desde donde durante e el ella ellas ellos en entre era erais eran eras eres es esa esas ese eso esos esta estaba estabais estaban estabas estad estada estadas estado estados estamos estando estar estaremos estará estarán estarás estaré estaréis estaría estaríais estaríamos estarían estarías estas este estemos esto estos estoy estuve estuviera estuvierais estuvieran estuvieras estuvieron estuviese estuvieseis estuviesen estuvieses estuvimos estuviste estuvisteis estuviéramos estuviésemos estuvo está estábamos estáis están estás esté estéis estén estés fue fuera fuerais fueran fueras fueron fuese fueseis fuesen fueses fui fuimos fuiste fuisteis fuéramos fuésemos ha habida habidas habido habidos habiendo habremos habrá habrán habrás habré habréis habría habríais habríamos habrían habrías habéis había habíais habíamos habían habías han has hasta hay haya hayamos hayan hayas hayáis he hemos hube hubiera hubierais hubieran hubieras hubieron hubiese hubieseis hubiesen hubieses hubimos hubiste hubisteis hubiéramos hubiésemos hubo la las le les lo los me mi mis mucho muchos muy más mí mía mías mío míos nada ni no nos nosotras nosotros nuestra nuestras nuestro nuestros o os otra otras otro otros para pero poco por porque que quien quienes qué se sea seamos sean seas seremos será serán serás seré seréis sería seríais seríamos serían serías seáis sido siendo sin sobre sois somos son soy su sus suya suyas suyo suyos sí también tanto te tendremos tendrá tendrán tendrás tendré tendréis tendría tendríais tendríamos tendrían tendrías tened tenemos tenga tengamos tengan tengas tengo tengáis tenida tenidas tenido tenidos teniendo tenéis tenía teníais teníamos tenían tenías ti tiene tienen tienes todo todos tu tus tuve tuviera tuvierais tuvieran tuvieras tuvieron tuviese tuvieseis tuviesen tuvieses tuvimos tuviste tuvisteis tuviéramos tuviésemos tuvo tuya tuyas tuyo tuyos tú un una uno unos vosotras vosotros vuestra vuestras vuestro vuestros y ya yo él éramos".split(
        " "
      )
    );

    lunr.Pipeline.registerFunction(lunr.es.stopWordFilter, "stopWordFilter-es");
  };
});