Commit f90ac3f3 authored by Alexandra Rogova's avatar Alexandra Rogova

elasticlunr french extension

parent 2d5cf1ff
[submodule "build/snowball-js"]
path = build/snowball-js
url = git://github.com/fortnightlabs/snowball-js.git
[submodule "build/stopwords-filter"]
path = build/stopwords-filter
url = git://github.com/brenes/stopwords-filter.git
This diff is collapsed.
Lunr languages [![npm](https://img.shields.io/npm/v/lunr-languages.svg)](https://www.npmjs.com/package/lunr-languages) [![Bower](https://img.shields.io/bower/v/lunr-languages.svg)]()
==============
This project features a collection of languages stemmers and stopwords for [Lunr](http://lunrjs.com/) Javascript library (which currently only supports English).
The following languages are available:
* German
* French
* Spanish
* Italian
* Japanese
* Dutch
* Danish
* Portuguese
* Finnish
* Romanian
* Hungarian
* Russian
* Norwegian
# How to use
Lunr-languages supports AMD and CommonJS. Check out the examples below:
## In a web browser
The following example is for the German language (de).
Add the following JS files to the page:
```html
<script src="lunr.stemmer.support.js"></script>
<script src="lunr.de.js"></script>
```
then, use the language in when initializing lunr:
```javascript
var idx = lunr(function () {
// use the language (de)
this.use(lunr.de);
// then, the normal lunr index initialization
this.field('title', { boost: 10 });
this.field('body');
});
```
That's it. Just add the documents and you're done. When searching, the language stemmer and stopwords list will be the one you used.
## In a web browser, with RequireJS
Add `require.js` to the page:
```html
<script src="lib/require.js"></script>
```
then, use the language in when initializing lunr:
```javascript
require(['lib/lunr.js', '../lunr.stemmer.support.js', '../lunr.de.js'], function(lunr, stemmerSupport, de) {
// since the stemmerSupport and de add keys on the lunr object, we'll pass it as reference to them
// in the end, we will only need lunr.
stemmerSupport(lunr); // adds lunr.stemmerSupport
de(lunr); // adds lunr.de key
// at this point, lunr can be used
var idx = lunr(function () {
// use the language (de)
this.use(lunr.de);
// then, the normal lunr index initialization
this.field('title', { boost: 10 })
this.field('body')
});
});
```
# With node.js
```javascript
var lunr = require('./lib/lunr.js');
require('./lunr.stemmer.support.js')(lunr);
require('./lunr.de.js')(lunr);
var idx = lunr(function () {
// use the language (de)
this.use(lunr.de);
// then, the normal lunr index initialization
this.field('title', { boost: 10 })
this.field('body')
});
```
# Indexing multi-language content
If your documents are written in more than one language, you can enable multi-language indexing. This ensures every word is properly trimmed and stemmed, every stopword is removed, and no words are lost (indexing in just one language would remove words from every other one.)
```javascript
var lunr = require('./lib/lunr.js');
require('./lunr.stemmer.support.js')(lunr);
require('./lunr.ru.js')(lunr);
require('./lunr.multi.js')(lunr);
var idx = lunr(function () {
this.use(lunr.multiLanguage('en', 'ru'));
// then, the normal lunr index initialization
// ...
});
```
You can combine any number of supported languages this way. The corresponding lunr language scripts must be loaded (English is built in).
If you serialize the index and load it in another script, you'll have to initialize the multi-language support in that script, too, like this:
```javascript
lunr.multiLanguage('en', 'ru');
var idx = lunr.Index.load(serializedIndex);
```
# Building your own files
The `lunr.<locale>.js` files are the result of a build process that concatenates a stemmer and a stop word list and add functionality to become lunr.js-compatible.
Should you decide to make mass-modifications (add stopwords, change stemming rules, reorganize the code) and build a new set of files, you should do follow these steps:
* `git clone --recursive git://github.com/MihaiValentin/lunr-languages.git` (make sure you use the `--recursive` flag to also clone the repos needed to build `lunr-languages`)
* `cd path/to/lunr-languages`
* `npm install` to install the dependencies needed for building
* change the `build/*.template` files
* run `node build/build.js` to generate the `lunr.<locale>.js` files (and the minified versions as well) and the `lunr.stemmer.support.js` file
# Technical details & Credits
I've created this project by compiling and wrapping stemmers toghether with stop words from various sources so they can be directly used with Lunr.
* <https://github.com/fortnightlabs/snowball-js> (the stemmers for all languages, ported from snowball-js)
* <https://github.com/brenes/stopwords-filter> (the stop words list for the other languages)
{
"name": "lunr-languages",
"version": "0.0.4",
"homepage": "https://github.com/MihaiValentin/lunr-languages",
"authors": [
"MihaiValentin <MihaiValentin@users.noreply.github.com>"
],
"description": "A a collection of languages stemmers and stopwords for Lunr Javascript library",
"moduleType": [
"amd",
"globals",
"node"
],
"keywords": [
"lunr",
"languages",
"stemmer",
"stop words",
"danish",
"german",
"deutsch",
"dutch",
"spanish",
"espanol",
"finish",
"francais",
"french",
"hungarian",
"magyar",
"italian",
"japanese",
"norwegian",
"portuguese",
"romanian",
"romana",
"russian",
"swedish",
"turkish"
],
"license": "MPL",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests",
"build",
"demos"
]
}
/**
* execute like this (from the project root folder):
* node build/build.js
*/
var fs = require('fs');
var beautify = require('js-beautify').js_beautify;
var UglifyJS = require("uglify-js");
// shortcut for minifying a piece of code
function compress(orig_code) {
return UglifyJS.minify(orig_code, {fromString: true, comments: true}).code;
}
// take some of the stop words list from the stopwords-filter repo
var stopwordsRepoFolder = './stopwords-filter/lib/stopwords/snowball/locales/';
// and, since that repository does not include all the stopwords we want, we add more, custom stopwords lists
var stopwordsCustomFolder = './stopwords-custom/';
// Use the Unicode library to produce a regex for characters of a particular
// 'script' (such as Latin), then extract the character ranges from that
// regex for use in our trimmer
function wordCharacters(script) {
var charRegex = require('unicode-8.0.0/scripts/' + script + '/regex');
// Now from /[a-z]/ get "a-z"
var regexString = charRegex.toString()
// Format sanity check
if (regexString.slice(0,2) !== '/[' || regexString.slice(-2) != ']/') {
console.error('Unexpected regex structure, aborting: ' + regexString);
throw Error;
}
return regexString.slice(2, -2);
}
// list mapping between locale, stemmer file, stopwords file, and char pattern
var list = [{
locale: 'da',
file: 'DanishStemmer.js',
stopwords: stopwordsRepoFolder + 'da.csv',
wordCharacters: wordCharacters('Latin')
}, {
locale: 'du',
file: 'DutchStemmer.js',
stopwords: stopwordsRepoFolder + 'nl.csv',
wordCharacters: wordCharacters('Latin')
}, {
locale: 'fi',
file: 'FinnishStemmer.js',
stopwords: stopwordsRepoFolder + 'fn.csv',
wordCharacters: wordCharacters('Latin')
}, {
locale: 'fr',
file: 'FrenchStemmer.js',
stopwords: stopwordsRepoFolder + 'fr.csv',
wordCharacters: wordCharacters('Latin')
}, {
locale: 'de',
file: 'GermanStemmer.js',
stopwords: stopwordsRepoFolder + 'de.csv',
wordCharacters: wordCharacters('Latin')
}, {
locale: 'hu',
file: 'HungarianStemmer.js',
stopwords: stopwordsRepoFolder + 'hu.csv',
wordCharacters: wordCharacters('Latin')
}, {
locale: 'it',
file: 'ItalianStemmer.js',
stopwords: stopwordsRepoFolder + 'it.csv',
wordCharacters: wordCharacters('Latin')
}, {
locale: 'no',
file: 'NorwegianStemmer.js',
stopwords: stopwordsCustomFolder + 'no.csv',
wordCharacters: wordCharacters('Latin')
}, {
locale: 'pt',
file: 'PortugueseStemmer.js',
stopwords: stopwordsRepoFolder + 'pt.csv',
wordCharacters: wordCharacters('Latin')
}, {
locale: 'ro',
file: 'RomanianStemmer.js',
stopwords: stopwordsCustomFolder + 'ro.csv',
wordCharacters: wordCharacters('Latin')
}, {
locale: 'ru',
file: 'RussianStemmer.js',
stopwords: stopwordsCustomFolder + 'ru.csv',
wordCharacters: wordCharacters('Cyrillic')
}, {
locale: 'es',
file: 'SpanishStemmer.js',
stopwords: stopwordsRepoFolder + 'es.csv',
wordCharacters: wordCharacters('Latin')
}, {
locale: 'sv',
file: 'SwedishStemmer.js',
stopwords: stopwordsCustomFolder + 'sv.csv',
wordCharacters: wordCharacters('Latin')
}, {
locale: 'tr',
file: 'TurkishStemmer.js',
stopwords: stopwordsCustomFolder + 'tr.csv',
wordCharacters: wordCharacters('Latin')
}
];
console.log('Starting building lunr-languages ...');
// read templates
var tpl = fs.readFileSync('build/lunr.template', 'utf8');
var cm = fs.readFileSync('build/lunr.comments', 'utf8');
// for each language, start building
for(var i = 0; i < list.length; i++) {
console.log('Building for "' + list[i].locale + '"');
var data = fs.readFileSync('build/snowball-js/stemmer/src/ext/' + list[i].file, 'utf8');
var stopWords = fs.readFileSync('build/' + list[i].stopwords, 'utf8');
var f = tpl;
// start replacing the placeholders
f = cm + f;
f = f.replace(/\{\{locale\}\}/g, list[i].locale);
f = f.replace(/\{\{stemmerFunction\}\}/g, data.substring(data.indexOf('function')));
f = f.replace(/\{\{stopWords\}\}/g, stopWords.split(',').sort().join(' '));
f = f.replace(/\{\{stopWordsLength\}\}/g, stopWords.split(',').length + 1);
f = f.replace(/\{\{languageName\}\}/g, list[i].file.replace(/Stemmer\.js/g, ''));
f = f.replace(/\{\{wordCharacters\}\}/g, list[i].wordCharacters);
// write the full file
fs.writeFile('lunr.' + list[i].locale + '.js', beautify(f, { indent_size: 2 }));
// and the minified version
fs.writeFile('min/lunr.' + list[i].locale + '.min.js', cm.replace(/\{\{languageName\}\}/g, list[i].file.replace(/Stemmer\.js/g, '')) + compress(f));
}
console.log('Building Stemmer Support');
// build stemmer support
var support = fs.readFileSync('lunr.stemmer.support.js', 'utf8');
fs.writeFile('min/lunr.stemmer.support.min.js', compress(support));
console.log('Building Multi-Language Extension');
// build multi
var multi = fs.readFileSync('lunr.multi.js', 'utf8');
fs.writeFile('min/lunr.multi.min.js', compress(multi));
console.log('Done!');
/*!
* Lunr languages, `{{languageName}}` 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.{{locale}} = function () {
this.pipeline.reset();
this.pipeline.add(
lunr.{{locale}}.trimmer,
lunr.{{locale}}.stopWordFilter,
lunr.{{locale}}.stemmer
);
};
/* lunr trimmer function */
lunr.{{locale}}.wordCharacters = "{{wordCharacters}}";
lunr.{{locale}}.trimmer = lunr.trimmerSupport.generateTrimmer(lunr.{{locale}}.wordCharacters);
lunr.Pipeline.registerFunction(lunr.{{locale}}.trimmer, 'trimmer-{{locale}}');
/* lunr stemmer function */
lunr.{{locale}}.stemmer = (function() {
/* create the wrapped stemmer object */
var Among = lunr.stemmerSupport.Among,
SnowballProgram = lunr.stemmerSupport.SnowballProgram,
st = new {{stemmerFunction}};
/* and return a function that stems a word for the current locale */
return function(word) {
st.setCurrent(word);
st.stem();
return st.getCurrent();
}
})();
lunr.Pipeline.registerFunction(lunr.{{locale}}.stemmer, 'stemmer-{{locale}}');
/* stop word filter function */
lunr.{{locale}}.stopWordFilter = function (token) {
if (lunr.{{locale}}.stopWordFilter.stopWords.indexOf(token) === -1) {
return token;
}
};
lunr.{{locale}}.stopWordFilter.stopWords = new lunr.SortedSet();
lunr.{{locale}}.stopWordFilter.stopWords.length = {{stopWordsLength}};
// The space at the beginning is crucial: It marks the empty string
// as a stop word. lunr.js crashes during search when documents
// processed by the pipeline still contain the empty string.
lunr.{{locale}}.stopWordFilter.stopWords.elements = ' {{stopWords}}'.split(' ');
lunr.Pipeline.registerFunction(lunr.{{locale}}.stopWordFilter, 'stopWordFilter-{{locale}}');
};
}))
og,i,jeg,det,at,en,et,den,til,er,som,på,de,med,han,av,ikke,ikkje,der,så,var,meg,seg,men,ett,har,om,vi,min,mitt,ha,hadde,hun,nå,over,da,ved,fra,du,ut,sin,dem,oss,opp,man,kan,hans,hvor,eller,hva,skal,selv,sjøl,her,alle,vil,bli,ble,blei,blitt,kunne,inn,når,være,kom,noen,noe,ville,dere,som,deres,kun,ja,etter,ned,skulle,denne,for,deg,si,sine,sitt,mot,å,meget,hvorfor,dette,disse,uten,hvordan,ingen,din,ditt,blir,samme,hvilken,hvilke,sånn,inni,mellom,vår,hver,hvem,vors,hvis,både,bare,enn,fordi,før,mange,også,slik,vært,være,båe,begge,siden,dykk,dykkar,dei,deira,deires,deim,di,då,eg,ein,eit,eitt,elles,honom,hjå,ho,hoe,henne,hennar,hennes,hoss,hossen,ikkje,ingi,inkje,korleis,korso,kva,kvar,kvarhelst,kven,kvi,kvifor,me,medan,mi,mine,mykje,no,nokon,noka,nokor,noko,nokre,si,sia,sidan,so,somt,somme,um,upp,vere,vore,verte,vort,varte,vart
\ No newline at end of file
acea,aceasta,această,aceea,acei,aceia,acel,acela,acele,acelea,acest,acesta,aceste,acestea,aceşti,aceştia,acolo,acord,acum,ai,aia,aibă,aici,al,ăla,ale,alea,ălea,altceva,altcineva,am,ar,are,aş,aşadar,asemenea,asta,ăsta,astăzi,astea,ăstea,ăştia,asupra,aţi,au,avea,avem,aveţi,azi,bine,bucur,bună,ca,că,căci,când,care,cărei,căror,cărui,cât,câte,câţi,către,câtva,caut,ce,cel,ceva,chiar,cinci,cînd,cine,cineva,cît,cîte,cîţi,cîtva,contra,cu,cum,cumva,curând,curînd,da,dă,dacă,dar,dată,datorită,dau,de,deci,deja,deoarece,departe,deşi,din,dinaintea,dintr-,dintre,doi,doilea,două,drept,după,ea,ei,el,ele,eram,este,eşti,eu,face,fără,fata,fi,fie,fiecare,fii,fim,fiţi,fiu,frumos,graţie,halbă,iar,ieri,îi,îl,îmi,împotriva,în ,înainte,înaintea,încât,încît,încotro,între,întrucât,întrucît,îţi,la,lângă,le,li,lîngă,lor,lui,mă,mai,mâine,mea,mei,mele,mereu,meu,mi,mie,mîine,mine,mult,multă,mulţi,mulţumesc,ne,nevoie,nicăieri,nici,nimeni,nimeri,nimic,nişte,noastră,noastre,noi,noroc,noştri,nostru,nouă,nu,opt,ori,oricând,oricare,oricât,orice,oricînd,oricine,oricît,oricum,oriunde,până,patra,patru,patrulea,pe,pentru,peste,pic,pînă,poate,pot,prea,prima,primul,prin,puţin,puţina,puţină,rog,sa,să,săi,sale,şapte,şase,sau,său,se,şi,sînt,sîntem,sînteţi,spate,spre,ştiu,sub,sunt,suntem,sunteţi,sută,ta,tăi,tale,tău,te,ţi,ţie,timp,tine,toată,toate,tot,toţi,totuşi,trei,treia,treilea,tu,un,una,unde,undeva,unei,uneia,unele,uneori,unii,unor,unora,unu,unui,unuia,unul,vă,vi,voastră,voastre,voi,voştri,vostru,vouă,vreme,vreo,vreun,zece,zero,zi,zice
\ No newline at end of file
а,е,и,ж,м,о,на,не,ни,об,но,он,мне,мои,мож,она,они,оно,мной,много,многочисленное,многочисленная,многочисленные,многочисленный,мною,мой,мог,могут,можно,может,можхо,мор,моя,моё,мочь,над,нее,оба,нам,нем,нами,ними,мимо,немного,одной,одного,менее,однажды,однако,меня,нему,меньше,ней,наверху,него,ниже,мало,надо,один,одиннадцать,одиннадцатый,назад,наиболее,недавно,миллионов,недалеко,между,низко,меля,нельзя,нибудь,непрерывно,наконец,никогда,никуда,нас,наш,нет,нею,неё,них,мира,наша,наше,наши,ничего,начала,нередко,несколько,обычно,опять,около,мы,ну,нх,от,отовсюду,особенно,нужно,очень,отсюда,в,во,вон,вниз,внизу,вокруг,вот,восемнадцать,восемнадцатый,восемь,восьмой,вверх,вам,вами,важное,важная,важные,важный,вдали,везде,ведь,вас,ваш,ваша,ваше,ваши,впрочем,весь,вдруг,вы,все,второй,всем,всеми,времени,время,всему,всего,всегда,всех,всею,всю,вся,всё,всюду,г,год,говорил,говорит,года,году,где,да,ее,за,из,ли,же,им,до,по,ими,под,иногда,довольно,именно,долго,позже,более,должно,пожалуйста,значит,иметь,больше,пока,ему,имя,пор,пора,потом,потому,после,почему,почти,посреди,ей,два,две,двенадцать,двенадцатый,двадцать,двадцатый,двух,его,дел,или,без,день,занят,занята,занято,заняты,действительно,давно,девятнадцать,девятнадцатый,девять,девятый,даже,алло,жизнь,далеко,близко,здесь,дальше,для,лет,зато,даром,первый,перед,затем,зачем,лишь,десять,десятый,ею,её,их,бы,еще,при,был,про,процентов,против,просто,бывает,бывь,если,люди,была,были,было,будем,будет,будете,будешь,прекрасно,буду,будь,будто,будут,ещё,пятнадцать,пятнадцатый,друго,другое,другой,другие,другая,других,есть,пять,быть,лучше,пятый,к,ком,конечно,кому,кого,когда,которой,которого,которая,которые,который,которых,кем,каждое,каждая,каждые,каждый,кажется,как,какой,какая,кто,кроме,куда,кругом,с,т,у,я,та,те,уж,со,то,том,снова,тому,совсем,того,тогда,тоже,собой,тобой,собою,тобою,сначала,только,уметь,тот,тою,хорошо,хотеть,хочешь,хоть,хотя,свое,свои,твой,своей,своего,своих,свою,твоя,твоё,раз,уже,сам,там,тем,чем,сама,сами,теми,само,рано,самом,самому,самой,самого,семнадцать,семнадцатый,самим,самими,самих,саму,семь,чему,раньше,сейчас,чего,сегодня,себе,тебе,сеаой,человек,разве,теперь,себя,тебя,седьмой,спасибо,слишком,так,такое,такой,такие,также,такая,сих,тех,чаще,четвертый,через,часто,шестой,шестнадцать,шестнадцатый,шесть,четыре,четырнадцать,четырнадцатый,сколько,сказал,сказала,сказать,ту,ты,три,эта,эти,что,это,чтоб,этом,этому,этой,этого,чтобы,этот,стал,туда,этим,этими,рядом,тринадцать,тринадцатый,этих,третий,тут,эту,суть,чуть,тысяч
\ No newline at end of file
och,det,att,i,en,jag,hon,som,han,på,den,med,var,sig,för,så,till,är,men,ett,om,hade,de,av,icke,mig,du,henne,då,sin,nu,har,inte,hans,honom,skulle,hennes,där,min,man,ej,vid,kunde,något,från,ut,när,efter,upp,vi,dem,vara,vad,över,än,dig,kan,sina,här,ha,mot,alla,under,någon,eller,allt,mycket,sedan,ju,denna,själv,detta,åt,utan,varit,hur,ingen,mitt,ni,bli,blev,oss,din,dessa,några,deras,blir,mina,samma,vilken,er,sådan,vår,blivit,dess,inom,mellan,sådant,varför,varje,vilka,ditt,vem,vilket,sitta,sådana,vart,dina,vars,vårt,våra,ert,era,vilkas
\ No newline at end of file
acaba,altmış,altı,ama,ancak,arada,aslında,ayrıca,bana,bazı,belki,ben,benden,beni,benim,beri,beş,bile,bin,bir,birçok,biri,birkaç,birkez,birşey,birşeyi,biz,bize,bizden,bizi,bizim,böyle,böylece,bu,buna,bunda,bundan,bunlar,bunları,bunların,bunu,bunun,burada,çok,çünkü,da,daha,dahi,de,defa,değil,diğer,diye,doksan,dokuz,dolayı,dolayısıyla,dört,edecek,eden,ederek,edilecek,ediliyor,edilmesi,ediyor,eğer,elli,en,etmesi,etti,ettiği,ettiğini,gibi,göre,halen,hangi,hatta,hem,henüz,hep,hepsi,her,herhangi,herkesin,hiç,hiçbir,için,iki,ile,ilgili,ise,işte,itibaren,itibariyle,kadar,karşın,katrilyon,kendi,kendilerine,kendini,kendisi,kendisine,kendisini,kez,ki,kim,kimden,kime,kimi,kimse,kırk,milyar,milyon,mu,mü,mı,nasıl,ne,neden,nedenle,nerde,nerede,nereye,niye,niçin,o,olan,olarak,oldu,olduğu,olduğunu,olduklarını,olmadı,olmadığı,olmak,olması,olmayan,olmaz,olsa,olsun,olup,olur,olursa,oluyor,on,ona,ondan,onlar,onlardan,onları,onların,onu,onun,otuz,oysa,öyle,pek,rağmen,sadece,sanki,sekiz,seksen,sen,senden,seni,senin,siz,sizden,sizi,sizin,şey,şeyden,şeyi,şeyler,şöyle,şu,şuna,şunda,şundan,şunları,şunu,tarafından,trilyon,tüm,üç,üzere,var,vardı,ve,veya,ya,yani,yapacak,yapılan,yapılması,yapıyor,yapmak,yaptı,yaptığı,yaptığını,yaptıkları,yedi,yerine,yetmiş,yine,yirmi,yoksa,yüz,zaten
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="UTF-8">
<script src="lib/lunr.js"></script>
<script src="../lunr.stemmer.support.js" charset="UTF-8"></script>
<script src="../tinyseg.js" charset="UTF-8"></script>
<script src="../lunr.jp.js" charset="UTF-8"></script>
</head>
<body>
<p>Open developer tools and observe the results in the Console tab. View source for code.</p>
<script>
/* init lunr */
var idx = lunr(function () {
// use the language (de)
this.use(lunr.jp);
// then, the normal lunr index initialization
this.field('title', { boost: 10 })
this.field('body')
});
/* add documents to index */
idx.add({
"title": "名前",
"body": "私の名前は中野です",
"id": 1
});
idx.add({
"title": "Tourismus in Deutschland",
"body": "Deutschland als Urlaubsziel verfügt über günstige Voraussetzungen: Gebirgslandschaften (Alpen und Mittelgebirge), See- und Flusslandschaften, die Küsten und Inseln der Nord- und Ostsee, zahlreiche Kulturdenkmäler und eine Vielzahl geschichtsträchtiger Städte sowie gut ausgebaute Infrastruktur. Vorteilhaft ist die zentrale Lage in Europa.",
"id": 2
});
console.log('Search for `中野`: ', idx.search('中野'));
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<title></title>
<script src="lib/require.js"></script>
</head>
<body>
<p>Open developer tools and observe the results in the Console tab. View source for code.</p>
<script>
require(['lib/lunr.js', '../lunr.stemmer.support.js', '../lunr.de.js'], function(lunr, stemmerSupport, de) {
// since the `stemmerSupport` and `de` add keys on the lunr object, we'll pass it as reference to them
// in the end, we will only need `lunr`.
stemmerSupport(lunr); // adds `lunr.stemmerSupport`
de(lunr); // adds `lunr.de` key
// at this point, `lunr` can be used
var idx = lunr(function () {
// use the language (de)
this.use(lunr.de);
// then, the normal lunr index initialization
this.field('title', { boost: 10 })
this.field('body')
});
/* add documents to index */
idx.add({
"title": "Deutschland",
"body": "An Deutschland grenzen neun Nachbarländer und naturräumlich im Norden die Gewässer der Nord- und Ostsee, im Süden das Bergland der Alpen. Es liegt in der gemäßigten Klimazone, zählt mit rund 80 Millionen Einwohnern zu den dicht besiedelten Flächenstaaten und gilt international als das Land mit der dritthöchsten Zahl von Einwanderern.",
"id": 1
});
idx.add({
"title": "Tourismus in Deutschland",
"body": "Deutschland als Urlaubsziel verfügt über günstige Voraussetzungen: Gebirgslandschaften (Alpen und Mittelgebirge), See- und Flusslandschaften, die Küsten und Inseln der Nord- und Ostsee, zahlreiche Kulturdenkmäler und eine Vielzahl geschichtsträchtiger Städte sowie gut ausgebaute Infrastruktur. Vorteilhaft ist die zentrale Lage in Europa.",
"id": 2
});
console.log('Search for `Deutsch`: ', idx.search('Deutsch'));
console.log('Search for `Urlaubsziel`: ', idx.search('Urlaubsziel'));
console.log('Search for `inexistent`: ', idx.search('inexistent'));
});
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<title></title>
<script src="lib/lunr.js"></script>
<script src="../lunr.stemmer.support.js"></script>
<script src="../lunr.de.js"></script>
</head>
<body>
<p>Open developer tools and observe the results in the Console tab. View source for code.</p>
<script>
/* init lunr */
var idx = lunr(function () {
// use the language (de)
this.use(lunr.de);
// then, the normal lunr index initialization
this.field('title', { boost: 10 })
this.field('body')
});
/* add documents to index */
idx.add({
"title": "Deutschland",
"body": "An Deutschland grenzen neun Nachbarländer und naturräumlich im Norden die Gewässer der Nord- und Ostsee, im Süden das Bergland der Alpen. Es liegt in der gemäßigten Klimazone, zählt mit rund 80 Millionen Einwohnern zu den dicht besiedelten Flächenstaaten und gilt international als das Land mit der dritthöchsten Zahl von Einwanderern.",
"id": 1
});
idx.add({
"title": "Tourismus in Deutschland",
"body": "Deutschland als Urlaubsziel verfügt über günstige Voraussetzungen: Gebirgslandschaften (Alpen und Mittelgebirge), See- und Flusslandschaften, die Küsten und Inseln der Nord- und Ostsee, zahlreiche Kulturdenkmäler und eine Vielzahl geschichtsträchtiger Städte sowie gut ausgebaute Infrastruktur. Vorteilhaft ist die zentrale Lage in Europa.",
"id": 2
});
console.log('Search for `Deutsch`: ', idx.search('Deutsch'));
console.log('Search for `Urlaubsziel`: ', idx.search('Urlaubsziel'));
console.log('Search for `inexistent`: ', idx.search('inexistent'));
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Lunr multi-language demo</title>
<script src="lib/lunr.js"></script>
<script src="../lunr.stemmer.support.js"></script>
<script src="../lunr.ru.js"></script>
<script src="../lunr.multi.js"></script>
</head>
<body>
<p>Open developer tools and observe the results in the Console tab. View source for code.</p>
<script>
/* init lunr */
var idxEn = lunr(function () {
this.field('body')
});
var idxRu = lunr(function () {
this.use(lunr.ru);
this.field('body')
});
var idxMulti = lunr(function () {
this.use(lunr.multiLanguage('en', 'ru'));
this.field('body')
});
idxEn.add({"body": "Этот текст написан на русском.", "id": 1})
idxRu.add({"body": "Этот текст написан на русском.", "id": 1})
idxMulti.add({"body": "Этот текст написан на русском.", "id": 1})
idxEn.add({"body": "This text is written in the English language.", "id": 2})
idxRu.add({"body": "This text is written in the English language.", "id": 2})
idxMulti.add({"body": "This text is written in the English language.", "id": 2})
console.log('Search for `Русских` (English pipeline): ', idxEn.search('Русских'));
console.log('Search for `languages` (English pipeline): ', idxEn.search('languages'));
console.log('Search for `Русских` (Russian pipeline): ', idxRu.search('Русских'));
console.log('Search for `languages` (Russian pipeline): ', idxRu.search('languages'));
console.log('Search for `Русских` (Ru + En pipeline): ', idxMulti.search('Русских'));
console.log('Search for `languages` (Ru + En pipeline): ', idxMulti.search('languages'));
</script>
</body>
</html>
var lunr = require('./lib/lunr.js');
require('../lunr.stemmer.support.js')(lunr);
require('../lunr.de.js')(lunr);
/* init lunr */
var idx = lunr(function () {
// use the language (de)
this.use(lunr.de);
// then, the normal lunr index initialization
this.field('title', { boost: 10 })
this.field('body')
});
/* add documents to index */
idx.add({
"title": "Deutschland",
"body": "An Deutschland grenzen neun Nachbarländer und naturräumlich im Norden die Gewässer der Nord- und Ostsee, im Süden das Bergland der Alpen. Es liegt in der gemäßigten Klimazone, zählt mit rund 80 Millionen Einwohnern zu den dicht besiedelten Flächenstaaten und gilt international als das Land mit der dritthöchsten Zahl von Einwanderern.",
"id": 1
});
idx.add({
"title": "Tourismus in Deutschland",
"body": "Deutschland als Urlaubsziel verfügt über günstige Voraussetzungen: Gebirgslandschaften (Alpen und Mittelgebirge), See- und Flusslandschaften, die Küsten und Inseln der Nord- und Ostsee, zahlreiche Kulturdenkmäler und eine Vielzahl geschichtsträchtiger Städte sowie gut ausgebaute Infrastruktur. Vorteilhaft ist die zentrale Lage in Europa.",
"id": 2
});
console.log('Search for `Deutsch`: ', idx.search('Deutsch'));
console.log('Search for `Urlaubsziel`: ', idx.search('Urlaubsziel'));
console.log('Search for `inexistent`: ', idx.search('inexistent'));
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*!
* Lunr languages, `Japanese` language
* https://github.com/MihaiValentin/lunr-languages
*
* Copyright 2014, Chad Liu
* 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.jp = function() {
this.pipeline.reset();
this.pipeline.add(
lunr.jp.stopWordFilter,
lunr.jp.stemmer
);
// change the tokenizer for japanese one
lunr.tokenizer = lunr.jp.tokenizer;
};
var segmenter = new TinySegmenter(); // インスタンス生成
lunr.jp.tokenizer = function (obj) {
if (!arguments.length || obj == null || obj == undefined) return []
if (Array.isArray(obj)) return obj.map(function (t) { return t.toLowerCase() })
var str = obj.toString().replace(/^\s+/, '')
for (var i = str.length - 1; i >= 0; i--) {
if (/\S/.test(str.charAt(i))) {
str = str.substring(0, i + 1)
break
}
}
var segs = segmenter.segment(str); // 単語の配列が返る
return segs.filter(function (token) {
return !!token
})
.map(function (token) {
return token
})
}
/* lunr stemmer function */
lunr.jp.stemmer = (function() {
/* TODO japanese stemmer */
return function(word) {
return word;
}
})();
lunr.Pipeline.registerFunction(lunr.jp.stemmer, 'stemmer-jp');
/* stop word filter function */
lunr.jp.stopWordFilter = function(token) {
if (lunr.jp.stopWordFilter.stopWords.indexOf(token) === -1) {
return token;
}
};
lunr.jp.stopWordFilter.stopWords = new lunr.SortedSet();
lunr.jp.stopWordFilter.stopWords.length = 45;
// The space at the beginning is crucial: It marks the empty string
// as a stop word. lunr.js crashes during search when documents
// processed by the pipeline still contain the empty string.
// stopword for japanese is from http://www.ranks.nl/stopwords/japanese
lunr.jp.stopWordFilter.stopWords.elements = ' これ それ あれ この その あの ここ そこ あそこ こちら どこ だれ なに なん 何 私 貴方 貴方方 我々 私達 あの人 あのかた 彼女 彼 です あります おります います は が の に を で え から まで より も どの と し それで しかし'.split(' ');
lunr.Pipeline.registerFunction(lunr.jp.stopWordFilter, 'stopWordFilter-jp');
};
}))
\ No newline at end of file
/**
* 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) {
/* Set up the pipeline for indexing content in multiple languages. The
corresponding lunr.{lang} files must be loaded before calling this
function; English ('en') is built in.
Returns: a lunr plugin for use in your indexer.
Known drawback: every word will be stemmed with stemmers for every
language. This could mean that sometimes words that have the same
stemming root will not be stemmed as such.
*/
lunr.multiLanguage = function(/* lang1, lang2, ... */) {
var languages = Array.prototype.slice.call(arguments);
var nameSuffix = languages.join('-');
var wordCharacters = "";
var pipeline = [];
for (var i = 0; i < languages.length; ++i) {
if (languages[i] == 'en') {
wordCharacters += '\\w';
pipeline.unshift(lunr.stopWordFilter);
pipeline.push(lunr.stemmer);
} else {
wordCharacters += lunr[languages[i]].wordCharacters;
pipeline.unshift(lunr[languages[i]].stopWordFilter);
pipeline.push(lunr[languages[i]].stemmer);
}
};
var multiTrimmer = lunr.trimmerSupport.generateTrimmer(wordCharacters);
lunr.Pipeline.registerFunction(multiTrimmer, 'lunr-multi-trimmer-' + nameSuffix);
pipeline.unshift(multiTrimmer);
return function() {
this.pipeline.reset();
this.pipeline.add.apply(this.pipeline, pipeline);
};
}
}
}));
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*!
* Lunr languages, `Danish` 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/
*/
!function(e,r){"function"==typeof define&&define.amd?define(r):"object"==typeof exports?module.exports=r():r()(e.lunr)}(this,function(){return function(e){if("undefined"==typeof e)throw new Error("Lunr is not present. Please include / require Lunr before this script.");if("undefined"==typeof e.stemmerSupport)throw new Error("Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.");e.da=function(){this.pipeline.reset(),this.pipeline.add(e.da.trimmer,e.da.stopWordFilter,e.da.stemmer)},e.da.wordCharacters="A-Za-zªºÀ-ÖØ-öø-ʸˠ-ˤᴀ-ᴥᴬ-ᵜᵢ-ᵥᵫ-ᵷᵹ-ᶾḀ-ỿⁱⁿₐ-ₜKÅℲⅎⅠ-ↈⱠ-ⱿꜢ-ꞇꞋ-ꞭꞰ-ꞷꟷ-ꟿꬰ-ꭚꭜ-ꭤff-stA-Za-z",e.da.trimmer=e.trimmerSupport.generateTrimmer(e.da.wordCharacters),e.Pipeline.registerFunction(e.da.trimmer,"trimmer-da"),e.da.stemmer=function(){var r=e.stemmerSupport.Among,n=e.stemmerSupport.SnowballProgram,i=new function(){function e(){var e,r=f.cursor+3;if(a=f.limit,r>=0&&r<=f.limit){for(d=r;;){if(e=f.cursor,f.in_grouping(w,97,248)){f.cursor=e;break}if(f.cursor=e,e>=f.limit)return;f.cursor++}for(;!f.out_grouping(w,97,248);){if(f.cursor>=f.limit)return;f.cursor++}a=f.cursor,d>a&&(a=d)}}function i(){var e,r;if(f.cursor>=a&&(r=f.limit_backward,f.limit_backward=a,f.ket=f.cursor,e=f.find_among_b(c,32),f.limit_backward=r,e))switch(f.bra=f.cursor,e){case 1:f.slice_del();break;case 2:f.in_grouping_b(p,97,229)&&f.slice_del()}}function t(){var e,r=f.limit-f.cursor;f.cursor>=a&&(e=f.limit_backward,f.limit_backward=a,f.ket=f.cursor,f.find_among_b(l,4)?(f.bra=f.cursor,f.limit_backward=e,f.cursor=f.limit-r,f.cursor>f.limit_backward&&(f.cursor--,f.bra=f.cursor,f.slice_del())):f.limit_backward=e)}function s(){var e,r,n,i=f.limit-f.cursor;if(f.ket=f.cursor,f.eq_s_b(2,"st")&&(f.bra=f.cursor,f.eq_s_b(2,"ig")&&f.slice_del()),f.cursor=f.limit-i,f.cursor>=a&&(r=f.limit_backward,f.limit_backward=a,f.ket=f.cursor,e=f.find_among_b(m,5),f.limit_backward=r,e))switch(f.bra=f.cursor,e){case 1:f.slice_del(),n=f.limit-f.cursor,t(),f.cursor=f.limit-n;break;case 2:f.slice_from("løs")}}function o(){var e;f.cursor>=a&&(e=f.limit_backward,f.limit_backward=a,f.ket=f.cursor,f.out_grouping_b(w,97,248)?(f.bra=f.cursor,u=f.slice_to(u),f.limit_backward=e,f.eq_v_b(u)&&f.slice_del()):f.limit_backward=e)}var d,a,u,c=[new r("hed",-1,1),new r("ethed",0,1),new r("ered",-1,1),new r("e",-1,1),new r("erede",3,1),new r("ende",3,1),new r("erende",5,1),new r("ene",3,1),new r("erne",3,1),new r("ere",3,1),new r("en",-1,1),new r("heden",10,1),new r("eren",10,1),new r("er",-1,1),new r("heder",13,1),new r("erer",13,1),new r("s",-1,2),new r("heds",16,1),new r("es",16,1),new r("endes",18,1),new r("erendes",19,1),new r("enes",18,1),new r("ernes",18,1),new r("eres",18,1),new r("ens",16,1),new r("hedens",24,1),new r("erens",24,1),new r("ers",16,1),new r("ets",16,1),new r("erets",28,1),new r("et",-1,1),new r("eret",30,1)],l=[new r("gd",-1,-1),new r("dt",-1,-1),new r("gt",-1,-1),new r("kt",-1,-1)],m=[new r("ig",-1,1),new r("lig",0,1),new r("elig",1,1),new r("els",-1,1),new r("løst",-1,2)],w=[17,65,16,1,0,0,0,0,0,0,0,0,0,0,0,0,48,0,128],p=[239,254,42,3,0,0,0,0,0,0,0,0,0,0,0,0,16],f=new n;this.setCurrent=function(e){f.setCurrent(e)},this.getCurrent=function(){return f.getCurrent()},this.stem=function(){var r=f.cursor;return e(),f.limit_backward=r,f.cursor=f.limit,i(),f.cursor=f.limit,t(),f.cursor=f.limit,s(),f.cursor=f.limit,o(),!0}};return function(e){return i.setCurrent(e),i.stem(),i.getCurrent()}}(),e.Pipeline.registerFunction(e.da.stemmer,"stemmer-da"),e.da.stopWordFilter=function(r){return-1===e.da.stopWordFilter.stopWords.indexOf(r)?r:void 0},e.da.stopWordFilter.stopWords=new e.SortedSet,e.da.stopWordFilter.stopWords.length=95,e.da.stopWordFilter.stopWords.elements=" ad af alle alt anden at blev blive bliver da de dem den denne der deres det dette dig din disse dog du efter eller en end er et for fra ham han hans har havde have hende hendes her hos hun hvad hvis hvor i ikke ind jeg jer jo kunne man mange med meget men mig min mine mit mod ned noget nogle nu når og også om op os over på selv sig sin sine sit skal skulle som sådan thi til ud under var vi vil ville vor være været".split(" "),e.Pipeline.registerFunction(e.da.stopWordFilter,"stopWordFilter-da")}});
\ No newline at end of file
/*!
* Lunr languages, `German` 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/
*/
!function(e,r){"function"==typeof define&&define.amd?define(r):"object"==typeof exports?module.exports=r():r()(e.lunr)}(this,function(){return function(e){if("undefined"==typeof e)throw new Error("Lunr is not present. Please include / require Lunr before this script.");if("undefined"==typeof e.stemmerSupport)throw new Error("Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.");e.de=function(){this.pipeline.reset(),this.pipeline.add(e.de.trimmer,e.de.stopWordFilter,e.de.stemmer)},e.de.wordCharacters="A-Za-zªºÀ-ÖØ-öø-ʸˠ-ˤᴀ-ᴥᴬ-ᵜᵢ-ᵥᵫ-ᵷᵹ-ᶾḀ-ỿⁱⁿₐ-ₜKÅℲⅎⅠ-ↈⱠ-ⱿꜢ-ꞇꞋ-ꞭꞰ-ꞷꟷ-ꟿꬰ-ꭚꭜ-ꭤff-stA-Za-z",e.de.trimmer=e.trimmerSupport.generateTrimmer(e.de.wordCharacters),e.Pipeline.registerFunction(e.de.trimmer,"trimmer-de"),e.de.stemmer=function(){var r=e.stemmerSupport.Among,n=e.stemmerSupport.SnowballProgram,i=new function(){function e(e,r,n){return v.eq_s(1,e)&&(v.ket=v.cursor,v.in_grouping(p,97,252))?(v.slice_from(r),v.cursor=n,!0):!1}function i(){for(var r,n,i,s,t=v.cursor;;)if(r=v.cursor,v.bra=r,v.eq_s(1,"ß"))v.ket=v.cursor,v.slice_from("ss");else{if(r>=v.limit)break;v.cursor=r+1}for(v.cursor=t;;)for(n=v.cursor;;){if(i=v.cursor,v.in_grouping(p,97,252)){if(s=v.cursor,v.bra=s,e("u","U",i))break;if(v.cursor=s,e("y","Y",i))break}if(i>=v.limit)return void(v.cursor=n);v.cursor=i+1}}function s(){for(;!v.in_grouping(p,97,252);){if(v.cursor>=v.limit)return!0;v.cursor++}for(;!v.out_grouping(p,97,252);){if(v.cursor>=v.limit)return!0;v.cursor++}return!1}function t(){m=v.limit,a=m;var e=v.cursor+3;e>=0&&e<=v.limit&&(l=e,s()||(m=v.cursor,l>m&&(m=l),s()||(a=v.cursor)))}function o(){for(var e,r;;){if(r=v.cursor,v.bra=r,e=v.find_among(w,6),!e)return;switch(v.ket=v.cursor,e){case 1:v.slice_from("y");break;case 2:case 5:v.slice_from("u");break;case 3:v.slice_from("a");break;case 4:v.slice_from("o");break;case 6:if(v.cursor>=v.limit)return;v.cursor++}}}function c(){return m<=v.cursor}function u(){return a<=v.cursor}function d(){var e,r,n,i,s=v.limit-v.cursor;if(v.ket=v.cursor,e=v.find_among_b(h,7),e&&(v.bra=v.cursor,c()))switch(e){case 1:v.slice_del();break;case 2:v.slice_del(),v.ket=v.cursor,v.eq_s_b(1,"s")&&(v.bra=v.cursor,v.eq_s_b(3,"nis")&&v.slice_del());break;case 3:v.in_grouping_b(g,98,116)&&v.slice_del()}if(v.cursor=v.limit-s,v.ket=v.cursor,e=v.find_among_b(f,4),e&&(v.bra=v.cursor,c()))switch(e){case 1:v.slice_del();break;case 2:if(v.in_grouping_b(k,98,116)){var t=v.cursor-3;v.limit_backward<=t&&t<=v.limit&&(v.cursor=t,v.slice_del())}}if(v.cursor=v.limit-s,v.ket=v.cursor,e=v.find_among_b(_,8),e&&(v.bra=v.cursor,u()))switch(e){case 1:v.slice_del(),v.ket=v.cursor,v.eq_s_b(2,"ig")&&(v.bra=v.cursor,r=v.limit-v.cursor,v.eq_s_b(1,"e")||(v.cursor=v.limit-r,u()&&v.slice_del()));break;case 2:n=v.limit-v.cursor,v.eq_s_b(1,"e")||(v.cursor=v.limit-n,v.slice_del());break;case 3:if(v.slice_del(),v.ket=v.cursor,i=v.limit-v.cursor,!v.eq_s_b(2,"er")&&(v.cursor=v.limit-i,!v.eq_s_b(2,"en")))break;v.bra=v.cursor,c()&&v.slice_del();break;case 4:v.slice_del(),v.ket=v.cursor,e=v.find_among_b(b,2),e&&(v.bra=v.cursor,u()&&1==e&&v.slice_del())}}var l,a,m,w=[new r("",-1,6),new r("U",0,2),new r("Y",0,1),new r("ä",0,3),new r("ö",0,4),new r("ü",0,5)],h=[new r("e",-1,2),new r("em",-1,1),new r("en",-1,2),new r("ern",-1,1),new r("er",-1,1),new r("s",-1,3),new r("es",5,2)],f=[new r("en",-1,1),new r("er",-1,1),new r("st",-1,2),new r("est",2,1)],b=[new r("ig",-1,1),new r("lich",-1,1)],_=[new r("end",-1,1),new r("ig",-1,2),new r("ung",-1,1),new r("lich",-1,3),new r("isch",-1,2),new r("ik",-1,2),new r("heit",-1,3),new r("keit",-1,4)],p=[17,65,16,1,0,0,0,0,0,0,0,0,0,0,0,0,8,0,32,8],g=[117,30,5],k=[117,30,4],v=new n;this.setCurrent=function(e){v.setCurrent(e)},this.getCurrent=function(){return v.getCurrent()},this.stem=function(){var e=v.cursor;return i(),v.cursor=e,t(),v.limit_backward=e,v.cursor=v.limit,d(),v.cursor=v.limit_backward,o(),!0}};return function(e){return i.setCurrent(e),i.stem(),i.getCurrent()}}(),e.Pipeline.registerFunction(e.de.stemmer,"stemmer-de"),e.de.stopWordFilter=function(r){return-1===e.de.stopWordFilter.stopWords.indexOf(r)?r:void 0},e.de.stopWordFilter.stopWords=new e.SortedSet,e.de.stopWordFilter.stopWords.length=232,e.de.stopWordFilter.stopWords.elements=" aber alle allem allen aller alles als also am an ander andere anderem anderen anderer anderes anderm andern anderr anders auch auf aus bei bin bis bist da damit dann das dasselbe dazu daß dein deine deinem deinen deiner deines dem demselben den denn denselben der derer derselbe derselben des desselben dessen dich die dies diese dieselbe dieselben diesem diesen dieser dieses dir doch dort du durch ein eine einem einen einer eines einig einige einigem einigen einiger einiges einmal er es etwas euch euer eure eurem euren eurer eures für gegen gewesen hab habe haben hat hatte hatten hier hin hinter ich ihm ihn ihnen ihr ihre ihrem ihren ihrer ihres im in indem ins ist jede jedem jeden jeder jedes jene jenem jenen jener jenes jetzt kann kein keine keinem keinen keiner keines können könnte machen man manche manchem manchen mancher manches mein meine meinem meinen meiner meines mich mir mit muss musste nach nicht nichts noch nun nur ob oder ohne sehr sein seine seinem seinen seiner seines selbst sich sie sind so solche solchem solchen solcher solches soll sollte sondern sonst um und uns unse unsem unsen unser unses unter viel vom von vor war waren warst was weg weil weiter welche welchem welchen welcher welches wenn werde werden wie wieder will wir wird wirst wo wollen wollte während würde würden zu zum zur zwar zwischen über".split(" "),e.Pipeline.registerFunction(e.de.stopWordFilter,"stopWordFilter-de")}});
\ No newline at end of file
/*!
* Lunr languages, `Dutch` 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/
*/
!function(r,e){"function"==typeof define&&define.amd?define(e):"object"==typeof exports?module.exports=e():e()(r.lunr)}(this,function(){return function(r){if("undefined"==typeof r)throw new Error("Lunr is not present. Please include / require Lunr before this script.");if("undefined"==typeof r.stemmerSupport)throw new Error("Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.");r.du=function(){this.pipeline.reset(),this.pipeline.add(r.du.trimmer,r.du.stopWordFilter,r.du.stemmer)},r.du.wordCharacters="A-Za-zªºÀ-ÖØ-öø-ʸˠ-ˤᴀ-ᴥᴬ-ᵜᵢ-ᵥᵫ-ᵷᵹ-ᶾḀ-ỿⁱⁿₐ-ₜKÅℲⅎⅠ-ↈⱠ-ⱿꜢ-ꞇꞋ-ꞭꞰ-ꞷꟷ-ꟿꬰ-ꭚꭜ-ꭤff-stA-Za-z",r.du.trimmer=r.trimmerSupport.generateTrimmer(r.du.wordCharacters),r.Pipeline.registerFunction(r.du.trimmer,"trimmer-du"),r.du.stemmer=function(){var e=r.stemmerSupport.Among,i=r.stemmerSupport.SnowballProgram,o=new function(){function r(){for(var r,e,i,n=j.cursor;;){if(j.bra=j.cursor,r=j.find_among(b,11))switch(j.ket=j.cursor,r){case 1:j.slice_from("a");continue;case 2:j.slice_from("e");continue;case 3:j.slice_from("i");continue;case 4:j.slice_from("o");continue;case 5:j.slice_from("u");continue;case 6:if(j.cursor>=j.limit)break;j.cursor++;continue}break}for(j.cursor=n,j.bra=n,j.eq_s(1,"y")?(j.ket=j.cursor,j.slice_from("Y")):j.cursor=n;;)if(e=j.cursor,j.in_grouping(q,97,232)){if(i=j.cursor,j.bra=i,j.eq_s(1,"i"))j.ket=j.cursor,j.in_grouping(q,97,232)&&(j.slice_from("I"),j.cursor=e);else if(j.cursor=i,j.eq_s(1,"y"))j.ket=j.cursor,j.slice_from("Y"),j.cursor=e;else if(o(e))break}else if(o(e))break}function o(r){return j.cursor=r,r>=j.limit?!0:(j.cursor++,!1)}function n(){_=j.limit,f=_,t()||(_=j.cursor,3>_&&(_=3),t()||(f=j.cursor))}function t(){for(;!j.in_grouping(q,97,232);){if(j.cursor>=j.limit)return!0;j.cursor++}for(;!j.out_grouping(q,97,232);){if(j.cursor>=j.limit)return!0;j.cursor++}return!1}function s(){for(var r;;)if(j.bra=j.cursor,r=j.find_among(p,3))switch(j.ket=j.cursor,r){case 1:j.slice_from("y");break;case 2:j.slice_from("i");break;case 3:if(j.cursor>=j.limit)return;j.cursor++}}function u(){return _<=j.cursor}function c(){return f<=j.cursor}function a(){var r=j.limit-j.cursor;j.find_among_b(g,3)&&(j.cursor=j.limit-r,j.ket=j.cursor,j.cursor>j.limit_backward&&(j.cursor--,j.bra=j.cursor,j.slice_del()))}function l(){var r;w=!1,j.ket=j.cursor,j.eq_s_b(1,"e")&&(j.bra=j.cursor,u()&&(r=j.limit-j.cursor,j.out_grouping_b(q,97,232)&&(j.cursor=j.limit-r,j.slice_del(),w=!0,a())))}function d(){var r;u()&&(r=j.limit-j.cursor,j.out_grouping_b(q,97,232)&&(j.cursor=j.limit-r,j.eq_s_b(3,"gem")||(j.cursor=j.limit-r,j.slice_del(),a())))}function m(){var r,e,i,o,n,t,s=j.limit-j.cursor;if(j.ket=j.cursor,r=j.find_among_b(k,5))switch(j.bra=j.cursor,r){case 1:u()&&j.slice_from("heid");break;case 2:d();break;case 3:u()&&j.out_grouping_b(W,97,232)&&j.slice_del()}if(j.cursor=j.limit-s,l(),j.cursor=j.limit-s,j.ket=j.cursor,j.eq_s_b(4,"heid")&&(j.bra=j.cursor,c()&&(e=j.limit-j.cursor,j.eq_s_b(1,"c")||(j.cursor=j.limit-e,j.slice_del(),j.ket=j.cursor,j.eq_s_b(2,"en")&&(j.bra=j.cursor,d())))),j.cursor=j.limit-s,j.ket=j.cursor,r=j.find_among_b(h,6))switch(j.bra=j.cursor,r){case 1:if(c()){if(j.slice_del(),i=j.limit-j.cursor,j.ket=j.cursor,j.eq_s_b(2,"ig")&&(j.bra=j.cursor,c()&&(o=j.limit-j.cursor,!j.eq_s_b(1,"e")))){j.cursor=j.limit-o,j.slice_del();break}j.cursor=j.limit-i,a()}break;case 2:c()&&(n=j.limit-j.cursor,j.eq_s_b(1,"e")||(j.cursor=j.limit-n,j.slice_del()));break;case 3:c()&&(j.slice_del(),l());break;case 4:c()&&j.slice_del();break;case 5:c()&&w&&j.slice_del()}j.cursor=j.limit-s,j.out_grouping_b(z,73,232)&&(t=j.limit-j.cursor,j.find_among_b(v,4)&&j.out_grouping_b(q,97,232)&&(j.cursor=j.limit-t,j.ket=j.cursor,j.cursor>j.limit_backward&&(j.cursor--,j.bra=j.cursor,j.slice_del())))}var f,_,w,b=[new e("",-1,6),new e("á",0,1),new e("ä",0,1),new e("é",0,2),new e("ë",0,2),new e("í",0,3),new e("ï",0,3),new e("ó",0,4),new e("ö",0,4),new e("ú",0,5),new e("ü",0,5)],p=[new e("",-1,3),new e("I",0,2),new e("Y",0,1)],g=[new e("dd",-1,-1),new e("kk",-1,-1),new e("tt",-1,-1)],k=[new e("ene",-1,2),new e("se",-1,3),new e("en",-1,2),new e("heden",2,1),new e("s",-1,3)],h=[new e("end",-1,1),new e("ig",-1,2),new e("ing",-1,1),new e("lijk",-1,3),new e("baar",-1,4),new e("bar",-1,5)],v=[new e("aa",-1,-1),new e("ee",-1,-1),new e("oo",-1,-1),new e("uu",-1,-1)],q=[17,65,16,1,0,0,0,0,0,0,0,0,0,0,0,0,128],z=[1,0,0,17,65,16,1,0,0,0,0,0,0,0,0,0,0,0,0,128],W=[17,67,16,1,0,0,0,0,0,0,0,0,0,0,0,0,128],j=new i;this.setCurrent=function(r){j.setCurrent(r)},this.getCurrent=function(){return j.getCurrent()},this.stem=function(){var e=j.cursor;return r(),j.cursor=e,n(),j.limit_backward=e,j.cursor=j.limit,m(),j.cursor=j.limit_backward,s(),!0}};return function(r){return o.setCurrent(r),o.stem(),o.getCurrent()}}(),r.Pipeline.registerFunction(r.du.stemmer,"stemmer-du"),r.du.stopWordFilter=function(e){return-1===r.du.stopWordFilter.stopWords.indexOf(e)?e:void 0},r.du.stopWordFilter.stopWords=new r.SortedSet,r.du.stopWordFilter.stopWords.length=103,r.du.stopWordFilter.stopWords.elements=" aan al alles als altijd andere ben bij daar dan dat de der deze die dit doch doen door dus een eens en er ge geen geweest haar had heb hebben heeft hem het hier hij hoe hun iemand iets ik in is ja je kan kon kunnen maar me meer men met mij mijn moet na naar niet niets nog nu of om omdat onder ons ook op over reeds te tegen toch toen tot u uit uw van veel voor want waren was wat werd wezen wie wil worden wordt zal ze zelf zich zij zijn zo zonder zou".split(" "),r.Pipeline.registerFunction(r.du.stopWordFilter,"stopWordFilter-du")}});
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
!function(e,t){"function"==typeof define&&define.amd?define(t):"object"==typeof exports?module.exports=t():t()(e.lunr)}(this,function(){return function(e){e.multiLanguage=function(){for(var t=Array.prototype.slice.call(arguments),i=t.join("-"),r="",n=[],o=0;o<t.length;++o)"en"==t[o]?(r+="\\w",n.unshift(e.stopWordFilter),n.push(e.stemmer)):(r+=e[t[o]].wordCharacters,n.unshift(e[t[o]].stopWordFilter),n.push(e[t[o]].stemmer));var u=e.trimmerSupport.generateTrimmer(r);return e.Pipeline.registerFunction(u,"lunr-multi-trimmer-"+i),n.unshift(u),function(){this.pipeline.reset(),this.pipeline.add.apply(this.pipeline,n)}}}});
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
!function(r,t){"function"==typeof define&&define.amd?define(t):"object"==typeof exports?module.exports=t():t()(r.lunr)}(this,function(){return function(r){r.stemmerSupport={Among:function(r,t,i,s){if(this.toCharArray=function(r){for(var t=r.length,i=new Array(t),s=0;t>s;s++)i[s]=r.charCodeAt(s);return i},!r&&""!=r||!t&&0!=t||!i)throw"Bad Among initialisation: s:"+r+", substring_i: "+t+", result: "+i;this.s_size=r.length,this.s=this.toCharArray(r),this.substring_i=t,this.result=i,this.method=s},SnowballProgram:function(){var r;return{bra:0,ket:0,limit:0,cursor:0,limit_backward:0,setCurrent:function(t){r=t,this.cursor=0,this.limit=t.length,this.limit_backward=0,this.bra=this.cursor,this.ket=this.limit},getCurrent:function(){var t=r;return r=null,t},in_grouping:function(t,i,s){if(this.cursor<this.limit){var e=r.charCodeAt(this.cursor);if(s>=e&&e>=i&&(e-=i,t[e>>3]&1<<(7&e)))return this.cursor++,!0}return!1},in_grouping_b:function(t,i,s){if(this.cursor>this.limit_backward){var e=r.charCodeAt(this.cursor-1);if(s>=e&&e>=i&&(e-=i,t[e>>3]&1<<(7&e)))return this.cursor--,!0}return!1},out_grouping:function(t,i,s){if(this.cursor<this.limit){var e=r.charCodeAt(this.cursor);if(e>s||i>e)return this.cursor++,!0;if(e-=i,!(t[e>>3]&1<<(7&e)))return this.cursor++,!0}return!1},out_grouping_b:function(t,i,s){if(this.cursor>this.limit_backward){var e=r.charCodeAt(this.cursor-1);if(e>s||i>e)return this.cursor--,!0;if(e-=i,!(t[e>>3]&1<<(7&e)))return this.cursor--,!0}return!1},eq_s:function(t,i){if(this.limit-this.cursor<t)return!1;for(var s=0;t>s;s++)if(r.charCodeAt(this.cursor+s)!=i.charCodeAt(s))return!1;return this.cursor+=t,!0},eq_s_b:function(t,i){if(this.cursor-this.limit_backward<t)return!1;for(var s=0;t>s;s++)if(r.charCodeAt(this.cursor-t+s)!=i.charCodeAt(s))return!1;return this.cursor-=t,!0},find_among:function(t,i){for(var s=0,e=i,n=this.cursor,u=this.limit,o=0,h=0,c=!1;;){for(var a=s+(e-s>>1),f=0,l=h>o?o:h,_=t[a],m=l;m<_.s_size;m++){if(n+l==u){f=-1;break}if(f=r.charCodeAt(n+l)-_.s[m])break;l++}if(0>f?(e=a,h=l):(s=a,o=l),1>=e-s){if(s>0||e==s||c)break;c=!0}}for(;;){var _=t[s];if(o>=_.s_size){if(this.cursor=n+_.s_size,!_.method)return _.result;var b=_.method();if(this.cursor=n+_.s_size,b)return _.result}if(s=_.substring_i,0>s)return 0}},find_among_b:function(t,i){for(var s=0,e=i,n=this.cursor,u=this.limit_backward,o=0,h=0,c=!1;;){for(var a=s+(e-s>>1),f=0,l=h>o?o:h,_=t[a],m=_.s_size-1-l;m>=0;m--){if(n-l==u){f=-1;break}if(f=r.charCodeAt(n-1-l)-_.s[m])break;l++}if(0>f?(e=a,h=l):(s=a,o=l),1>=e-s){if(s>0||e==s||c)break;c=!0}}for(;;){var _=t[s];if(o>=_.s_size){if(this.cursor=n-_.s_size,!_.method)return _.result;var b=_.method();if(this.cursor=n-_.s_size,b)return _.result}if(s=_.substring_i,0>s)return 0}},replace_s:function(t,i,s){var e=s.length-(i-t),n=r.substring(0,t),u=r.substring(i);return r=n+s+u,this.limit+=e,this.cursor>=i?this.cursor+=e:this.cursor>t&&(this.cursor=t),e},slice_check:function(){if(this.bra<0||this.bra>this.ket||this.ket>this.limit||this.limit>r.length)throw"faulty slice operation"},slice_from:function(r){this.slice_check(),this.replace_s(this.bra,this.ket,r)},slice_del:function(){this.slice_from("")},insert:function(r,t,i){var s=this.replace_s(r,t,i);r<=this.bra&&(this.bra+=s),r<=this.ket&&(this.ket+=s)},slice_to:function(){return this.slice_check(),r.substring(this.bra,this.ket)},eq_v_b:function(r){return this.eq_s_b(r.length,r)}}}},r.trimmerSupport={generateTrimmer:function(r){var t=new RegExp("^[^"+r+"]+"),i=new RegExp("[^"+r+"]+$");return function(r){return r.replace(t,"").replace(i,"")}}}}});
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment