Debian Codegraph @

mkdocs/contrib/search/lunr-language/lunr.hy.js

raw
1 /*!
2 * Lunr languages, `Armenian` language
3 * https://github.com/turbobit/lunr-languages
4 *
5 * Copyright 2021, Manikandan Venkatasubban
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.hy = function() {
57 this.pipeline.reset();
58 this.pipeline.add(
59 lunr.hy.trimmer,
60 lunr.hy.stopWordFilter
61 );
62 };
63
64 /* lunr trimmer function */
65 // http://www.unicode.org/charts/
66 lunr.hy.wordCharacters = "[" +
67 "A-Za-z" +
68 "\u0530-\u058F" + // armenian alphabet
69 "\uFB00-\uFB4F" + // armenian ligatures
70 "]";
71 lunr.hy.trimmer = lunr.trimmerSupport.generateTrimmer(lunr.hy.wordCharacters);
72
73 lunr.Pipeline.registerFunction(lunr.hy.trimmer, 'trimmer-hy');
74
75
76 /* lunr stop word filter */
77 // https://www.ranks.nl/stopwords/armenian
78 lunr.hy.stopWordFilter = lunr.generateStopWordFilter('դու և եք էիր էիք հետո նաև նրանք որը վրա է որ պիտի են այս մեջ ն իր ու ի այդ որոնք այն կամ էր մի ես համար այլ իսկ էին ենք հետ ին թ էինք մենք նրա նա դուք եմ էի ըստ որպես ում'.split(' '));
79 lunr.Pipeline.registerFunction(lunr.hy.stopWordFilter, 'stopWordFilter-hy');
80
81 /* lunr stemmer function */
82 lunr.hy.stemmer = (function() {
83
84 return function(word) {
85 // for lunr version 2
86 if (typeof word.update === "function") {
87 return word.update(function(word) {
88 return word;
89 })
90 } else { // for lunr version <= 1
91 return word;
92 }
93
94 }
95 })();
96 lunr.Pipeline.registerFunction(lunr.hy.stemmer, 'stemmer-hy');
97 };
98 }))