PageSourceSearch

https://snowdrama.net/js/lunr.pt.js

js snowdrama.net collected 2026-10-05 03:08:07 UTC 22,031 bytes, 566 lines download raw bytes

1/*!
2 * Lunr languages, `Portuguese` 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.pt = function() {
57      this.pipeline.reset();
58      this.pipeline.add(
59        lunr.pt.trimmer,
60        lunr.pt.stopWordFilter,
61        lunr.pt.stemmer
62      );
vendor: 18,090 bytes, lines 62-540
62
63    };
64
65    /* lunr trimmer function */
66    lunr.pt.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";
67    lunr.pt.trimmer = lunr.trimmerSupport.generateTrimmer(lunr.pt.wordCharacters);
68
69    lunr.Pipeline.registerFunction(lunr.pt.trimmer, 'trimmer-pt');
70
71    /* lunr stemmer function */
72    lunr.pt.stemmer = (function() {
73      /* create the wrapped stemmer object */
74      var Among = lunr.stemmerSupport.Among,
75        SnowballProgram = lunr.stemmerSupport.SnowballProgram,
76        st = new function PortugueseStemmer() {
77          var a_0 = [new Among("", -1, 3), new Among("\u00E3", 0, 1),
78              new Among("\u00F5", 0, 2)
79            ],
80            a_1 = [new Among("", -1, 3),
81              new Among("a~", 0, 1), new Among("o~", 0, 2)
82            ],
83            a_2 = [
84              new Among("ic", -1, -1), new Among("ad", -1, -1),
85              new Among("os", -1, -1), new Among("iv", -1, 1)
86            ],
87            a_3 = [
88              new Among("ante", -1, 1), new Among("avel", -1, 1),
89              new Among("\u00EDvel", -1, 1)
90            ],
91            a_4 = [new Among("ic", -1, 1),
92              new Among("abil", -1, 1), new Among("iv", -1, 1)
93            ],
94            a_5 = [
95              new Among("ica", -1, 1), new Among("\u00E2ncia", -1, 1),
96              new Among("\u00EAncia", -1, 4), new Among("ira", -1, 9),
97              new Among("adora", -1, 1), new Among("osa", -1, 1),
98              new Among("ista", -1, 1), new Among("iva", -1, 8),
99              new Among("eza", -1, 1), new Among("log\u00EDa", -1, 2),
100              new Among("idade", -1, 7), new Among("ante", -1, 1),
101              new Among("mente", -1, 6), new Among("amente", 12, 5),
102              new Among("\u00E1vel", -1, 1), new Among("\u00EDvel", -1, 1),
103              new Among("uci\u00F3n", -1, 3), new Among("ico", -1, 1),
104              new Among("ismo", -1, 1), new Among("oso", -1, 1),
105              new Among("amento", -1, 1), new Among("imento", -1, 1),
106              new Among("ivo", -1, 8), new Among("a\u00E7a~o", -1, 1),
107              new Among("ador", -1, 1), new Among("icas", -1, 1),
108              new Among("\u00EAncias", -1, 4), new Among("iras", -1, 9),
109              new Among("adoras", -1, 1), new Among("osas", -1, 1),
110              new Among("istas", -1, 1), new Among("ivas", -1, 8),
111              new Among("ezas", -1, 1), new Among("log\u00EDas", -1, 2),
112              new Among("idades", -1, 7), new Among("uciones", -1, 3),
113              new Among("adores", -1, 1), new Among("antes", -1, 1),
114              new Among("a\u00E7o~es", -1, 1), new Among("icos", -1, 1),
115              new Among("ismos", -1, 1), new Among("osos", -1, 1),
116              new Among("amentos", -1, 1), new Among("imentos", -1, 1),
117              new Among("ivos", -1, 8)
118            ],
119            a_6 = [new Among("ada", -1, 1),
120              new Among("ida", -1, 1), new Among("ia", -1, 1),
121              new Among("aria", 2, 1), new Among("eria", 2, 1),
122              new Among("iria", 2, 1), new Among("ara", -1, 1),
123              new Among("era", -1, 1), new Among("ira", -1, 1),
124              new Among("ava", -1, 1), new Among("asse", -1, 1),
125              new Among("esse", -1, 1), new Among("isse", -1, 1),
126              new Among("aste", -1, 1), new Among("este", -1, 1),
127              new Among("iste", -1, 1), new Among("ei", -1, 1),
128              new Among("arei", 16, 1), new Among("erei", 16, 1),
129              new Among("irei", 16, 1), new Among("am", -1, 1),
130              new Among("iam", 20, 1), new Among("ariam", 21, 1),
131              new Among("eriam", 21, 1), new Among("iriam", 21, 1),
132              new Among("aram", 20, 1), new Among("eram", 20, 1),
133              new Among("iram", 20, 1), new Among("avam", 20, 1),
134              new Among("em", -1, 1), new Among("arem", 29, 1),
135              new Among("erem", 29, 1), new Among("irem", 29, 1),
136              new Among("assem", 29, 1), new Among("essem", 29, 1),
137              new Among("issem", 29, 1), new Among("ado", -1, 1),
138              new Among("ido", -1, 1), new Among("ando", -1, 1),
139              new Among("endo", -1, 1), new Among("indo", -1, 1),
140              new Among("ara~o", -1, 1), new Among("era~o", -1, 1),
141              new Among("ira~o", -1, 1), new Among("ar", -1, 1),
142              new Among("er", -1, 1), new Among("ir", -1, 1),
143              new Among("as", -1, 1), new Among("adas", 47, 1),
144              new Among("idas", 47, 1), new Among("ias", 47, 1),
145              new Among("arias", 50, 1), new Among("erias", 50, 1),
146              new Among("irias", 50, 1), new Among("aras", 47, 1),
147              new Among("eras", 47, 1), new Among("iras", 47, 1),
148              new Among("avas", 47, 1), new Among("es", -1, 1),
149              new Among("ardes", 58, 1), new Among("erdes", 58, 1),
150              new Among("irdes", 58, 1), new Among("ares", 58, 1),
151              new Among("eres", 58, 1), new Among("ires", 58, 1),
152              new Among("asses", 58, 1), new Among("esses", 58, 1),
153              new Among("isses", 58, 1), new Among("astes", 58, 1),
154              new Among("estes", 58, 1), new Among("istes", 58, 1),
155              new Among("is", -1, 1), new Among("ais", 71, 1),
156              new Among("eis", 71, 1), new Among("areis", 73, 1),
157              new Among("ereis", 73, 1), new Among("ireis", 73, 1),
158              new Among("\u00E1reis", 73, 1), new Among("\u00E9reis", 73, 1),
159              new Among("\u00EDreis", 73, 1), new Among("\u00E1sseis", 73, 1),
160              new Among("\u00E9sseis", 73, 1), new Among("\u00EDsseis", 73, 1),
161              new Among("\u00E1veis", 73, 1), new Among("\u00EDeis", 73, 1),
162              new Among("ar\u00EDeis", 84, 1), new Among("er\u00EDeis", 84, 1),
163              new Among("ir\u00EDeis", 84, 1), new Among("ados", -1, 1),
164              new Among("idos", -1, 1), new Among("amos", -1, 1),
165              new Among("\u00E1ramos", 90, 1), new Among("\u00E9ramos", 90, 1),
166              new Among("\u00EDramos", 90, 1), new Among("\u00E1vamos", 90, 1),
167              new Among("\u00EDamos", 90, 1), new Among("ar\u00EDamos", 95, 1),
168              new Among("er\u00EDamos", 95, 1), new Among("ir\u00EDamos", 95, 1),
169              new Among("emos", -1, 1), new Among("aremos", 99, 1),
170              new Among("eremos", 99, 1), new Among("iremos", 99, 1),
171              new Among("\u00E1ssemos", 99, 1), new Among("\u00EAssemos", 99, 1),
172              new Among("\u00EDssemos", 99, 1), new Among("imos", -1, 1),
173              new Among("armos", -1, 1), new Among("ermos", -1, 1),
174              new Among("irmos", -1, 1), new Among("\u00E1mos", -1, 1),
175              new Among("ar\u00E1s", -1, 1), new Among("er\u00E1s", -1, 1),
176              new Among("ir\u00E1s", -1, 1), new Among("eu", -1, 1),
177              new Among("iu", -1, 1), new Among("ou", -1, 1),
178              new Among("ar\u00E1", -1, 1), new Among("er\u00E1", -1, 1),
179              new Among("ir\u00E1", -1, 1)
180            ],
181            a_7 = [new Among("a", -1, 1),
182              new Among("i", -1, 1), new Among("o", -1, 1),
183              new Among("os", -1, 1), new Among("\u00E1", -1, 1),
184              new Among("\u00ED", -1, 1), new Among("\u00F3", -1, 1)
185            ],
186            a_8 = [
187              new Among("e", -1, 1), new Among("\u00E7", -1, 2),
188              new Among("\u00E9", -1, 1), new Among("\u00EA", -1, 1)
189            ],
190            g_v = [17,
191              65, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 19, 12, 2
192            ],
193            I_p2, I_p1, I_pV, sbp = new SnowballProgram();
194          this.setCurrent = function(word) {
195            sbp.setCurrent(word);
196          };
197          this.getCurrent = function() {
198            return sbp.getCurrent();
199          };
200
201          function r_prelude() {
202            var among_var;
203            while (true) {
204              sbp.bra = sbp.cursor;
205              among_var = sbp.find_among(a_0, 3);
206              if (among_var) {
207                sbp.ket = sbp.cursor;
208                switch (among_var) {
209                  case 1:
210                    sbp.slice_from("a~");
211                    continue;
212                  case 2:
213                    sbp.slice_from("o~");
214                    continue;
215                  case 3:
216                    if (sbp.cursor >= sbp.limit)
217                      break;
218                    sbp.cursor++;
219                    continue;
220                }
221              }
222              break;
223            }
224          }
225
226          function habr2() {
227            if (sbp.out_grouping(g_v, 97, 250)) {
228              while (!sbp.in_grouping(g_v, 97, 250)) {
229                if (sbp.cursor >= sbp.limit)
230                  return true;
231                sbp.cursor++;
232              }
233              return false;
234            }
235            return true;
236          }
237
238          function habr3() {
239            if (sbp.in_grouping(g_v, 97, 250)) {
240              while (!sbp.out_grouping(g_v, 97, 250)) {
241                if (sbp.cursor >= sbp.limit)
242                  return false;
243                sbp.cursor++;
244              }
245            }
246            I_pV = sbp.cursor;
247            return true;
248          }
249
250          function habr4() {
251            var v_1 = sbp.cursor,
252              v_2, v_3;
253            if (sbp.in_grouping(g_v, 97, 250)) {
254              v_2 = sbp.cursor;
255              if (habr2()) {
256                sbp.cursor = v_2;
257                if (habr3())
258                  return;
259              } else
260                I_pV = sbp.cursor;
261            }
262            sbp.cursor = v_1;
263            if (sbp.out_grouping(g_v, 97, 250)) {
264              v_3 = sbp.cursor;
265              if (habr2()) {
266                sbp.cursor = v_3;
267                if (!sbp.in_grouping(g_v, 97, 250) || sbp.cursor >= sbp.limit)
268                  return;
269                sbp.cursor++;
270              }
271              I_pV = sbp.cursor;
272            }
273          }
274
275          function habr5() {
276            while (!sbp.in_grouping(g_v, 97, 250)) {
277              if (sbp.cursor >= sbp.limit)
278                return false;
279              sbp.cursor++;
280            }
281            while (!sbp.out_grouping(g_v, 97, 250)) {
282              if (sbp.cursor >= sbp.limit)
283                return false;
284              sbp.cursor++;
285            }
286            return true;
287          }
288
289          function r_mark_regions() {
290            var v_1 = sbp.cursor;
291            I_pV = sbp.limit;
292            I_p1 = I_pV;
293            I_p2 = I_pV;
294            habr4();
295            sbp.cursor = v_1;
296            if (habr5()) {
297              I_p1 = sbp.cursor;
298              if (habr5())
299                I_p2 = sbp.cursor;
300            }
301          }
302
303          function r_postlude() {
304            var among_var;
305            while (true) {
306              sbp.bra = sbp.cursor;
307              among_var = sbp.find_among(a_1, 3);
308              if (among_var) {
309                sbp.ket = sbp.cursor;
310                switch (among_var) {
311                  case 1:
312                    sbp.slice_from("\u00E3");
313                    continue;
314                  case 2:
315                    sbp.slice_from("\u00F5");
316                    continue;
317                  case 3:
318                    if (sbp.cursor >= sbp.limit)
319                      break;
320                    sbp.cursor++;
321                    continue;
322                }
323              }
324              break;
325            }
326          }
327
328          function r_RV() {
329            return I_pV <= sbp.cursor;
330          }
331
332          function r_R1() {
333            return I_p1 <= sbp.cursor;
334          }
335
336          function r_R2() {
337            return I_p2 <= sbp.cursor;
338          }
339
340          function r_standard_suffix() {
341            var among_var;
342            sbp.ket = sbp.cursor;
343            among_var = sbp.find_among_b(a_5, 45);
344            if (!among_var)
345              return false;
346            sbp.bra = sbp.cursor;
347            switch (among_var) {
348              case 1:
349                if (!r_R2())
350                  return false;
351                sbp.slice_del();
352                break;
353              case 2:
354                if (!r_R2())
355                  return false;
356                sbp.slice_from("log");
357                break;
358              case 3:
359                if (!r_R2())
360                  return false;
361                sbp.slice_from("u");
362                break;
363              case 4:
364                if (!r_R2())
365                  return false;
366                sbp.slice_from("ente");
367                break;
368              case 5:
369                if (!r_R1())
370                  return false;
371                sbp.slice_del();
372                sbp.ket = sbp.cursor;
373                among_var = sbp.find_among_b(a_2, 4);
374                if (among_var) {
375                  sbp.bra = sbp.cursor;
376                  if (r_R2()) {
377                    sbp.slice_del();
378                    if (among_var == 1) {
379                      sbp.ket = sbp.cursor;
380                      if (sbp.eq_s_b(2, "at")) {
381                        sbp.bra = sbp.cursor;
382                        if (r_R2())
383                          sbp.slice_del();
384                      }
385                    }
386                  }
387                }
388                break;
389              case 6:
390                if (!r_R2())
391                  return false;
392                sbp.slice_del();
393                sbp.ket = sbp.cursor;
394                among_var = sbp.find_among_b(a_3, 3);
395                if (among_var) {
396                  sbp.bra = sbp.cursor;
397                  if (among_var == 1)
398                    if (r_R2())
399                      sbp.slice_del();
400                }
401                break;
402              case 7:
403                if (!r_R2())
404                  return false;
405                sbp.slice_del();
406                sbp.ket = sbp.cursor;
407                among_var = sbp.find_among_b(a_4, 3);
408                if (among_var) {
409                  sbp.bra = sbp.cursor;
410                  if (among_var == 1)
411                    if (r_R2())
412                      sbp.slice_del();
413                }
414                break;
415              case 8:
416                if (!r_R2())
417                  return false;
418                sbp.slice_del();
419                sbp.ket = sbp.cursor;
420                if (sbp.eq_s_b(2, "at")) {
421                  sbp.bra = sbp.cursor;
422                  if (r_R2())
423                    sbp.slice_del();
424                }
425                break;
426              case 9:
427                if (!r_RV() || !sbp.eq_s_b(1, "e"))
428                  return false;
429                sbp.slice_from("ir");
430                break;
431            }
432            return true;
433          }
434
435          function r_verb_suffix() {
436            var among_var, v_1;
437            if (sbp.cursor >= I_pV) {
438              v_1 = sbp.limit_backward;
439              sbp.limit_backward = I_pV;
440              sbp.ket = sbp.cursor;
441              among_var = sbp.find_among_b(a_6, 120);
442              if (among_var) {
443                sbp.bra = sbp.cursor;
444                if (among_var == 1)
445                  sbp.slice_del();
446                sbp.limit_backward = v_1;
447                return true;
448              }
449              sbp.limit_backward = v_1;
450            }
451            return false;
452          }
453
454          function r_residual_suffix() {
455            var among_var;
456            sbp.ket = sbp.cursor;
457            among_var = sbp.find_among_b(a_7, 7);
458            if (among_var) {
459              sbp.bra = sbp.cursor;
460              if (among_var == 1)
461                if (r_RV())
462                  sbp.slice_del();
463            }
464          }
465
466          function habr6(c1, c2) {
467            if (sbp.eq_s_b(1, c1)) {
468              sbp.bra = sbp.cursor;
469              var v_1 = sbp.limit - sbp.cursor;
470              if (sbp.eq_s_b(1, c2)) {
471                sbp.cursor = sbp.limit - v_1;
472                if (r_RV())
473                  sbp.slice_del();
474                return false;
475              }
476            }
477            return true;
478          }
479
480          function r_residual_form() {
481            var among_var, v_1, v_2, v_3;
482            sbp.ket = sbp.cursor;
483            among_var = sbp.find_among_b(a_8, 4);
484            if (among_var) {
485              sbp.bra = sbp.cursor;
486              switch (among_var) {
487                case 1:
488                  if (r_RV()) {
489                    sbp.slice_del();
490                    sbp.ket = sbp.cursor;
491                    v_1 = sbp.limit - sbp.cursor;
492                    if (habr6("u", "g"))
493                      habr6("i", "c")
494                  }
495                  break;
496                case 2:
497                  sbp.slice_from("c");
498                  break;
499              }
500            }
501          }
502
503          function habr1() {
504            if (!r_standard_suffix()) {
505              sbp.cursor = sbp.limit;
506              if (!r_verb_suffix()) {
507                sbp.cursor = sbp.limit;
508                r_residual_suffix();
509                return;
510              }
511            }
512            sbp.cursor = sbp.limit;
513            sbp.ket = sbp.cursor;
514            if (sbp.eq_s_b(1, "i")) {
515              sbp.bra = sbp.cursor;
516              if (sbp.eq_s_b(1, "c")) {
517                sbp.cursor = sbp.limit;
518                if (r_RV())
519                  sbp.slice_del();
520              }
521            }
522          }
523          this.stem = function() {
524            var v_1 = sbp.cursor;
525            r_prelude();
526            sbp.cursor = v_1;
527            r_mark_regions();
528            sbp.limit_backward = v_1;
529            sbp.cursor = sbp.limit;
530            habr1();
531            sbp.cursor = sbp.limit;
532            r_residual_form();
533            sbp.cursor = sbp.limit_backward;
534            r_postlude();
535            return true;
536          }
537        };
538
539      /* and return a function that stems a word for the current locale */
540      return function(
540word) {
541        st.setCurrent(word);
542        st.stem();
543        return st.getCurrent();
544      }
545    })();
546
547    lunr.Pipeline.registerFunction(lunr.pt.stemmer, 'stemmer-pt');
548
549    /* stop word filter function */
550    lunr.pt.stopWordFilter = function(token) {
551      if (lunr.pt.stopWordFilter.stopWords.indexOf(token) === -1) {
552        return token;
553      }
554    };
555
556    lunr.pt.stopWordFilter.stopWords = new lunr.SortedSet();
557    lunr.pt.stopWordFilter.stopWords.length = 204;
558
559    // The space at the beginning is crucial: It marks the empty string
560    // as a stop word. lunr.js crashes during search when documents
561    // processed by the pipeline still contain the empty string.
562    lunr.pt.stopWordFilter.stopWords.elements = ' a ao aos aquela aquelas aquele aqueles aquilo as até com como da das de dela delas dele deles depois do dos e ela elas ele eles em entre era eram essa essas esse esses esta estamos estas estava estavam este esteja estejam estejamos estes esteve estive estivemos estiver estivera estiveram estiverem estivermos estivesse estivessem estivéramos estivéssemos estou está estávamos estão eu foi fomos for fora foram forem formos fosse fossem fui fôramos fôssemos haja hajam hajamos havemos hei houve houvemos houver houvera houveram houverei houverem houveremos houveria houveriam houvermos houverá houverão houveríamos houvesse houvessem houvéramos houvéssemos há hão isso isto já lhe lhes mais mas me mesmo meu meus minha minhas muito na nas nem no nos nossa nossas nosso nossos num numa não nós o os ou para pela pelas pelo pelos por qual quando que quem se seja sejam sejamos sem serei seremos seria seriam será serão seríamos seu seus somos sou sua suas são só também te tem temos tenha tenham tenhamos tenho terei teremos teria teriam terá terão teríamos teu teus teve tinha tinham tive tivemos tiver tivera tiveram tiverem tivermos tivesse tivessem tivéramos tivéssemos tu tua tuas tém tínhamos um uma você vocês vos à às éramos'.split(' ');
563
564    lunr.Pipeline.registerFunction(lunr.pt.stopWordFilter, 'stopWordFilter-pt');
565  };
566}))

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.