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,118 @@
1
+ /*!
2
+ * Lunr languages, `Japanese` language
3
+ * https://github.com/MihaiValentin/lunr-languages
4
+ *
5
+ * Copyright 2014, Chad Liu
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.jp = function() {
57
+ this.pipeline.reset();
58
+ this.pipeline.add(
59
+ lunr.jp.stopWordFilter,
60
+ lunr.jp.stemmer
61
+ );
62
+ // change the tokenizer for japanese one
63
+ lunr.tokenizer = lunr.jp.tokenizer;
64
+ };
65
+ var segmenter = new TinySegmenter(); // インスタンス生成
66
+
67
+ lunr.jp.tokenizer = function (obj) {
68
+ if (!arguments.length || obj == null || obj == undefined) return []
69
+ if (Array.isArray(obj)) return obj.map(function (t) { return t.toLowerCase() })
70
+
71
+ var str = obj.toString().replace(/^\s+/, '')
72
+
73
+ for (var i = str.length - 1; i >= 0; i--) {
74
+ if (/\S/.test(str.charAt(i))) {
75
+ str = str.substring(0, i + 1)
76
+ break
77
+ }
78
+ }
79
+
80
+
81
+ var segs = segmenter.segment(str); // 単語の配列が返る
82
+ return segs.filter(function (token) {
83
+ return !!token
84
+ })
85
+ .map(function (token) {
86
+ return token
87
+ })
88
+ }
89
+
90
+ /* lunr stemmer function */
91
+ lunr.jp.stemmer = (function() {
92
+
93
+ /* TODO japanese stemmer */
94
+ return function(word) {
95
+ return word;
96
+ }
97
+ })();
98
+
99
+ lunr.Pipeline.registerFunction(lunr.jp.stemmer, 'stemmer-jp');
100
+
101
+ /* stop word filter function */
102
+ lunr.jp.stopWordFilter = function(token) {
103
+ if (lunr.jp.stopWordFilter.stopWords.indexOf(token) === -1) {
104
+ return token;
105
+ }
106
+ };
107
+
108
+ lunr.jp.stopWordFilter.stopWords = new lunr.SortedSet();
109
+ lunr.jp.stopWordFilter.stopWords.length = 45;
110
+
111
+ // The space at the beginning is crucial: It marks the empty string
112
+ // as a stop word. lunr.js crashes during search when documents
113
+ // processed by the pipeline still contain the empty string.
114
+ // stopword for japanese is from http://www.ranks.nl/stopwords/japanese
115
+ lunr.jp.stopWordFilter.stopWords.elements = ' これ それ あれ この その あの ここ そこ あそこ こちら どこ だれ なに なん 何 私 貴方 貴方方 我々 私達 あの人 あのかた 彼女 彼 です あります おります います は が の に を で え から まで より も どの と し それで しかし'.split(' ');
116
+ lunr.Pipeline.registerFunction(lunr.jp.stopWordFilter, 'stopWordFilter-jp');
117
+ };
118
+ }))
@@ -0,0 +1,7 @@
1
+ /**
2
+ * lunr - http://lunrjs.com - A bit like Solr, but much smaller and not as bright - 0.7.0
3
+ * Copyright (C) 2016 Oliver Nightingale
4
+ * MIT Licensed
5
+ * @license
6
+ */
7
+ !function(){var t=function(e){var n=new t.Index;return n.pipeline.add(t.trimmer,t.stopWordFilter,t.stemmer),e&&e.call(n,n),n};t.version="0.7.0",t.utils={},t.utils.warn=function(t){return function(e){t.console&&console.warn&&console.warn(e)}}(this),t.utils.asString=function(t){return void 0===t||null===t?"":t.toString()},t.EventEmitter=function(){this.events={}},t.EventEmitter.prototype.addListener=function(){var t=Array.prototype.slice.call(arguments),e=t.pop(),n=t;if("function"!=typeof e)throw new TypeError("last argument must be a function");n.forEach(function(t){this.hasHandler(t)||(this.events[t]=[]),this.events[t].push(e)},this)},t.EventEmitter.prototype.removeListener=function(t,e){if(this.hasHandler(t)){var n=this.events[t].indexOf(e);this.events[t].splice(n,1),this.events[t].length||delete this.events[t]}},t.EventEmitter.prototype.emit=function(t){if(this.hasHandler(t)){var e=Array.prototype.slice.call(arguments,1);this.events[t].forEach(function(t){t.apply(void 0,e)})}},t.EventEmitter.prototype.hasHandler=function(t){return t in this.events},t.tokenizer=function(e){return arguments.length&&null!=e&&void 0!=e?Array.isArray(e)?e.map(function(e){return t.utils.asString(e).toLowerCase()}):e.toString().trim().toLowerCase().split(t.tokenizer.seperator):[]},t.tokenizer.seperator=/[\s\-]+/,t.tokenizer.load=function(t){var e=this.registeredFunctions[t];if(!e)throw new Error("Cannot load un-registered function: "+t);return e},t.tokenizer.label="default",t.tokenizer.registeredFunctions={"default":t.tokenizer},t.tokenizer.registerFunction=function(e,n){n in this.registeredFunctions&&t.utils.warn("Overwriting existing tokenizer: "+n),e.label=n,this.registeredFunctions[n]=e},t.Pipeline=function(){this._stack=[]},t.Pipeline.registeredFunctions={},t.Pipeline.registerFunction=function(e,n){n in this.registeredFunctions&&t.utils.warn("Overwriting existing registered function: "+n),e.label=n,t.Pipeline.registeredFunctions[e.label]=e},t.Pipeline.warnIfFunctionNotRegistered=function(e){var n=e.label&&e.label in this.registeredFunctions;n||t.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\n",e)},t.Pipeline.load=function(e){var n=new t.Pipeline;return e.forEach(function(e){var i=t.Pipeline.registeredFunctions[e];if(!i)throw new Error("Cannot load un-registered function: "+e);n.add(i)}),n},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(e){t.Pipeline.warnIfFunctionNotRegistered(e),this._stack.push(e)},this)},t.Pipeline.prototype.after=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var i=this._stack.indexOf(e);if(-1==i)throw new Error("Cannot find existingFn");i+=1,this._stack.splice(i,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var i=this._stack.indexOf(e);if(-1==i)throw new Error("Cannot find existingFn");this._stack.splice(i,0,n)},t.Pipeline.prototype.remove=function(t){var e=this._stack.indexOf(t);-1!=e&&this._stack.splice(e,1)},t.Pipeline.prototype.run=function(t){for(var e=[],n=t.length,i=this._stack.length,r=0;n>r;r++){for(var o=t[r],s=0;i>s&&(o=this._stack[s](o,r,t),void 0!==o&&""!==o);s++);void 0!==o&&""!==o&&e.push(o)}return e},t.Pipeline.prototype.reset=function(){this._stack=[]},t.Pipeline.prototype.toJSON=function(){return this._stack.map(function(e){return t.Pipeline.warnIfFunctionNotRegistered(e),e.label})},t.Vector=function(){this._magnitude=null,this.list=void 0,this.length=0},t.Vector.Node=function(t,e,n){this.idx=t,this.val=e,this.next=n},t.Vector.prototype.insert=function(e,n){this._magnitude=void 0;var i=this.list;if(!i)return this.list=new t.Vector.Node(e,n,i),this.length++;if(e<i.idx)return this.list=new t.Vector.Node(e,n,i),this.length++;for(var r=i,o=i.next;void 0!=o;){if(e<o.idx)return r.next=new t.Vector.Node(e,n,o),this.length++;r=o,o=o.next}return r.next=new t.Vector.Node(e,n,o),this.length++},t.Vector.prototype.magnitude=function(){if(this._magnitude)return this._magnitude;for(var t,e=this.list,n=0;e;)t=e.val,n+=t*t,e=e.next;return this._magnitude=Math.sqrt(n)},t.Vector.prototype.dot=function(t){for(var e=this.list,n=t.list,i=0;e&&n;)e.idx<n.idx?e=e.next:e.idx>n.idx?n=n.next:(i+=e.val*n.val,e=e.next,n=n.next);return i},t.Vector.prototype.similarity=function(t){return this.dot(t)/(this.magnitude()*t.magnitude())},t.SortedSet=function(){this.length=0,this.elements=[]},t.SortedSet.load=function(t){var e=new this;return e.elements=t,e.length=t.length,e},t.SortedSet.prototype.add=function(){var t,e;for(t=0;t<arguments.length;t++)e=arguments[t],~this.indexOf(e)||this.elements.splice(this.locationFor(e),0,e);this.length=this.elements.length},t.SortedSet.prototype.toArray=function(){return this.elements.slice()},t.SortedSet.prototype.map=function(t,e){return this.elements.map(t,e)},t.SortedSet.prototype.forEach=function(t,e){return this.elements.forEach(t,e)},t.SortedSet.prototype.indexOf=function(t){for(var e=0,n=this.elements.length,i=n-e,r=e+Math.floor(i/2),o=this.elements[r];i>1;){if(o===t)return r;t>o&&(e=r),o>t&&(n=r),i=n-e,r=e+Math.floor(i/2),o=this.elements[r]}return o===t?r:-1},t.SortedSet.prototype.locationFor=function(t){for(var e=0,n=this.elements.length,i=n-e,r=e+Math.floor(i/2),o=this.elements[r];i>1;)t>o&&(e=r),o>t&&(n=r),i=n-e,r=e+Math.floor(i/2),o=this.elements[r];return o>t?r:t>o?r+1:void 0},t.SortedSet.prototype.intersect=function(e){for(var n=new t.SortedSet,i=0,r=0,o=this.length,s=e.length,a=this.elements,h=e.elements;;){if(i>o-1||r>s-1)break;a[i]!==h[r]?a[i]<h[r]?i++:a[i]>h[r]&&r++:(n.add(a[i]),i++,r++)}return n},t.SortedSet.prototype.clone=function(){var e=new t.SortedSet;return e.elements=this.toArray(),e.length=e.elements.length,e},t.SortedSet.prototype.union=function(t){var e,n,i;this.length>=t.length?(e=this,n=t):(e=t,n=this),i=e.clone();for(var r=0,o=n.toArray();r<o.length;r++)i.add(o[r]);return i},t.SortedSet.prototype.toJSON=function(){return this.toArray()},t.Index=function(){this._fields=[],this._ref="id",this.pipeline=new t.Pipeline,this.documentStore=new t.Store,this.tokenStore=new t.TokenStore,this.corpusTokens=new t.SortedSet,this.eventEmitter=new t.EventEmitter,this.tokenizerFn=t.tokenizer,this._idfCache={},this.on("add","remove","update",function(){this._idfCache={}}.bind(this))},t.Index.prototype.on=function(){var t=Array.prototype.slice.call(arguments);return this.eventEmitter.addListener.apply(this.eventEmitter,t)},t.Index.prototype.off=function(t,e){return this.eventEmitter.removeListener(t,e)},t.Index.load=function(e){e.version!==t.version&&t.utils.warn("version mismatch: current "+t.version+" importing "+e.version);var n=new this;return n._fields=e.fields,n._ref=e.ref,n.tokenizer=t.tokenizer.load(e.tokenizer),n.documentStore=t.Store.load(e.documentStore),n.tokenStore=t.TokenStore.load(e.tokenStore),n.corpusTokens=t.SortedSet.load(e.corpusTokens),n.pipeline=t.Pipeline.load(e.pipeline),n},t.Index.prototype.field=function(t,e){var e=e||{},n={name:t,boost:e.boost||1};return this._fields.push(n),this},t.Index.prototype.ref=function(t){return this._ref=t,this},t.Index.prototype.tokenizer=function(e){var n=e.label&&e.label in t.tokenizer.registeredFunctions;return n||t.utils.warn("Function is not a registered tokenizer. This may cause problems when serialising the index"),this.tokenizerFn=e,this},t.Index.prototype.add=function(e,n){var i={},r=new t.SortedSet,o=e[this._ref],n=void 0===n?!0:n;this._fields.forEach(function(t){var n=this.pipeline.run(this.tokenizerFn(e[t.name]));i[t.name]=n;for(var o=0;o<n.length;o++){var s=n[o];r.add(s),this.corpusTokens.add(s)}},this),this.documentStore.set(o,r);for(var s=0;s<r.length;s++){for(var a=r.elements[s],h=0,u=0;u<this._fields.length;u++){var l=this._fields[u],c=i[l.name],f=c.length;if(f){for(var d=0,p=0;f>p;p++)c[p]===a&&d++;h+=d/f*l.boost}}this.tokenStore.add(a,{ref:o,tf:h})}n&&this.eventEmitter.emit("add",e,this)},t.Index.prototype.remove=function(t,e){var n=t[this._ref],e=void 0===e?!0:e;if(this.documentStore.has(n)){var i=this.documentStore.get(n);this.documentStore.remove(n),i.forEach(function(t){this.tokenStore.remove(t,n)},this),e&&this.eventEmitter.emit("remove",t,this)}},t.Index.prototype.update=function(t,e){var e=void 0===e?!0:e;this.remove(t,!1),this.add(t,!1),e&&this.eventEmitter.emit("update",t,this)},t.Index.prototype.idf=function(t){var e="@"+t;if(Object.prototype.hasOwnProperty.call(this._idfCache,e))return this._idfCache[e];var n=this.tokenStore.count(t),i=1;return n>0&&(i=1+Math.log(this.documentStore.length/n)),this._idfCache[e]=i},t.Index.prototype.search=function(e){var n=this.pipeline.run(this.tokenizerFn(e)),i=new t.Vector,r=[],o=this._fields.reduce(function(t,e){return t+e.boost},0),s=n.some(function(t){return this.tokenStore.has(t)},this);if(!s)return[];n.forEach(function(e,n,s){var a=1/s.length*this._fields.length*o,h=this,u=this.tokenStore.expand(e).reduce(function(n,r){var o=h.corpusTokens.indexOf(r),s=h.idf(r),u=1,l=new t.SortedSet;if(r!==e){var c=Math.max(3,r.length-e.length);u=1/Math.log(c)}o>-1&&i.insert(o,a*s*u);for(var f=h.tokenStore.get(r),d=Object.keys(f),p=d.length,v=0;p>v;v++)l.add(f[d[v]].ref);return n.union(l)},new t.SortedSet);r.push(u)},this);var a=r.reduce(function(t,e){return t.intersect(e)});return a.map(function(t){return{ref:t,score:i.similarity(this.documentVector(t))}},this).sort(function(t,e){return e.score-t.score})},t.Index.prototype.documentVector=function(e){for(var n=this.documentStore.get(e),i=n.length,r=new t.Vector,o=0;i>o;o++){var s=n.elements[o],a=this.tokenStore.get(s)[e].tf,h=this.idf(s);r.insert(this.corpusTokens.indexOf(s),a*h)}return r},t.Index.prototype.toJSON=function(){return{version:t.version,fields:this._fields,ref:this._ref,tokenizer:this.tokenizerFn.label,documentStore:this.documentStore.toJSON(),tokenStore:this.tokenStore.toJSON(),corpusTokens:this.corpusTokens.toJSON(),pipeline:this.pipeline.toJSON()}},t.Index.prototype.use=function(t){var e=Array.prototype.slice.call(arguments,1);e.unshift(this),t.apply(this,e)},t.Store=function(){this.store={},this.length=0},t.Store.load=function(e){var n=new this;return n.length=e.length,n.store=Object.keys(e.store).reduce(function(n,i){return n[i]=t.SortedSet.load(e.store[i]),n},{}),n},t.Store.prototype.set=function(t,e){this.has(t)||this.length++,this.store[t]=e},t.Store.prototype.get=function(t){return this.store[t]},t.Store.prototype.has=function(t){return t in this.store},t.Store.prototype.remove=function(t){this.has(t)&&(delete this.store[t],this.length--)},t.Store.prototype.toJSON=function(){return{store:this.store,length:this.length}},t.stemmer=function(){var t={ational:"ate",tional:"tion",enci:"ence",anci:"ance",izer:"ize",bli:"ble",alli:"al",entli:"ent",eli:"e",ousli:"ous",ization:"ize",ation:"ate",ator:"ate",alism:"al",iveness:"ive",fulness:"ful",ousness:"ous",aliti:"al",iviti:"ive",biliti:"ble",logi:"log"},e={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},n="[^aeiou]",i="[aeiouy]",r=n+"[^aeiouy]*",o=i+"[aeiou]*",s="^("+r+")?"+o+r,a="^("+r+")?"+o+r+"("+o+")?$",h="^("+r+")?"+o+r+o+r,u="^("+r+")?"+i,l=new RegExp(s),c=new RegExp(h),f=new RegExp(a),d=new RegExp(u),p=/^(.+?)(ss|i)es$/,v=/^(.+?)([^s])s$/,g=/^(.+?)eed$/,m=/^(.+?)(ed|ing)$/,y=/.$/,S=/(at|bl|iz)$/,w=new RegExp("([^aeiouylsz])\\1$"),k=new RegExp("^"+r+i+"[^aeiouwxy]$"),x=/^(.+?[^aeiou])y$/,b=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/,E=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/,F=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/,_=/^(.+?)(s|t)(ion)$/,z=/^(.+?)e$/,O=/ll$/,P=new RegExp("^"+r+i+"[^aeiouwxy]$"),T=function(n){var i,r,o,s,a,h,u;if(n.length<3)return n;if(o=n.substr(0,1),"y"==o&&(n=o.toUpperCase()+n.substr(1)),s=p,a=v,s.test(n)?n=n.replace(s,"$1$2"):a.test(n)&&(n=n.replace(a,"$1$2")),s=g,a=m,s.test(n)){var T=s.exec(n);s=l,s.test(T[1])&&(s=y,n=n.replace(s,""))}else if(a.test(n)){var T=a.exec(n);i=T[1],a=d,a.test(i)&&(n=i,a=S,h=w,u=k,a.test(n)?n+="e":h.test(n)?(s=y,n=n.replace(s,"")):u.test(n)&&(n+="e"))}if(s=x,s.test(n)){var T=s.exec(n);i=T[1],n=i+"i"}if(s=b,s.test(n)){var T=s.exec(n);i=T[1],r=T[2],s=l,s.test(i)&&(n=i+t[r])}if(s=E,s.test(n)){var T=s.exec(n);i=T[1],r=T[2],s=l,s.test(i)&&(n=i+e[r])}if(s=F,a=_,s.test(n)){var T=s.exec(n);i=T[1],s=c,s.test(i)&&(n=i)}else if(a.test(n)){var T=a.exec(n);i=T[1]+T[2],a=c,a.test(i)&&(n=i)}if(s=z,s.test(n)){var T=s.exec(n);i=T[1],s=c,a=f,h=P,(s.test(i)||a.test(i)&&!h.test(i))&&(n=i)}return s=O,a=c,s.test(n)&&a.test(n)&&(s=y,n=n.replace(s,"")),"y"==o&&(n=o.toLowerCase()+n.substr(1)),n};return T}(),t.Pipeline.registerFunction(t.stemmer,"stemmer"),t.generateStopWordFilter=function(t){var e=t.reduce(function(t,e){return t[e]=e,t},{});return function(t){return t&&e[t]!==t?t:void 0}},t.stopWordFilter=t.generateStopWordFilter(["a","able","about","across","after","all","almost","also","am","among","an","and","any","are","as","at","be","because","been","but","by","can","cannot","could","dear","did","do","does","either","else","ever","every","for","from","get","got","had","has","have","he","her","hers","him","his","how","however","i","if","in","into","is","it","its","just","least","let","like","likely","may","me","might","most","must","my","neither","no","nor","not","of","off","often","on","only","or","other","our","own","rather","said","say","says","she","should","since","so","some","than","that","the","their","them","then","there","these","they","this","tis","to","too","twas","us","wants","was","we","were","what","when","where","which","while","who","whom","why","will","with","would","yet","you","your"]),t.Pipeline.registerFunction(t.stopWordFilter,"stopWordFilter"),t.trimmer=function(t){return t.replace(/^\W+/,"").replace(/\W+$/,"")},t.Pipeline.registerFunction(t.trimmer,"trimmer"),t.TokenStore=function(){this.root={docs:{}},this.length=0},t.TokenStore.load=function(t){var e=new this;return e.root=t.root,e.length=t.length,e},t.TokenStore.prototype.add=function(t,e,n){var n=n||this.root,i=t.charAt(0),r=t.slice(1);return i in n||(n[i]={docs:{}}),0===r.length?(n[i].docs[e.ref]=e,void(this.length+=1)):this.add(r,e,n[i])},t.TokenStore.prototype.has=function(t){if(!t)return!1;for(var e=this.root,n=0;n<t.length;n++){if(!e[t.charAt(n)])return!1;e=e[t.charAt(n)]}return!0},t.TokenStore.prototype.getNode=function(t){if(!t)return{};for(var e=this.root,n=0;n<t.length;n++){if(!e[t.charAt(n)])return{};e=e[t.charAt(n)]}return e},t.TokenStore.prototype.get=function(t,e){return this.getNode(t,e).docs||{}},t.TokenStore.prototype.count=function(t,e){return Object.keys(this.get(t,e)).length},t.TokenStore.prototype.remove=function(t,e){if(t){for(var n=this.root,i=0;i<t.length;i++){if(!(t.charAt(i)in n))return;n=n[t.charAt(i)]}delete n.docs[e]}},t.TokenStore.prototype.expand=function(t,e){var n=this.getNode(t),i=n.docs||{},e=e||[];return Object.keys(i).length&&e.push(t),Object.keys(n).forEach(function(n){"docs"!==n&&e.concat(this.expand(t+n,e))},this),e},t.TokenStore.prototype.toJSON=function(){return{root:this.root,length:this.length}},function(t,e){"function"==typeof define&&define.amd?define(e):"object"==typeof exports?module.exports=e():t.lunr=e()}(this,function(){return t})}();
@@ -0,0 +1,246 @@
1
+ /*!
2
+ * Lunr languages, `Norwegian` 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.no = function() {
57
+ this.pipeline.reset();
58
+ this.pipeline.add(
59
+ lunr.no.stopWordFilter,
60
+ lunr.no.stemmer
61
+ );
62
+ };
63
+
64
+ /* lunr stemmer function */
65
+ lunr.no.stemmer = (function() {
66
+ /* create the wrapped stemmer object */
67
+ var Among = lunr.stemmerSupport.Among,
68
+ SnowballProgram = lunr.stemmerSupport.SnowballProgram,
69
+ st = new function NorwegianStemmer() {
70
+ var a_0 = [new Among("a", -1, 1), new Among("e", -1, 1),
71
+ new Among("ede", 1, 1), new Among("ande", 1, 1),
72
+ new Among("ende", 1, 1), new Among("ane", 1, 1),
73
+ new Among("ene", 1, 1), new Among("hetene", 6, 1),
74
+ new Among("erte", 1, 3), new Among("en", -1, 1),
75
+ new Among("heten", 9, 1), new Among("ar", -1, 1),
76
+ new Among("er", -1, 1), new Among("heter", 12, 1),
77
+ new Among("s", -1, 2), new Among("as", 14, 1),
78
+ new Among("es", 14, 1), new Among("edes", 16, 1),
79
+ new Among("endes", 16, 1), new Among("enes", 16, 1),
80
+ new Among("hetenes", 19, 1), new Among("ens", 14, 1),
81
+ new Among("hetens", 21, 1), new Among("ers", 14, 1),
82
+ new Among("ets", 14, 1), new Among("et", -1, 1),
83
+ new Among("het", 25, 1), new Among("ert", -1, 3),
84
+ new Among("ast", -1, 1)
85
+ ],
86
+ a_1 = [new Among("dt", -1, -1),
87
+ new Among("vt", -1, -1)
88
+ ],
89
+ a_2 = [new Among("leg", -1, 1),
90
+ new Among("eleg", 0, 1), new Among("ig", -1, 1),
91
+ new Among("eig", 2, 1), new Among("lig", 2, 1),
92
+ new Among("elig", 4, 1), new Among("els", -1, 1),
93
+ new Among("lov", -1, 1), new Among("elov", 7, 1),
94
+ new Among("slov", 7, 1), new Among("hetslov", 9, 1)
95
+ ],
96
+ g_v = [17,
97
+ 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 0, 128
98
+ ],
99
+ g_s_ending = [
100
+ 119, 125, 149, 1
101
+ ],
102
+ I_x, I_p1, sbp = new SnowballProgram();
103
+ this.setCurrent = function(word) {
104
+ sbp.setCurrent(word);
105
+ };
106
+ this.getCurrent = function() {
107
+ return sbp.getCurrent();
108
+ };
109
+
110
+ function r_mark_regions() {
111
+ var v_1, c = sbp.cursor + 3;
112
+ I_p1 = sbp.limit;
113
+ if (0 <= c || c <= sbp.limit) {
114
+ I_x = c;
115
+ while (true) {
116
+ v_1 = sbp.cursor;
117
+ if (sbp.in_grouping(g_v, 97, 248)) {
118
+ sbp.cursor = v_1;
119
+ break;
120
+ }
121
+ if (v_1 >= sbp.limit)
122
+ return;
123
+ sbp.cursor = v_1 + 1;
124
+ }
125
+ while (!sbp.out_grouping(g_v, 97, 248)) {
126
+ if (sbp.cursor >= sbp.limit)
127
+ return;
128
+ sbp.cursor++;
129
+ }
130
+ I_p1 = sbp.cursor;
131
+ if (I_p1 < I_x)
132
+ I_p1 = I_x;
133
+ }
134
+ }
135
+
136
+ function r_main_suffix() {
137
+ var among_var, v_1, v_2;
138
+ if (sbp.cursor >= I_p1) {
139
+ v_1 = sbp.limit_backward;
140
+ sbp.limit_backward = I_p1;
141
+ sbp.ket = sbp.cursor;
142
+ among_var = sbp.find_among_b(a_0, 29);
143
+ sbp.limit_backward = v_1;
144
+ if (among_var) {
145
+ sbp.bra = sbp.cursor;
146
+ switch (among_var) {
147
+ case 1:
148
+ sbp.slice_del();
149
+ break;
150
+ case 2:
151
+ v_2 = sbp.limit - sbp.cursor;
152
+ if (sbp.in_grouping_b(g_s_ending, 98, 122))
153
+ sbp.slice_del();
154
+ else {
155
+ sbp.cursor = sbp.limit - v_2;
156
+ if (sbp.eq_s_b(1, "k") && sbp.out_grouping_b(g_v, 97, 248))
157
+ sbp.slice_del();
158
+ }
159
+ break;
160
+ case 3:
161
+ sbp.slice_from("er");
162
+ break;
163
+ }
164
+ }
165
+ }
166
+ }
167
+
168
+ function r_consonant_pair() {
169
+ var v_1 = sbp.limit - sbp.cursor,
170
+ v_2;
171
+ if (sbp.cursor >= I_p1) {
172
+ v_2 = sbp.limit_backward;
173
+ sbp.limit_backward = I_p1;
174
+ sbp.ket = sbp.cursor;
175
+ if (sbp.find_among_b(a_1, 2)) {
176
+ sbp.bra = sbp.cursor;
177
+ sbp.limit_backward = v_2;
178
+ sbp.cursor = sbp.limit - v_1;
179
+ if (sbp.cursor > sbp.limit_backward) {
180
+ sbp.cursor--;
181
+ sbp.bra = sbp.cursor;
182
+ sbp.slice_del();
183
+ }
184
+ } else
185
+ sbp.limit_backward = v_2;
186
+ }
187
+ }
188
+
189
+ function r_other_suffix() {
190
+ var among_var, v_1;
191
+ if (sbp.cursor >= I_p1) {
192
+ v_1 = sbp.limit_backward;
193
+ sbp.limit_backward = I_p1;
194
+ sbp.ket = sbp.cursor;
195
+ among_var = sbp.find_among_b(a_2, 11);
196
+ if (among_var) {
197
+ sbp.bra = sbp.cursor;
198
+ sbp.limit_backward = v_1;
199
+ if (among_var == 1)
200
+ sbp.slice_del();
201
+ } else
202
+ sbp.limit_backward = v_1;
203
+ }
204
+ }
205
+ this.stem = function() {
206
+ var v_1 = sbp.cursor;
207
+ r_mark_regions();
208
+ sbp.limit_backward = v_1;
209
+ sbp.cursor = sbp.limit;
210
+ r_main_suffix();
211
+ sbp.cursor = sbp.limit;
212
+ r_consonant_pair();
213
+ sbp.cursor = sbp.limit;
214
+ r_other_suffix();
215
+ return true;
216
+ }
217
+ };
218
+
219
+ /* and return a function that stems a word for the current locale */
220
+ return function(word) {
221
+ st.setCurrent(word);
222
+ st.stem();
223
+ return st.getCurrent();
224
+ }
225
+ })();
226
+
227
+ lunr.Pipeline.registerFunction(lunr.no.stemmer, 'stemmer-no');
228
+
229
+ /* stop word filter function */
230
+ lunr.no.stopWordFilter = function(token) {
231
+ if (lunr.no.stopWordFilter.stopWords.indexOf(token) === -1) {
232
+ return token;
233
+ }
234
+ };
235
+
236
+ lunr.no.stopWordFilter.stopWords = new lunr.SortedSet();
237
+ lunr.no.stopWordFilter.stopWords.length = 177;
238
+
239
+ // The space at the beginning is crucial: It marks the empty string
240
+ // as a stop word. lunr.js crashes during search when documents
241
+ // processed by the pipeline still contain the empty string.
242
+ lunr.no.stopWordFilter.stopWords.elements = ' alle at av bare begge ble blei bli blir blitt både båe da de deg dei deim deira deires dem den denne der dere deres det dette di din disse ditt du dykk dykkar då eg ein eit eitt eller elles en enn er et ett etter for fordi fra før ha hadde han hans har hennar henne hennes her hjå ho hoe honom hoss hossen hun hva hvem hver hvilke hvilken hvis hvor hvordan hvorfor i ikke ikkje ikkje ingen ingi inkje inn inni ja jeg kan kom korleis korso kun kunne kva kvar kvarhelst kven kvi kvifor man mange me med medan meg meget mellom men mi min mine mitt mot mykje ned no noe noen noka noko nokon nokor nokre nå når og også om opp oss over på samme seg selv si si sia sidan siden sin sine sitt sjøl skal skulle slik so som som somme somt så sånn til um upp ut uten var vart varte ved vere verte vi vil ville vore vors vort vår være være vært å'.split(' ');
243
+
244
+ lunr.Pipeline.registerFunction(lunr.no.stopWordFilter, 'stopWordFilter-no');
245
+ };
246
+ }))
@@ -0,0 +1,559 @@
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.stopWordFilter,
60
+ lunr.pt.stemmer
61
+ );
62
+ };
63
+
64
+ /* lunr stemmer function */
65
+ lunr.pt.stemmer = (function() {
66
+ /* create the wrapped stemmer object */
67
+ var Among = lunr.stemmerSupport.Among,
68
+ SnowballProgram = lunr.stemmerSupport.SnowballProgram,
69
+ st = new function PortugueseStemmer() {
70
+ var a_0 = [new Among("", -1, 3), new Among("\u00E3", 0, 1),
71
+ new Among("\u00F5", 0, 2)
72
+ ],
73
+ a_1 = [new Among("", -1, 3),
74
+ new Among("a~", 0, 1), new Among("o~", 0, 2)
75
+ ],
76
+ a_2 = [
77
+ new Among("ic", -1, -1), new Among("ad", -1, -1),
78
+ new Among("os", -1, -1), new Among("iv", -1, 1)
79
+ ],
80
+ a_3 = [
81
+ new Among("ante", -1, 1), new Among("avel", -1, 1),
82
+ new Among("\u00EDvel", -1, 1)
83
+ ],
84
+ a_4 = [new Among("ic", -1, 1),
85
+ new Among("abil", -1, 1), new Among("iv", -1, 1)
86
+ ],
87
+ a_5 = [
88
+ new Among("ica", -1, 1), new Among("\u00E2ncia", -1, 1),
89
+ new Among("\u00EAncia", -1, 4), new Among("ira", -1, 9),
90
+ new Among("adora", -1, 1), new Among("osa", -1, 1),
91
+ new Among("ista", -1, 1), new Among("iva", -1, 8),
92
+ new Among("eza", -1, 1), new Among("log\u00EDa", -1, 2),
93
+ new Among("idade", -1, 7), new Among("ante", -1, 1),
94
+ new Among("mente", -1, 6), new Among("amente", 12, 5),
95
+ new Among("\u00E1vel", -1, 1), new Among("\u00EDvel", -1, 1),
96
+ new Among("uci\u00F3n", -1, 3), new Among("ico", -1, 1),
97
+ new Among("ismo", -1, 1), new Among("oso", -1, 1),
98
+ new Among("amento", -1, 1), new Among("imento", -1, 1),
99
+ new Among("ivo", -1, 8), new Among("a\u00E7a~o", -1, 1),
100
+ new Among("ador", -1, 1), new Among("icas", -1, 1),
101
+ new Among("\u00EAncias", -1, 4), new Among("iras", -1, 9),
102
+ new Among("adoras", -1, 1), new Among("osas", -1, 1),
103
+ new Among("istas", -1, 1), new Among("ivas", -1, 8),
104
+ new Among("ezas", -1, 1), new Among("log\u00EDas", -1, 2),
105
+ new Among("idades", -1, 7), new Among("uciones", -1, 3),
106
+ new Among("adores", -1, 1), new Among("antes", -1, 1),
107
+ new Among("a\u00E7o~es", -1, 1), new Among("icos", -1, 1),
108
+ new Among("ismos", -1, 1), new Among("osos", -1, 1),
109
+ new Among("amentos", -1, 1), new Among("imentos", -1, 1),
110
+ new Among("ivos", -1, 8)
111
+ ],
112
+ a_6 = [new Among("ada", -1, 1),
113
+ new Among("ida", -1, 1), new Among("ia", -1, 1),
114
+ new Among("aria", 2, 1), new Among("eria", 2, 1),
115
+ new Among("iria", 2, 1), new Among("ara", -1, 1),
116
+ new Among("era", -1, 1), new Among("ira", -1, 1),
117
+ new Among("ava", -1, 1), new Among("asse", -1, 1),
118
+ new Among("esse", -1, 1), new Among("isse", -1, 1),
119
+ new Among("aste", -1, 1), new Among("este", -1, 1),
120
+ new Among("iste", -1, 1), new Among("ei", -1, 1),
121
+ new Among("arei", 16, 1), new Among("erei", 16, 1),
122
+ new Among("irei", 16, 1), new Among("am", -1, 1),
123
+ new Among("iam", 20, 1), new Among("ariam", 21, 1),
124
+ new Among("eriam", 21, 1), new Among("iriam", 21, 1),
125
+ new Among("aram", 20, 1), new Among("eram", 20, 1),
126
+ new Among("iram", 20, 1), new Among("avam", 20, 1),
127
+ new Among("em", -1, 1), new Among("arem", 29, 1),
128
+ new Among("erem", 29, 1), new Among("irem", 29, 1),
129
+ new Among("assem", 29, 1), new Among("essem", 29, 1),
130
+ new Among("issem", 29, 1), new Among("ado", -1, 1),
131
+ new Among("ido", -1, 1), new Among("ando", -1, 1),
132
+ new Among("endo", -1, 1), new Among("indo", -1, 1),
133
+ new Among("ara~o", -1, 1), new Among("era~o", -1, 1),
134
+ new Among("ira~o", -1, 1), new Among("ar", -1, 1),
135
+ new Among("er", -1, 1), new Among("ir", -1, 1),
136
+ new Among("as", -1, 1), new Among("adas", 47, 1),
137
+ new Among("idas", 47, 1), new Among("ias", 47, 1),
138
+ new Among("arias", 50, 1), new Among("erias", 50, 1),
139
+ new Among("irias", 50, 1), new Among("aras", 47, 1),
140
+ new Among("eras", 47, 1), new Among("iras", 47, 1),
141
+ new Among("avas", 47, 1), new Among("es", -1, 1),
142
+ new Among("ardes", 58, 1), new Among("erdes", 58, 1),
143
+ new Among("irdes", 58, 1), new Among("ares", 58, 1),
144
+ new Among("eres", 58, 1), new Among("ires", 58, 1),
145
+ new Among("asses", 58, 1), new Among("esses", 58, 1),
146
+ new Among("isses", 58, 1), new Among("astes", 58, 1),
147
+ new Among("estes", 58, 1), new Among("istes", 58, 1),
148
+ new Among("is", -1, 1), new Among("ais", 71, 1),
149
+ new Among("eis", 71, 1), new Among("areis", 73, 1),
150
+ new Among("ereis", 73, 1), new Among("ireis", 73, 1),
151
+ new Among("\u00E1reis", 73, 1), new Among("\u00E9reis", 73, 1),
152
+ new Among("\u00EDreis", 73, 1), new Among("\u00E1sseis", 73, 1),
153
+ new Among("\u00E9sseis", 73, 1), new Among("\u00EDsseis", 73, 1),
154
+ new Among("\u00E1veis", 73, 1), new Among("\u00EDeis", 73, 1),
155
+ new Among("ar\u00EDeis", 84, 1), new Among("er\u00EDeis", 84, 1),
156
+ new Among("ir\u00EDeis", 84, 1), new Among("ados", -1, 1),
157
+ new Among("idos", -1, 1), new Among("amos", -1, 1),
158
+ new Among("\u00E1ramos", 90, 1), new Among("\u00E9ramos", 90, 1),
159
+ new Among("\u00EDramos", 90, 1), new Among("\u00E1vamos", 90, 1),
160
+ new Among("\u00EDamos", 90, 1), new Among("ar\u00EDamos", 95, 1),
161
+ new Among("er\u00EDamos", 95, 1), new Among("ir\u00EDamos", 95, 1),
162
+ new Among("emos", -1, 1), new Among("aremos", 99, 1),
163
+ new Among("eremos", 99, 1), new Among("iremos", 99, 1),
164
+ new Among("\u00E1ssemos", 99, 1), new Among("\u00EAssemos", 99, 1),
165
+ new Among("\u00EDssemos", 99, 1), new Among("imos", -1, 1),
166
+ new Among("armos", -1, 1), new Among("ermos", -1, 1),
167
+ new Among("irmos", -1, 1), new Among("\u00E1mos", -1, 1),
168
+ new Among("ar\u00E1s", -1, 1), new Among("er\u00E1s", -1, 1),
169
+ new Among("ir\u00E1s", -1, 1), new Among("eu", -1, 1),
170
+ new Among("iu", -1, 1), new Among("ou", -1, 1),
171
+ new Among("ar\u00E1", -1, 1), new Among("er\u00E1", -1, 1),
172
+ new Among("ir\u00E1", -1, 1)
173
+ ],
174
+ a_7 = [new Among("a", -1, 1),
175
+ new Among("i", -1, 1), new Among("o", -1, 1),
176
+ new Among("os", -1, 1), new Among("\u00E1", -1, 1),
177
+ new Among("\u00ED", -1, 1), new Among("\u00F3", -1, 1)
178
+ ],
179
+ a_8 = [
180
+ new Among("e", -1, 1), new Among("\u00E7", -1, 2),
181
+ new Among("\u00E9", -1, 1), new Among("\u00EA", -1, 1)
182
+ ],
183
+ g_v = [17,
184
+ 65, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 19, 12, 2
185
+ ],
186
+ I_p2, I_p1, I_pV, sbp = new SnowballProgram();
187
+ this.setCurrent = function(word) {
188
+ sbp.setCurrent(word);
189
+ };
190
+ this.getCurrent = function() {
191
+ return sbp.getCurrent();
192
+ };
193
+
194
+ function r_prelude() {
195
+ var among_var;
196
+ while (true) {
197
+ sbp.bra = sbp.cursor;
198
+ among_var = sbp.find_among(a_0, 3);
199
+ if (among_var) {
200
+ sbp.ket = sbp.cursor;
201
+ switch (among_var) {
202
+ case 1:
203
+ sbp.slice_from("a~");
204
+ continue;
205
+ case 2:
206
+ sbp.slice_from("o~");
207
+ continue;
208
+ case 3:
209
+ if (sbp.cursor >= sbp.limit)
210
+ break;
211
+ sbp.cursor++;
212
+ continue;
213
+ }
214
+ }
215
+ break;
216
+ }
217
+ }
218
+
219
+ function habr2() {
220
+ if (sbp.out_grouping(g_v, 97, 250)) {
221
+ while (!sbp.in_grouping(g_v, 97, 250)) {
222
+ if (sbp.cursor >= sbp.limit)
223
+ return true;
224
+ sbp.cursor++;
225
+ }
226
+ return false;
227
+ }
228
+ return true;
229
+ }
230
+
231
+ function habr3() {
232
+ if (sbp.in_grouping(g_v, 97, 250)) {
233
+ while (!sbp.out_grouping(g_v, 97, 250)) {
234
+ if (sbp.cursor >= sbp.limit)
235
+ return false;
236
+ sbp.cursor++;
237
+ }
238
+ }
239
+ I_pV = sbp.cursor;
240
+ return true;
241
+ }
242
+
243
+ function habr4() {
244
+ var v_1 = sbp.cursor,
245
+ v_2, v_3;
246
+ if (sbp.in_grouping(g_v, 97, 250)) {
247
+ v_2 = sbp.cursor;
248
+ if (habr2()) {
249
+ sbp.cursor = v_2;
250
+ if (habr3())
251
+ return;
252
+ } else
253
+ I_pV = sbp.cursor;
254
+ }
255
+ sbp.cursor = v_1;
256
+ if (sbp.out_grouping(g_v, 97, 250)) {
257
+ v_3 = sbp.cursor;
258
+ if (habr2()) {
259
+ sbp.cursor = v_3;
260
+ if (!sbp.in_grouping(g_v, 97, 250) || sbp.cursor >= sbp.limit)
261
+ return;
262
+ sbp.cursor++;
263
+ }
264
+ I_pV = sbp.cursor;
265
+ }
266
+ }
267
+
268
+ function habr5() {
269
+ while (!sbp.in_grouping(g_v, 97, 250)) {
270
+ if (sbp.cursor >= sbp.limit)
271
+ return false;
272
+ sbp.cursor++;
273
+ }
274
+ while (!sbp.out_grouping(g_v, 97, 250)) {
275
+ if (sbp.cursor >= sbp.limit)
276
+ return false;
277
+ sbp.cursor++;
278
+ }
279
+ return true;
280
+ }
281
+
282
+ function r_mark_regions() {
283
+ var v_1 = sbp.cursor;
284
+ I_pV = sbp.limit;
285
+ I_p1 = I_pV;
286
+ I_p2 = I_pV;
287
+ habr4();
288
+ sbp.cursor = v_1;
289
+ if (habr5()) {
290
+ I_p1 = sbp.cursor;
291
+ if (habr5())
292
+ I_p2 = sbp.cursor;
293
+ }
294
+ }
295
+
296
+ function r_postlude() {
297
+ var among_var;
298
+ while (true) {
299
+ sbp.bra = sbp.cursor;
300
+ among_var = sbp.find_among(a_1, 3);
301
+ if (among_var) {
302
+ sbp.ket = sbp.cursor;
303
+ switch (among_var) {
304
+ case 1:
305
+ sbp.slice_from("\u00E3");
306
+ continue;
307
+ case 2:
308
+ sbp.slice_from("\u00F5");
309
+ continue;
310
+ case 3:
311
+ if (sbp.cursor >= sbp.limit)
312
+ break;
313
+ sbp.cursor++;
314
+ continue;
315
+ }
316
+ }
317
+ break;
318
+ }
319
+ }
320
+
321
+ function r_RV() {
322
+ return I_pV <= sbp.cursor;
323
+ }
324
+
325
+ function r_R1() {
326
+ return I_p1 <= sbp.cursor;
327
+ }
328
+
329
+ function r_R2() {
330
+ return I_p2 <= sbp.cursor;
331
+ }
332
+
333
+ function r_standard_suffix() {
334
+ var among_var;
335
+ sbp.ket = sbp.cursor;
336
+ among_var = sbp.find_among_b(a_5, 45);
337
+ if (!among_var)
338
+ return false;
339
+ sbp.bra = sbp.cursor;
340
+ switch (among_var) {
341
+ case 1:
342
+ if (!r_R2())
343
+ return false;
344
+ sbp.slice_del();
345
+ break;
346
+ case 2:
347
+ if (!r_R2())
348
+ return false;
349
+ sbp.slice_from("log");
350
+ break;
351
+ case 3:
352
+ if (!r_R2())
353
+ return false;
354
+ sbp.slice_from("u");
355
+ break;
356
+ case 4:
357
+ if (!r_R2())
358
+ return false;
359
+ sbp.slice_from("ente");
360
+ break;
361
+ case 5:
362
+ if (!r_R1())
363
+ return false;
364
+ sbp.slice_del();
365
+ sbp.ket = sbp.cursor;
366
+ among_var = sbp.find_among_b(a_2, 4);
367
+ if (among_var) {
368
+ sbp.bra = sbp.cursor;
369
+ if (r_R2()) {
370
+ sbp.slice_del();
371
+ if (among_var == 1) {
372
+ sbp.ket = sbp.cursor;
373
+ if (sbp.eq_s_b(2, "at")) {
374
+ sbp.bra = sbp.cursor;
375
+ if (r_R2())
376
+ sbp.slice_del();
377
+ }
378
+ }
379
+ }
380
+ }
381
+ break;
382
+ case 6:
383
+ if (!r_R2())
384
+ return false;
385
+ sbp.slice_del();
386
+ sbp.ket = sbp.cursor;
387
+ among_var = sbp.find_among_b(a_3, 3);
388
+ if (among_var) {
389
+ sbp.bra = sbp.cursor;
390
+ if (among_var == 1)
391
+ if (r_R2())
392
+ sbp.slice_del();
393
+ }
394
+ break;
395
+ case 7:
396
+ if (!r_R2())
397
+ return false;
398
+ sbp.slice_del();
399
+ sbp.ket = sbp.cursor;
400
+ among_var = sbp.find_among_b(a_4, 3);
401
+ if (among_var) {
402
+ sbp.bra = sbp.cursor;
403
+ if (among_var == 1)
404
+ if (r_R2())
405
+ sbp.slice_del();
406
+ }
407
+ break;
408
+ case 8:
409
+ if (!r_R2())
410
+ return false;
411
+ sbp.slice_del();
412
+ sbp.ket = sbp.cursor;
413
+ if (sbp.eq_s_b(2, "at")) {
414
+ sbp.bra = sbp.cursor;
415
+ if (r_R2())
416
+ sbp.slice_del();
417
+ }
418
+ break;
419
+ case 9:
420
+ if (!r_RV() || !sbp.eq_s_b(1, "e"))
421
+ return false;
422
+ sbp.slice_from("ir");
423
+ break;
424
+ }
425
+ return true;
426
+ }
427
+
428
+ function r_verb_suffix() {
429
+ var among_var, v_1;
430
+ if (sbp.cursor >= I_pV) {
431
+ v_1 = sbp.limit_backward;
432
+ sbp.limit_backward = I_pV;
433
+ sbp.ket = sbp.cursor;
434
+ among_var = sbp.find_among_b(a_6, 120);
435
+ if (among_var) {
436
+ sbp.bra = sbp.cursor;
437
+ if (among_var == 1)
438
+ sbp.slice_del();
439
+ sbp.limit_backward = v_1;
440
+ return true;
441
+ }
442
+ sbp.limit_backward = v_1;
443
+ }
444
+ return false;
445
+ }
446
+
447
+ function r_residual_suffix() {
448
+ var among_var;
449
+ sbp.ket = sbp.cursor;
450
+ among_var = sbp.find_among_b(a_7, 7);
451
+ if (among_var) {
452
+ sbp.bra = sbp.cursor;
453
+ if (among_var == 1)
454
+ if (r_RV())
455
+ sbp.slice_del();
456
+ }
457
+ }
458
+
459
+ function habr6(c1, c2) {
460
+ if (sbp.eq_s_b(1, c1)) {
461
+ sbp.bra = sbp.cursor;
462
+ var v_1 = sbp.limit - sbp.cursor;
463
+ if (sbp.eq_s_b(1, c2)) {
464
+ sbp.cursor = sbp.limit - v_1;
465
+ if (r_RV())
466
+ sbp.slice_del();
467
+ return false;
468
+ }
469
+ }
470
+ return true;
471
+ }
472
+
473
+ function r_residual_form() {
474
+ var among_var, v_1, v_2, v_3;
475
+ sbp.ket = sbp.cursor;
476
+ among_var = sbp.find_among_b(a_8, 4);
477
+ if (among_var) {
478
+ sbp.bra = sbp.cursor;
479
+ switch (among_var) {
480
+ case 1:
481
+ if (r_RV()) {
482
+ sbp.slice_del();
483
+ sbp.ket = sbp.cursor;
484
+ v_1 = sbp.limit - sbp.cursor;
485
+ if (habr6("u", "g"))
486
+ habr6("i", "c")
487
+ }
488
+ break;
489
+ case 2:
490
+ sbp.slice_from("c");
491
+ break;
492
+ }
493
+ }
494
+ }
495
+
496
+ function habr1() {
497
+ if (!r_standard_suffix()) {
498
+ sbp.cursor = sbp.limit;
499
+ if (!r_verb_suffix()) {
500
+ sbp.cursor = sbp.limit;
501
+ r_residual_suffix();
502
+ return;
503
+ }
504
+ }
505
+ sbp.cursor = sbp.limit;
506
+ sbp.ket = sbp.cursor;
507
+ if (sbp.eq_s_b(1, "i")) {
508
+ sbp.bra = sbp.cursor;
509
+ if (sbp.eq_s_b(1, "c")) {
510
+ sbp.cursor = sbp.limit;
511
+ if (r_RV())
512
+ sbp.slice_del();
513
+ }
514
+ }
515
+ }
516
+ this.stem = function() {
517
+ var v_1 = sbp.cursor;
518
+ r_prelude();
519
+ sbp.cursor = v_1;
520
+ r_mark_regions();
521
+ sbp.limit_backward = v_1;
522
+ sbp.cursor = sbp.limit;
523
+ habr1();
524
+ sbp.cursor = sbp.limit;
525
+ r_residual_form();
526
+ sbp.cursor = sbp.limit_backward;
527
+ r_postlude();
528
+ return true;
529
+ }
530
+ };
531
+
532
+ /* and return a function that stems a word for the current locale */
533
+ return function(word) {
534
+ st.setCurrent(word);
535
+ st.stem();
536
+ return st.getCurrent();
537
+ }
538
+ })();
539
+
540
+ lunr.Pipeline.registerFunction(lunr.pt.stemmer, 'stemmer-pt');
541
+
542
+ /* stop word filter function */
543
+ lunr.pt.stopWordFilter = function(token) {
544
+ if (lunr.pt.stopWordFilter.stopWords.indexOf(token) === -1) {
545
+ return token;
546
+ }
547
+ };
548
+
549
+ lunr.pt.stopWordFilter.stopWords = new lunr.SortedSet();
550
+ lunr.pt.stopWordFilter.stopWords.length = 204;
551
+
552
+ // The space at the beginning is crucial: It marks the empty string
553
+ // as a stop word. lunr.js crashes during search when documents
554
+ // processed by the pipeline still contain the empty string.
555
+ 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(' ');
556
+
557
+ lunr.Pipeline.registerFunction(lunr.pt.stopWordFilter, 'stopWordFilter-pt');
558
+ };
559
+ }))