├── .gitignore ├── .travis.yml ├── Gemfile ├── LICENSE.txt ├── README.md ├── lib ├── middleman-search.rb ├── middleman-search │ ├── extension.rb │ ├── search-index-resource.rb │ └── version.rb └── middleman_extension.rb ├── middleman-search.gemspec └── vendor └── assets └── javascripts ├── lunr.da.js ├── lunr.de.js ├── lunr.du.js ├── lunr.es.js ├── lunr.fi.js ├── lunr.fr.js ├── lunr.hu.js ├── lunr.it.js ├── lunr.jp.js ├── lunr.min.js ├── lunr.no.js ├── lunr.pt.js ├── lunr.ro.js ├── lunr.ru.js ├── lunr.stemmer.support.js ├── lunr.sv.js └── lunr.tr.js /.gitignore: -------------------------------------------------------------------------------- 1 | *.gem 2 | *.rbc 3 | .bundle 4 | .config 5 | .yardoc 6 | Gemfile.lock 7 | InstalledFiles 8 | _yardoc 9 | coverage 10 | doc/ 11 | lib/bundler/man 12 | pkg 13 | rdoc 14 | spec/reports 15 | test/tmp 16 | test/version_tmp 17 | tmp 18 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: ruby 2 | rvm: 3 | - 2.1.0 4 | - 2.0.0 5 | - 1.9.3 6 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | # Specify your gem's dependencies in middleman-search.gemspec 4 | gemspec 5 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 Matías García Isaía 2 | 3 | MIT License 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Middleman::Search 2 | 3 | LunrJS-based search for Middleman. 4 | 5 | ## Installation 6 | 7 | Add this line to your application's Gemfile: 8 | 9 | gem 'middleman-search' 10 | 11 | And then execute: 12 | 13 | $ bundle 14 | 15 | Or install it yourself as: 16 | 17 | $ gem install middleman-search 18 | 19 | ## Usage 20 | 21 | You need to activate the module in your `config.rb`, telling the extension how to index your resources: 22 | 23 | ```ruby 24 | activate :search do |search| 25 | 26 | search.resources = ['blog/', 'index.html', 'contactus/index.html'] 27 | 28 | search.index_path = 'search/lunr-index.json' # defaults to `search.json` 29 | 30 | search.lunr_dirs = ['source/vendor/lunr-custom/'] # optional alternate paths where to look for lunr js files 31 | 32 | search.language = 'es' # defaults to 'en' 33 | 34 | search.fields = { 35 | title: {boost: 100, store: true, required: true}, 36 | content: {boost: 50}, 37 | url: {index: false, store: true}, 38 | author: {boost: 30} 39 | } 40 | end 41 | ``` 42 | 43 | Where `resources` is a list of the beginning of the URL of the resources to index (tested with `String#start_with?`), `index_path` is the relative path of the generated index file in your site, and `fields` is a hash with one entry for each field to be indexed, with a hash of options associated: 44 | 45 | - `boost` Specifies lunr relevance boost when searching this field 46 | - `store` Whether to store this field in the document map (see below), defaults to false 47 | - `index` Whether to index this field, defaults to true 48 | - `required` The resource will not be indexed if a field marked as required has an empty or null value 49 | 50 | Note that a special field `id` is included automatically, with an autogenerated identifier to be used as the `ref` for the document. 51 | 52 | All fields values are retrieved from the resource `data` (i.e. its frontmatter), or from the `options` in the `resource.metadata` (i.e. any options specified in a `proxy` page), except for: 53 | - `url` which is the actual resource url 54 | - `content` the text extracted from the rendered resource, without including its layout 55 | 56 | You can then query the index from Javascript via the `lunrIndex` object (see [Index file](#index-file) for more info): 57 | 58 | ```javascript 59 | var max_search_entries = 50; 60 | 61 | var result = []; //initialize empty array 62 | 63 | lunrIndex.search(request.term).forEach( function (item, index) { 64 | if ( index < max_search_entries ) { 65 | result.push(lunrData.docs[item.ref]); 66 | } 67 | }); 68 | ``` 69 | 70 | (Thanks [@Jeepler](https://github.com/Jeepler) [for adapting](https://github.com/manastech/middleman-search/issues/11#issuecomment-220262546) the lodash v3 code [we used to use at Manas](https://manas.tech/blog/2015/10/22/middleman-search-client-side-search-in-your-middleman-site.html)) 71 | 72 | ### i18n 73 | 74 | This gem includes assets for alternate languages as provided by [MihaiValentin/lunr-languages](https://github.com/MihaiValentin/lunr-languages). Please refer to that repository for a list of the languages available. 75 | 76 | If you want to work with a language that is not included, set up a `lunr.yourlang.js` file in a folder in your project, and add that folder to `lunr_dirs` so the gem knows where to look for it. 77 | 78 | ### Manual index manipulation 79 | 80 | You can fully customise the content to be indexed and stored per resource by defining a `before_index` callback: 81 | 82 | ```ruby 83 | activate :search do |search| 84 | search.before_index = Proc.new do |to_index, to_store, resource| 85 | if author = resource.data.author 86 | to_index[:author] = data.authors[author].name 87 | end 88 | end 89 | end 90 | ``` 91 | 92 | This option accepts a callback that will be executed for each resource, and will be executed with the document to be indexed and the map to be stored, in the `index` and `docs` objects of the output respectively (see below), as well as the resource being processed. You can use this callback to modify either of those, or `throw(:skip)` to skip the resource in question. 93 | 94 | ### Lunr pipeline configuration 95 | 96 | In some cases, you may want to add new function to the lunr pipeline, both for creating the indexing and then for searching. You can do this by providing a `pipeline` hash with function names and body, for example: 97 | 98 | ```ruby 99 | activate :search do |search| 100 | search.pipeline = { 101 | tildes: <<-JS 102 | function(token, tokenIndex, tokens) { 103 | return token 104 | .replace('á', 'a') 105 | .replace('é', 'e') 106 | .replace('í', 'i') 107 | .replace('ó', 'o') 108 | .replace('ú', 'u'); 109 | } 110 | JS 111 | } 112 | end 113 | ``` 114 | 115 | This will register the `tildes` function in the lunr pipeline and add it when building the index. From the Lunr documentation: 116 | 117 | > Functions in the pipeline are called with three arguments: the current token being processed; the index of that token in the array of tokens, and the whole list of tokens part of the document being processed. This enables simple unigram processing of tokens as well as more sophisticated n-gram processing. 118 | > 119 | > The function should return the processed version of the text, which will in turn be passed to the next function in the pipeline. Returning undefined will prevent any further processing of the token, and that token will not make it to the index. 120 | 121 | Note that if you add a function to the pipeline, it will also be loaded when de-serialising the index, and lunr will fail with an `Cannot load un-registered function: tildes` error if it has not been re-registered. You can either register them manually, or simply include the following in a `.js.erb` file to be executed __before__ loading the index: 122 | ```erb 123 | <%= search_lunr_js_pipeline %> 124 | ``` 125 | 126 | 127 | ## Index file 128 | 129 | The generated index file contains a JSON object with two properties: 130 | - `index` contains the serialised lunr.js index, which you can load via `lunr.Index.load(lunrData.index)` 131 | - `docs` is a map from the autogenerated document ids to an object that contains the attributes configured for storage 132 | 133 | You will typically load the `index` into a lunr index instance, and then use the `docs` map to look up the returned value and present it to the user. 134 | 135 | You should also `require` the `lunr.min.js` file in your main sprockets javascript file (if using the asset pipeline) to be able to actually load the index: 136 | 137 | ```javascript 138 | //= require lunr.min 139 | ``` 140 | 141 | If you're using lunr's i18n capabilities, you should also load the Stemmer support and language files (in that order) here: 142 | 143 | ```javascript 144 | //= require lunr.min 145 | //= require lunr.stemmer.support 146 | //= require lunr.es 147 | ``` 148 | 149 | ### Asset pipeline 150 | 151 | The Middleman pipeline (if enabled) does not include `json` files by default, but you can easily modify this by adding `.json` to the `exts` option of the corresponding extensions, such as `gzip` and `asset_hash`: 152 | 153 | ```ruby 154 | activate :asset_hash do |asset_hash| 155 | asset_hash.exts << '.json' 156 | end 157 | ``` 158 | 159 | Note that if you run the index json file through the asset hash extension, you will need to retrieve the actual destination URL when loading the file in the browser for searching, using the `search_index_path` view helper: 160 | 161 | ```javascript 162 | var lunrIndex = null; 163 | var lunrData = null; 164 | 165 | // Download index data 166 | $.ajax({ 167 | url: "<%= search_index_path %>", 168 | cache: true, 169 | method: 'GET', 170 | success: function(data) { 171 | lunrData = data; 172 | lunrIndex = lunr.Index.load(lunrData.index); 173 | } 174 | }); 175 | ``` 176 | 177 | ## Acknowledgments 178 | 179 | A big thank you to: 180 | - [Octo-Labs](https://github.com/Octo-Labs)'s [jagthedrummer](https://github.com/jagthedrummer) for his [`middleman-alias`](https://github.com/Octo-Labs/middleman-alias) extension, in which we based for developing this one. 181 | - [jnovos](https://github.com/jnovos) and [256dpi](https://github.com/256dpi), for their [`middleman-lunrjs`](https://github.com/jnovos/middleman-lunrjs) and [`middleman-lunr`](https://github.com/256dpi/middleman-lunr) extensions, which served as inspirations for making this one. 182 | - [olivernn](https://github.com/olivernn) and all [`lunr.js`](http://lunrjs.com/) [contributors](https://github.com/olivernn/lunr.js/graphs/contributors) 183 | - [MihaiValentin](https://github.com/MihaiValentin) for the support for 10+ languages in [lunr-languages](https://github.com/MihaiValentin/lunr-languages). 184 | - [The Middleman](https://middlemanapp.com/) [team](https://github.com/orgs/middleman/people) and [contributors](https://github.com/middleman/middleman/graphs/contributors) 185 | -------------------------------------------------------------------------------- /lib/middleman-search.rb: -------------------------------------------------------------------------------- 1 | require 'middleman-core' 2 | require "middleman-search/version" 3 | 4 | ::Middleman::Extensions.register(:search) do 5 | require 'middleman-search/extension' 6 | ::Middleman::SearchExtension 7 | end 8 | -------------------------------------------------------------------------------- /lib/middleman-search/extension.rb: -------------------------------------------------------------------------------- 1 | require 'middleman-core' 2 | require 'middleman-search/search-index-resource' 3 | 4 | module Middleman 5 | class SearchExtension < Middleman::Extension 6 | option :resources, [], 'Paths of resources to index' 7 | option :fields, {}, 'Fields to index, with their options' 8 | option :before_index, nil, 'Callback to execute before indexing a document' 9 | option :index_path, 'search.json', 'Index file path' 10 | option :pipeline, {}, 'Javascript pipeline functions to use in lunr index' 11 | option :cache, false, 'Avoid the cache to be rebuilt on every request in development mode' 12 | option :language, 'en', 'Language code ("es", "fr") to use when indexing site\'s content' 13 | option :lunr_dirs, [], 'Directories in which to look for custom lunr.js files' 14 | 15 | def manipulate_resource_list(resources) 16 | resources.push Middleman::Sitemap::SearchIndexResource.new(@app.sitemap, @options[:index_path], @options) 17 | resources 18 | end 19 | 20 | helpers do 21 | def search_lunr_js_pipeline 22 | # Thanks http://stackoverflow.com/a/20187415/12791 23 | extensions[:search].options[:pipeline].map do |name, function| 24 | "lunr.Pipeline.registerFunction(#{function}, '#{name}');" 25 | end.join("\n") 26 | end 27 | 28 | def search_index_path 29 | (config || app.config)[:http_prefix] + sitemap.find_resource_by_path(extensions[:search].options[:index_path]).destination_path 30 | end 31 | end 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /lib/middleman-search/search-index-resource.rb: -------------------------------------------------------------------------------- 1 | # encoding: UTF-8 2 | 3 | module Middleman 4 | module Sitemap 5 | class SearchIndexResource < ::Middleman::Sitemap::Resource 6 | def initialize(store, path, options) 7 | @resources_to_index = options[:resources] 8 | @fields = options[:fields] 9 | @callback = options[:before_index] 10 | @pipeline = options[:pipeline] 11 | @cache_index = options[:cache] 12 | @language = options[:language] 13 | @lunr_dirs = options[:lunr_dirs] + [File.expand_path("../../../vendor/assets/javascripts/", __FILE__)] 14 | super(store, path) 15 | end 16 | 17 | def template? 18 | false 19 | end 20 | 21 | def get_source_file 22 | path 23 | end 24 | 25 | def render(opts={}, locs={}) 26 | if @cache_index 27 | @index ||= build_index 28 | else 29 | build_index 30 | end 31 | end 32 | 33 | def build_index 34 | # Build js context 35 | context = V8::Context.new 36 | context.load(lunr_resource('lunr.js')) 37 | 38 | if @language != 'en' # English is the default 39 | context.load(lunr_resource("lunr.stemmer.support.js")) 40 | context.load(lunr_resource("lunr.#{@language}.js")) 41 | lunr_lang = context.eval("lunr.#{@language}") 42 | end 43 | 44 | context.eval('lunr.Index.prototype.indexJson = function () {return JSON.stringify(this.toJSON());}') 45 | 46 | # Register pipeline functions 47 | pipeline = context.eval('lunr.Pipeline') 48 | @pipeline.each do |name, function| 49 | context[name] = context.eval("(#{function})") 50 | pipeline.registerFunction(context[name], name) 51 | end 52 | 53 | # Build lunr based on config 54 | lunr = context.eval('lunr') 55 | lunr_conf = proc do |this| 56 | 57 | # Use autogenerated id field as reference 58 | this.ref('id') 59 | 60 | # Add functions to pipeline (just registering them isn't enough) 61 | @pipeline.each do |name, function| 62 | this.pipeline.add(context[name]) 63 | end 64 | 65 | # Define fields with boost 66 | this.use(lunr_lang) if @language != 'en' 67 | @fields.each do |field, opts| 68 | next if opts[:index] == false 69 | this.field(field, {:boost => opts[:boost]}) 70 | end 71 | end 72 | 73 | # Get lunr index 74 | index = lunr.call(lunr_conf) 75 | 76 | # Ref to resource map 77 | store = Hash.new 78 | 79 | # Iterate over all resources and build index 80 | @app.sitemap.resources.each_with_index do |resource, id| 81 | begin 82 | catch(:skip) do 83 | next if resource.data['index'] == false 84 | next unless @resources_to_index.any? {|whitelisted| resource.path.start_with? whitelisted } 85 | 86 | to_index = Hash.new 87 | to_store = Hash.new 88 | 89 | @fields.each do |field, opts| 90 | value = value_for(resource, field, opts) 91 | throw(:skip) if value.blank? && opts[:required] 92 | to_index[field] = value unless opts[:index] == false 93 | to_store[field] = value if opts[:store] 94 | end 95 | 96 | @callback.call(to_index, to_store, resource) if @callback 97 | 98 | index.add(to_index.merge(id: id)) 99 | store[id] = to_store 100 | end 101 | rescue => ex 102 | @app.logger.warn "Error processing resource for index: #{resource.path}\n#{ex}\n #{ex.backtrace.join("\n ")}" 103 | end 104 | end 105 | 106 | # Generate JSON output 107 | "{\"index\": #{index.indexJson()}, \"docs\": #{store.to_json}}" 108 | end 109 | 110 | def binary? 111 | false 112 | end 113 | 114 | def ignored? 115 | false 116 | end 117 | 118 | def value_for(resource, field, opts={}) 119 | case field.to_s 120 | when 'content' 121 | 122 | html = resource.render( { :layout => false }, { :current_path => resource.path } ) 123 | Nokogiri::HTML(html).xpath("//text()").text 124 | when 'url' 125 | resource.url 126 | else 127 | value = resource.data.send(field) || resource.metadata.fetch(:options, {}).fetch(field, nil) 128 | value ? Array(value).compact.join(" ") : nil 129 | end 130 | end 131 | 132 | private 133 | 134 | def minified_path(resource_name) 135 | return resource_name if resource_name.end_with? '.min.js' 136 | return resource_name unless resource_name.end_with? '.js' 137 | resource_name.sub(/(.*)\.js$/,'\1.min.js') 138 | end 139 | 140 | def lunr_resource(resource_name) 141 | @lunr_dirs.flat_map do |dir| 142 | [File.join(dir, minified_path(resource_name)), File.join(dir, resource_name)] 143 | end.detect { |file| File.exists? file } or raise "Couldn't find #{resource_name} nor #{minified_path(resource_name)} in #{@lunr_dirs.map {|dir| File.absolute_path dir }.join File::PATH_SEPARATOR}" 144 | end 145 | end 146 | end 147 | end 148 | -------------------------------------------------------------------------------- /lib/middleman-search/version.rb: -------------------------------------------------------------------------------- 1 | module MiddlemanSearch 2 | VERSION = "0.10.0" 3 | end 4 | -------------------------------------------------------------------------------- /lib/middleman_extension.rb: -------------------------------------------------------------------------------- 1 | require "middleman-search" 2 | -------------------------------------------------------------------------------- /middleman-search.gemspec: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | lib = File.expand_path('../lib', __FILE__) 3 | $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) 4 | require 'middleman-search/version' 5 | 6 | Gem::Specification.new do |spec| 7 | spec.name = "middleman-search" 8 | spec.version = MiddlemanSearch::VERSION 9 | spec.authors = ["Matías García Isaía", "Santiago Palladino"] 10 | spec.email = ["mgarcia@manas.com.ar", "spalladino@manas.com.ar"] 11 | spec.summary = %q{LunrJS-based search for Middleman} 12 | spec.description = %q{LunrJS-based search for Middleman} 13 | spec.homepage = "http://github.com/manastech/middleman-search" 14 | spec.license = "MIT" 15 | 16 | spec.files = `git ls-files`.split($/) 17 | spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } 18 | spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) 19 | spec.require_paths = ["lib"] 20 | 21 | spec.add_dependency "middleman-core", [">= 3.2"] 22 | spec.add_dependency "therubyracer", ["~> 0.12.2"] 23 | spec.add_dependency "nokogiri", ["~> 1.6"] 24 | 25 | spec.add_development_dependency "bundler", "~> 1.5" 26 | spec.add_development_dependency "rake" 27 | end 28 | -------------------------------------------------------------------------------- /vendor/assets/javascripts/lunr.da.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Lunr languages, `Danish` 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.da = function() { 57 | this.pipeline.reset(); 58 | this.pipeline.add( 59 | lunr.da.stopWordFilter, 60 | lunr.da.stemmer 61 | ); 62 | }; 63 | 64 | /* lunr stemmer function */ 65 | lunr.da.stemmer = (function() { 66 | /* create the wrapped stemmer object */ 67 | var Among = lunr.stemmerSupport.Among, 68 | SnowballProgram = lunr.stemmerSupport.SnowballProgram, 69 | st = new function DanishStemmer() { 70 | var a_0 = [new Among("hed", -1, 1), new Among("ethed", 0, 1), 71 | new Among("ered", -1, 1), new Among("e", -1, 1), 72 | new Among("erede", 3, 1), new Among("ende", 3, 1), 73 | new Among("erende", 5, 1), new Among("ene", 3, 1), 74 | new Among("erne", 3, 1), new Among("ere", 3, 1), 75 | new Among("en", -1, 1), new Among("heden", 10, 1), 76 | new Among("eren", 10, 1), new Among("er", -1, 1), 77 | new Among("heder", 13, 1), new Among("erer", 13, 1), 78 | new Among("s", -1, 2), new Among("heds", 16, 1), 79 | new Among("es", 16, 1), new Among("endes", 18, 1), 80 | new Among("erendes", 19, 1), new Among("enes", 18, 1), 81 | new Among("ernes", 18, 1), new Among("eres", 18, 1), 82 | new Among("ens", 16, 1), new Among("hedens", 24, 1), 83 | new Among("erens", 24, 1), new Among("ers", 16, 1), 84 | new Among("ets", 16, 1), new Among("erets", 28, 1), 85 | new Among("et", -1, 1), new Among("eret", 30, 1) 86 | ], 87 | a_1 = [ 88 | new Among("gd", -1, -1), new Among("dt", -1, -1), 89 | new Among("gt", -1, -1), new Among("kt", -1, -1) 90 | ], 91 | a_2 = [ 92 | new Among("ig", -1, 1), new Among("lig", 0, 1), 93 | new Among("elig", 1, 1), new Among("els", -1, 1), 94 | new Among("l\u00F8st", -1, 2) 95 | ], 96 | g_v = [17, 65, 16, 1, 0, 0, 0, 0, 97 | 0, 0, 0, 0, 0, 0, 0, 0, 48, 0, 128 98 | ], 99 | g_s_ending = [239, 254, 42, 3, 100 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16 101 | ], 102 | I_x, I_p1, S_ch, 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 | sbp.cursor = v_1; 122 | if (v_1 >= sbp.limit) 123 | return; 124 | sbp.cursor++; 125 | } 126 | while (!sbp.out_grouping(g_v, 97, 248)) { 127 | if (sbp.cursor >= sbp.limit) 128 | return; 129 | sbp.cursor++; 130 | } 131 | I_p1 = sbp.cursor; 132 | if (I_p1 < I_x) 133 | I_p1 = I_x; 134 | } 135 | } 136 | 137 | function r_main_suffix() { 138 | var among_var, v_1; 139 | if (sbp.cursor >= I_p1) { 140 | v_1 = sbp.limit_backward; 141 | sbp.limit_backward = I_p1; 142 | sbp.ket = sbp.cursor; 143 | among_var = sbp.find_among_b(a_0, 32); 144 | sbp.limit_backward = v_1; 145 | if (among_var) { 146 | sbp.bra = sbp.cursor; 147 | switch (among_var) { 148 | case 1: 149 | sbp.slice_del(); 150 | break; 151 | case 2: 152 | if (sbp.in_grouping_b(g_s_ending, 97, 229)) 153 | sbp.slice_del(); 154 | break; 155 | } 156 | } 157 | } 158 | } 159 | 160 | function r_consonant_pair() { 161 | var v_1 = sbp.limit - sbp.cursor, 162 | v_2; 163 | if (sbp.cursor >= I_p1) { 164 | v_2 = sbp.limit_backward; 165 | sbp.limit_backward = I_p1; 166 | sbp.ket = sbp.cursor; 167 | if (sbp.find_among_b(a_1, 4)) { 168 | sbp.bra = sbp.cursor; 169 | sbp.limit_backward = v_2; 170 | sbp.cursor = sbp.limit - v_1; 171 | if (sbp.cursor > sbp.limit_backward) { 172 | sbp.cursor--; 173 | sbp.bra = sbp.cursor; 174 | sbp.slice_del(); 175 | } 176 | } else 177 | sbp.limit_backward = v_2; 178 | } 179 | } 180 | 181 | function r_other_suffix() { 182 | var among_var, v_1 = sbp.limit - sbp.cursor, 183 | v_2, v_3; 184 | sbp.ket = sbp.cursor; 185 | if (sbp.eq_s_b(2, "st")) { 186 | sbp.bra = sbp.cursor; 187 | if (sbp.eq_s_b(2, "ig")) 188 | sbp.slice_del(); 189 | } 190 | sbp.cursor = sbp.limit - v_1; 191 | if (sbp.cursor >= I_p1) { 192 | v_2 = sbp.limit_backward; 193 | sbp.limit_backward = I_p1; 194 | sbp.ket = sbp.cursor; 195 | among_var = sbp.find_among_b(a_2, 5); 196 | sbp.limit_backward = v_2; 197 | if (among_var) { 198 | sbp.bra = sbp.cursor; 199 | switch (among_var) { 200 | case 1: 201 | sbp.slice_del(); 202 | v_3 = sbp.limit - sbp.cursor; 203 | r_consonant_pair(); 204 | sbp.cursor = sbp.limit - v_3; 205 | break; 206 | case 2: 207 | sbp.slice_from("l\u00F8s"); 208 | break; 209 | } 210 | } 211 | } 212 | } 213 | 214 | function r_undouble() { 215 | var v_1; 216 | if (sbp.cursor >= I_p1) { 217 | v_1 = sbp.limit_backward; 218 | sbp.limit_backward = I_p1; 219 | sbp.ket = sbp.cursor; 220 | if (sbp.out_grouping_b(g_v, 97, 248)) { 221 | sbp.bra = sbp.cursor; 222 | S_ch = sbp.slice_to(S_ch); 223 | sbp.limit_backward = v_1; 224 | if (sbp.eq_v_b(S_ch)) 225 | sbp.slice_del(); 226 | } else 227 | sbp.limit_backward = v_1; 228 | } 229 | } 230 | this.stem = function() { 231 | var v_1 = sbp.cursor; 232 | r_mark_regions(); 233 | sbp.limit_backward = v_1; 234 | sbp.cursor = sbp.limit; 235 | r_main_suffix(); 236 | sbp.cursor = sbp.limit; 237 | r_consonant_pair(); 238 | sbp.cursor = sbp.limit; 239 | r_other_suffix(); 240 | sbp.cursor = sbp.limit; 241 | r_undouble(); 242 | return true; 243 | } 244 | }; 245 | 246 | /* and return a function that stems a word for the current locale */ 247 | return function(word) { 248 | st.setCurrent(word); 249 | st.stem(); 250 | return st.getCurrent(); 251 | } 252 | })(); 253 | 254 | lunr.Pipeline.registerFunction(lunr.da.stemmer, 'stemmer-da'); 255 | 256 | /* stop word filter function */ 257 | lunr.da.stopWordFilter = function(token) { 258 | if (lunr.da.stopWordFilter.stopWords.indexOf(token) === -1) { 259 | return token; 260 | } 261 | }; 262 | 263 | lunr.da.stopWordFilter.stopWords = new lunr.SortedSet(); 264 | lunr.da.stopWordFilter.stopWords.length = 95; 265 | 266 | // The space at the beginning is crucial: It marks the empty string 267 | // as a stop word. lunr.js crashes during search when documents 268 | // processed by the pipeline still contain the empty string. 269 | lunr.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(' '); 270 | 271 | lunr.Pipeline.registerFunction(lunr.da.stopWordFilter, 'stopWordFilter-da'); 272 | }; 273 | })) -------------------------------------------------------------------------------- /vendor/assets/javascripts/lunr.de.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Lunr languages, `German` 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.de = function() { 57 | this.pipeline.reset(); 58 | this.pipeline.add( 59 | lunr.de.stopWordFilter, 60 | lunr.de.stemmer 61 | ); 62 | }; 63 | 64 | /* lunr stemmer function */ 65 | lunr.de.stemmer = (function() { 66 | /* create the wrapped stemmer object */ 67 | var Among = lunr.stemmerSupport.Among, 68 | SnowballProgram = lunr.stemmerSupport.SnowballProgram, 69 | st = new function GermanStemmer() { 70 | var a_0 = [new Among("", -1, 6), new Among("U", 0, 2), 71 | new Among("Y", 0, 1), new Among("\u00E4", 0, 3), 72 | new Among("\u00F6", 0, 4), new Among("\u00FC", 0, 5) 73 | ], 74 | a_1 = [ 75 | new Among("e", -1, 2), new Among("em", -1, 1), 76 | new Among("en", -1, 2), new Among("ern", -1, 1), 77 | new Among("er", -1, 1), new Among("s", -1, 3), 78 | new Among("es", 5, 2) 79 | ], 80 | a_2 = [new Among("en", -1, 1), 81 | new Among("er", -1, 1), new Among("st", -1, 2), 82 | new Among("est", 2, 1) 83 | ], 84 | a_3 = [new Among("ig", -1, 1), 85 | new Among("lich", -1, 1) 86 | ], 87 | a_4 = [new Among("end", -1, 1), 88 | new Among("ig", -1, 2), new Among("ung", -1, 1), 89 | new Among("lich", -1, 3), new Among("isch", -1, 2), 90 | new Among("ik", -1, 2), new Among("heit", -1, 3), 91 | new Among("keit", -1, 4) 92 | ], 93 | g_v = [17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 94 | 0, 0, 0, 0, 0, 0, 8, 0, 32, 8 95 | ], 96 | g_s_ending = [117, 30, 5], 97 | g_st_ending = [ 98 | 117, 30, 4 99 | ], 100 | I_x, I_p2, I_p1, sbp = new SnowballProgram(); 101 | this.setCurrent = function(word) { 102 | sbp.setCurrent(word); 103 | }; 104 | this.getCurrent = function() { 105 | return sbp.getCurrent(); 106 | }; 107 | 108 | function habr1(c1, c2, v_1) { 109 | if (sbp.eq_s(1, c1)) { 110 | sbp.ket = sbp.cursor; 111 | if (sbp.in_grouping(g_v, 97, 252)) { 112 | sbp.slice_from(c2); 113 | sbp.cursor = v_1; 114 | return true; 115 | } 116 | } 117 | return false; 118 | } 119 | 120 | function r_prelude() { 121 | var v_1 = sbp.cursor, 122 | v_2, v_3, v_4, v_5; 123 | while (true) { 124 | v_2 = sbp.cursor; 125 | sbp.bra = v_2; 126 | if (sbp.eq_s(1, "\u00DF")) { 127 | sbp.ket = sbp.cursor; 128 | sbp.slice_from("ss"); 129 | } else { 130 | if (v_2 >= sbp.limit) 131 | break; 132 | sbp.cursor = v_2 + 1; 133 | } 134 | } 135 | sbp.cursor = v_1; 136 | while (true) { 137 | v_3 = sbp.cursor; 138 | while (true) { 139 | v_4 = sbp.cursor; 140 | if (sbp.in_grouping(g_v, 97, 252)) { 141 | v_5 = sbp.cursor; 142 | sbp.bra = v_5; 143 | if (habr1("u", "U", v_4)) 144 | break; 145 | sbp.cursor = v_5; 146 | if (habr1("y", "Y", v_4)) 147 | break; 148 | } 149 | if (v_4 >= sbp.limit) { 150 | sbp.cursor = v_3; 151 | return; 152 | } 153 | sbp.cursor = v_4 + 1; 154 | } 155 | } 156 | } 157 | 158 | function habr2() { 159 | while (!sbp.in_grouping(g_v, 97, 252)) { 160 | if (sbp.cursor >= sbp.limit) 161 | return true; 162 | sbp.cursor++; 163 | } 164 | while (!sbp.out_grouping(g_v, 97, 252)) { 165 | if (sbp.cursor >= sbp.limit) 166 | return true; 167 | sbp.cursor++; 168 | } 169 | return false; 170 | } 171 | 172 | function r_mark_regions() { 173 | I_p1 = sbp.limit; 174 | I_p2 = I_p1; 175 | var c = sbp.cursor + 3; 176 | if (0 <= c && c <= sbp.limit) { 177 | I_x = c; 178 | if (!habr2()) { 179 | I_p1 = sbp.cursor; 180 | if (I_p1 < I_x) 181 | I_p1 = I_x; 182 | if (!habr2()) 183 | I_p2 = sbp.cursor; 184 | } 185 | } 186 | } 187 | 188 | function r_postlude() { 189 | var among_var, v_1; 190 | while (true) { 191 | v_1 = sbp.cursor; 192 | sbp.bra = v_1; 193 | among_var = sbp.find_among(a_0, 6); 194 | if (!among_var) 195 | return; 196 | sbp.ket = sbp.cursor; 197 | switch (among_var) { 198 | case 1: 199 | sbp.slice_from("y"); 200 | break; 201 | case 2: 202 | case 5: 203 | sbp.slice_from("u"); 204 | break; 205 | case 3: 206 | sbp.slice_from("a"); 207 | break; 208 | case 4: 209 | sbp.slice_from("o"); 210 | break; 211 | case 6: 212 | if (sbp.cursor >= sbp.limit) 213 | return; 214 | sbp.cursor++; 215 | break; 216 | } 217 | } 218 | } 219 | 220 | function r_R1() { 221 | return I_p1 <= sbp.cursor; 222 | } 223 | 224 | function r_R2() { 225 | return I_p2 <= sbp.cursor; 226 | } 227 | 228 | function r_standard_suffix() { 229 | var among_var, v_1 = sbp.limit - sbp.cursor, 230 | v_2, v_3, v_4; 231 | sbp.ket = sbp.cursor; 232 | among_var = sbp.find_among_b(a_1, 7); 233 | if (among_var) { 234 | sbp.bra = sbp.cursor; 235 | if (r_R1()) { 236 | switch (among_var) { 237 | case 1: 238 | sbp.slice_del(); 239 | break; 240 | case 2: 241 | sbp.slice_del(); 242 | sbp.ket = sbp.cursor; 243 | if (sbp.eq_s_b(1, "s")) { 244 | sbp.bra = sbp.cursor; 245 | if (sbp.eq_s_b(3, "nis")) 246 | sbp.slice_del(); 247 | } 248 | break; 249 | case 3: 250 | if (sbp.in_grouping_b(g_s_ending, 98, 116)) 251 | sbp.slice_del(); 252 | break; 253 | } 254 | } 255 | } 256 | sbp.cursor = sbp.limit - v_1; 257 | sbp.ket = sbp.cursor; 258 | among_var = sbp.find_among_b(a_2, 4); 259 | if (among_var) { 260 | sbp.bra = sbp.cursor; 261 | if (r_R1()) { 262 | switch (among_var) { 263 | case 1: 264 | sbp.slice_del(); 265 | break; 266 | case 2: 267 | if (sbp.in_grouping_b(g_st_ending, 98, 116)) { 268 | var c = sbp.cursor - 3; 269 | if (sbp.limit_backward <= c && c <= sbp.limit) { 270 | sbp.cursor = c; 271 | sbp.slice_del(); 272 | } 273 | } 274 | break; 275 | } 276 | } 277 | } 278 | sbp.cursor = sbp.limit - v_1; 279 | sbp.ket = sbp.cursor; 280 | among_var = sbp.find_among_b(a_4, 8); 281 | if (among_var) { 282 | sbp.bra = sbp.cursor; 283 | if (r_R2()) { 284 | switch (among_var) { 285 | case 1: 286 | sbp.slice_del(); 287 | sbp.ket = sbp.cursor; 288 | if (sbp.eq_s_b(2, "ig")) { 289 | sbp.bra = sbp.cursor; 290 | v_2 = sbp.limit - sbp.cursor; 291 | if (!sbp.eq_s_b(1, "e")) { 292 | sbp.cursor = sbp.limit - v_2; 293 | if (r_R2()) 294 | sbp.slice_del(); 295 | } 296 | } 297 | break; 298 | case 2: 299 | v_3 = sbp.limit - sbp.cursor; 300 | if (!sbp.eq_s_b(1, "e")) { 301 | sbp.cursor = sbp.limit - v_3; 302 | sbp.slice_del(); 303 | } 304 | break; 305 | case 3: 306 | sbp.slice_del(); 307 | sbp.ket = sbp.cursor; 308 | v_4 = sbp.limit - sbp.cursor; 309 | if (!sbp.eq_s_b(2, "er")) { 310 | sbp.cursor = sbp.limit - v_4; 311 | if (!sbp.eq_s_b(2, "en")) 312 | break; 313 | } 314 | sbp.bra = sbp.cursor; 315 | if (r_R1()) 316 | sbp.slice_del(); 317 | break; 318 | case 4: 319 | sbp.slice_del(); 320 | sbp.ket = sbp.cursor; 321 | among_var = sbp.find_among_b(a_3, 2); 322 | if (among_var) { 323 | sbp.bra = sbp.cursor; 324 | if (r_R2() && among_var == 1) 325 | sbp.slice_del(); 326 | } 327 | break; 328 | } 329 | } 330 | } 331 | } 332 | this.stem = function() { 333 | var v_1 = sbp.cursor; 334 | r_prelude(); 335 | sbp.cursor = v_1; 336 | r_mark_regions(); 337 | sbp.limit_backward = v_1; 338 | sbp.cursor = sbp.limit; 339 | r_standard_suffix(); 340 | sbp.cursor = sbp.limit_backward; 341 | r_postlude(); 342 | return true; 343 | } 344 | }; 345 | 346 | /* and return a function that stems a word for the current locale */ 347 | return function(word) { 348 | st.setCurrent(word); 349 | st.stem(); 350 | return st.getCurrent(); 351 | } 352 | })(); 353 | 354 | lunr.Pipeline.registerFunction(lunr.de.stemmer, 'stemmer-de'); 355 | 356 | /* stop word filter function */ 357 | lunr.de.stopWordFilter = function(token) { 358 | if (lunr.de.stopWordFilter.stopWords.indexOf(token) === -1) { 359 | return token; 360 | } 361 | }; 362 | 363 | lunr.de.stopWordFilter.stopWords = new lunr.SortedSet(); 364 | lunr.de.stopWordFilter.stopWords.length = 232; 365 | 366 | // The space at the beginning is crucial: It marks the empty string 367 | // as a stop word. lunr.js crashes during search when documents 368 | // processed by the pipeline still contain the empty string. 369 | lunr.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(' '); 370 | 371 | lunr.Pipeline.registerFunction(lunr.de.stopWordFilter, 'stopWordFilter-de'); 372 | }; 373 | })) -------------------------------------------------------------------------------- /vendor/assets/javascripts/lunr.du.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Lunr languages, `Dutch` 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.du = function() { 57 | this.pipeline.reset(); 58 | this.pipeline.add( 59 | lunr.du.stopWordFilter, 60 | lunr.du.stemmer 61 | ); 62 | }; 63 | 64 | /* lunr stemmer function */ 65 | lunr.du.stemmer = (function() { 66 | /* create the wrapped stemmer object */ 67 | var Among = lunr.stemmerSupport.Among, 68 | SnowballProgram = lunr.stemmerSupport.SnowballProgram, 69 | st = new function DutchStemmer() { 70 | var a_0 = [new Among("", -1, 6), new Among("\u00E1", 0, 1), 71 | new Among("\u00E4", 0, 1), new Among("\u00E9", 0, 2), 72 | new Among("\u00EB", 0, 2), new Among("\u00ED", 0, 3), 73 | new Among("\u00EF", 0, 3), new Among("\u00F3", 0, 4), 74 | new Among("\u00F6", 0, 4), new Among("\u00FA", 0, 5), 75 | new Among("\u00FC", 0, 5) 76 | ], 77 | a_1 = [new Among("", -1, 3), 78 | new Among("I", 0, 2), new Among("Y", 0, 1) 79 | ], 80 | a_2 = [ 81 | new Among("dd", -1, -1), new Among("kk", -1, -1), 82 | new Among("tt", -1, -1) 83 | ], 84 | a_3 = [new Among("ene", -1, 2), 85 | new Among("se", -1, 3), new Among("en", -1, 2), 86 | new Among("heden", 2, 1), new Among("s", -1, 3) 87 | ], 88 | a_4 = [ 89 | new Among("end", -1, 1), new Among("ig", -1, 2), 90 | new Among("ing", -1, 1), new Among("lijk", -1, 3), 91 | new Among("baar", -1, 4), new Among("bar", -1, 5) 92 | ], 93 | a_5 = [ 94 | new Among("aa", -1, -1), new Among("ee", -1, -1), 95 | new Among("oo", -1, -1), new Among("uu", -1, -1) 96 | ], 97 | g_v = [17, 65, 98 | 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128 99 | ], 100 | g_v_I = [1, 0, 0, 101 | 17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128 102 | ], 103 | g_v_j = [ 104 | 17, 67, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128 105 | ], 106 | I_p2, I_p1, B_e_found, sbp = new SnowballProgram(); 107 | this.setCurrent = function(word) { 108 | sbp.setCurrent(word); 109 | }; 110 | this.getCurrent = function() { 111 | return sbp.getCurrent(); 112 | }; 113 | 114 | function r_prelude() { 115 | var among_var, v_1 = sbp.cursor, 116 | v_2, v_3; 117 | while (true) { 118 | sbp.bra = sbp.cursor; 119 | among_var = sbp.find_among(a_0, 11); 120 | if (among_var) { 121 | sbp.ket = sbp.cursor; 122 | switch (among_var) { 123 | case 1: 124 | sbp.slice_from("a"); 125 | continue; 126 | case 2: 127 | sbp.slice_from("e"); 128 | continue; 129 | case 3: 130 | sbp.slice_from("i"); 131 | continue; 132 | case 4: 133 | sbp.slice_from("o"); 134 | continue; 135 | case 5: 136 | sbp.slice_from("u"); 137 | continue; 138 | case 6: 139 | if (sbp.cursor >= sbp.limit) 140 | break; 141 | sbp.cursor++; 142 | continue; 143 | } 144 | } 145 | break; 146 | } 147 | sbp.cursor = v_1; 148 | sbp.bra = v_1; 149 | if (sbp.eq_s(1, "y")) { 150 | sbp.ket = sbp.cursor; 151 | sbp.slice_from("Y"); 152 | } else 153 | sbp.cursor = v_1; 154 | while (true) { 155 | v_2 = sbp.cursor; 156 | if (sbp.in_grouping(g_v, 97, 232)) { 157 | v_3 = sbp.cursor; 158 | sbp.bra = v_3; 159 | if (sbp.eq_s(1, "i")) { 160 | sbp.ket = sbp.cursor; 161 | if (sbp.in_grouping(g_v, 97, 232)) { 162 | sbp.slice_from("I"); 163 | sbp.cursor = v_2; 164 | } 165 | } else { 166 | sbp.cursor = v_3; 167 | if (sbp.eq_s(1, "y")) { 168 | sbp.ket = sbp.cursor; 169 | sbp.slice_from("Y"); 170 | sbp.cursor = v_2; 171 | } else if (habr1(v_2)) 172 | break; 173 | } 174 | } else if (habr1(v_2)) 175 | break; 176 | } 177 | } 178 | 179 | function habr1(v_1) { 180 | sbp.cursor = v_1; 181 | if (v_1 >= sbp.limit) 182 | return true; 183 | sbp.cursor++; 184 | return false; 185 | } 186 | 187 | function r_mark_regions() { 188 | I_p1 = sbp.limit; 189 | I_p2 = I_p1; 190 | if (!habr2()) { 191 | I_p1 = sbp.cursor; 192 | if (I_p1 < 3) 193 | I_p1 = 3; 194 | if (!habr2()) 195 | I_p2 = sbp.cursor; 196 | } 197 | } 198 | 199 | function habr2() { 200 | while (!sbp.in_grouping(g_v, 97, 232)) { 201 | if (sbp.cursor >= sbp.limit) 202 | return true; 203 | sbp.cursor++; 204 | } 205 | while (!sbp.out_grouping(g_v, 97, 232)) { 206 | if (sbp.cursor >= sbp.limit) 207 | return true; 208 | sbp.cursor++; 209 | } 210 | return false; 211 | } 212 | 213 | function r_postlude() { 214 | var among_var; 215 | while (true) { 216 | sbp.bra = sbp.cursor; 217 | among_var = sbp.find_among(a_1, 3); 218 | if (among_var) { 219 | sbp.ket = sbp.cursor; 220 | switch (among_var) { 221 | case 1: 222 | sbp.slice_from("y"); 223 | break; 224 | case 2: 225 | sbp.slice_from("i"); 226 | break; 227 | case 3: 228 | if (sbp.cursor >= sbp.limit) 229 | return; 230 | sbp.cursor++; 231 | break; 232 | } 233 | } 234 | } 235 | } 236 | 237 | function r_R1() { 238 | return I_p1 <= sbp.cursor; 239 | } 240 | 241 | function r_R2() { 242 | return I_p2 <= sbp.cursor; 243 | } 244 | 245 | function r_undouble() { 246 | var v_1 = sbp.limit - sbp.cursor; 247 | if (sbp.find_among_b(a_2, 3)) { 248 | sbp.cursor = sbp.limit - v_1; 249 | sbp.ket = sbp.cursor; 250 | if (sbp.cursor > sbp.limit_backward) { 251 | sbp.cursor--; 252 | sbp.bra = sbp.cursor; 253 | sbp.slice_del(); 254 | } 255 | } 256 | } 257 | 258 | function r_e_ending() { 259 | var v_1; 260 | B_e_found = false; 261 | sbp.ket = sbp.cursor; 262 | if (sbp.eq_s_b(1, "e")) { 263 | sbp.bra = sbp.cursor; 264 | if (r_R1()) { 265 | v_1 = sbp.limit - sbp.cursor; 266 | if (sbp.out_grouping_b(g_v, 97, 232)) { 267 | sbp.cursor = sbp.limit - v_1; 268 | sbp.slice_del(); 269 | B_e_found = true; 270 | r_undouble(); 271 | } 272 | } 273 | } 274 | } 275 | 276 | function r_en_ending() { 277 | var v_1; 278 | if (r_R1()) { 279 | v_1 = sbp.limit - sbp.cursor; 280 | if (sbp.out_grouping_b(g_v, 97, 232)) { 281 | sbp.cursor = sbp.limit - v_1; 282 | if (!sbp.eq_s_b(3, "gem")) { 283 | sbp.cursor = sbp.limit - v_1; 284 | sbp.slice_del(); 285 | r_undouble(); 286 | } 287 | } 288 | } 289 | } 290 | 291 | function r_standard_suffix() { 292 | var among_var, v_1 = sbp.limit - sbp.cursor, 293 | v_2, v_3, v_4, v_5, v_6; 294 | sbp.ket = sbp.cursor; 295 | among_var = sbp.find_among_b(a_3, 5); 296 | if (among_var) { 297 | sbp.bra = sbp.cursor; 298 | switch (among_var) { 299 | case 1: 300 | if (r_R1()) 301 | sbp.slice_from("heid"); 302 | break; 303 | case 2: 304 | r_en_ending(); 305 | break; 306 | case 3: 307 | if (r_R1() && sbp.out_grouping_b(g_v_j, 97, 232)) 308 | sbp.slice_del(); 309 | break; 310 | } 311 | } 312 | sbp.cursor = sbp.limit - v_1; 313 | r_e_ending(); 314 | sbp.cursor = sbp.limit - v_1; 315 | sbp.ket = sbp.cursor; 316 | if (sbp.eq_s_b(4, "heid")) { 317 | sbp.bra = sbp.cursor; 318 | if (r_R2()) { 319 | v_2 = sbp.limit - sbp.cursor; 320 | if (!sbp.eq_s_b(1, "c")) { 321 | sbp.cursor = sbp.limit - v_2; 322 | sbp.slice_del(); 323 | sbp.ket = sbp.cursor; 324 | if (sbp.eq_s_b(2, "en")) { 325 | sbp.bra = sbp.cursor; 326 | r_en_ending(); 327 | } 328 | } 329 | } 330 | } 331 | sbp.cursor = sbp.limit - v_1; 332 | sbp.ket = sbp.cursor; 333 | among_var = sbp.find_among_b(a_4, 6); 334 | if (among_var) { 335 | sbp.bra = sbp.cursor; 336 | switch (among_var) { 337 | case 1: 338 | if (r_R2()) { 339 | sbp.slice_del(); 340 | v_3 = sbp.limit - sbp.cursor; 341 | sbp.ket = sbp.cursor; 342 | if (sbp.eq_s_b(2, "ig")) { 343 | sbp.bra = sbp.cursor; 344 | if (r_R2()) { 345 | v_4 = sbp.limit - sbp.cursor; 346 | if (!sbp.eq_s_b(1, "e")) { 347 | sbp.cursor = sbp.limit - v_4; 348 | sbp.slice_del(); 349 | break; 350 | } 351 | } 352 | } 353 | sbp.cursor = sbp.limit - v_3; 354 | r_undouble(); 355 | } 356 | break; 357 | case 2: 358 | if (r_R2()) { 359 | v_5 = sbp.limit - sbp.cursor; 360 | if (!sbp.eq_s_b(1, "e")) { 361 | sbp.cursor = sbp.limit - v_5; 362 | sbp.slice_del(); 363 | } 364 | } 365 | break; 366 | case 3: 367 | if (r_R2()) { 368 | sbp.slice_del(); 369 | r_e_ending(); 370 | } 371 | break; 372 | case 4: 373 | if (r_R2()) 374 | sbp.slice_del(); 375 | break; 376 | case 5: 377 | if (r_R2() && B_e_found) 378 | sbp.slice_del(); 379 | break; 380 | } 381 | } 382 | sbp.cursor = sbp.limit - v_1; 383 | if (sbp.out_grouping_b(g_v_I, 73, 232)) { 384 | v_6 = sbp.limit - sbp.cursor; 385 | if (sbp.find_among_b(a_5, 4) && sbp.out_grouping_b(g_v, 97, 232)) { 386 | sbp.cursor = sbp.limit - v_6; 387 | sbp.ket = sbp.cursor; 388 | if (sbp.cursor > sbp.limit_backward) { 389 | sbp.cursor--; 390 | sbp.bra = sbp.cursor; 391 | sbp.slice_del(); 392 | } 393 | } 394 | } 395 | } 396 | this.stem = function() { 397 | var v_1 = sbp.cursor; 398 | r_prelude(); 399 | sbp.cursor = v_1; 400 | r_mark_regions(); 401 | sbp.limit_backward = v_1; 402 | sbp.cursor = sbp.limit; 403 | r_standard_suffix(); 404 | sbp.cursor = sbp.limit_backward; 405 | r_postlude(); 406 | return true; 407 | } 408 | }; 409 | 410 | /* and return a function that stems a word for the current locale */ 411 | return function(word) { 412 | st.setCurrent(word); 413 | st.stem(); 414 | return st.getCurrent(); 415 | } 416 | })(); 417 | 418 | lunr.Pipeline.registerFunction(lunr.du.stemmer, 'stemmer-du'); 419 | 420 | /* stop word filter function */ 421 | lunr.du.stopWordFilter = function(token) { 422 | if (lunr.du.stopWordFilter.stopWords.indexOf(token) === -1) { 423 | return token; 424 | } 425 | }; 426 | 427 | lunr.du.stopWordFilter.stopWords = new lunr.SortedSet(); 428 | lunr.du.stopWordFilter.stopWords.length = 103; 429 | 430 | // The space at the beginning is crucial: It marks the empty string 431 | // as a stop word. lunr.js crashes during search when documents 432 | // processed by the pipeline still contain the empty string. 433 | lunr.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(' '); 434 | 435 | lunr.Pipeline.registerFunction(lunr.du.stopWordFilter, 'stopWordFilter-du'); 436 | }; 437 | })) -------------------------------------------------------------------------------- /vendor/assets/javascripts/lunr.fi.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Lunr languages, `Finnish` 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.fi = function() { 57 | this.pipeline.reset(); 58 | this.pipeline.add( 59 | lunr.fi.stopWordFilter, 60 | lunr.fi.stemmer 61 | ); 62 | }; 63 | 64 | /* lunr stemmer function */ 65 | lunr.fi.stemmer = (function() { 66 | /* create the wrapped stemmer object */ 67 | var Among = lunr.stemmerSupport.Among, 68 | SnowballProgram = lunr.stemmerSupport.SnowballProgram, 69 | st = new function FinnishStemmer() { 70 | var a_0 = [new Among("pa", -1, 1), new Among("sti", -1, 2), 71 | new Among("kaan", -1, 1), new Among("han", -1, 1), 72 | new Among("kin", -1, 1), new Among("h\u00E4n", -1, 1), 73 | new Among("k\u00E4\u00E4n", -1, 1), new Among("ko", -1, 1), 74 | new Among("p\u00E4", -1, 1), new Among("k\u00F6", -1, 1) 75 | ], 76 | a_1 = [ 77 | new Among("lla", -1, -1), new Among("na", -1, -1), 78 | new Among("ssa", -1, -1), new Among("ta", -1, -1), 79 | new Among("lta", 3, -1), new Among("sta", 3, -1) 80 | ], 81 | a_2 = [ 82 | new Among("ll\u00E4", -1, -1), new Among("n\u00E4", -1, -1), 83 | new Among("ss\u00E4", -1, -1), new Among("t\u00E4", -1, -1), 84 | new Among("lt\u00E4", 3, -1), new Among("st\u00E4", 3, -1) 85 | ], 86 | a_3 = [ 87 | new Among("lle", -1, -1), new Among("ine", -1, -1) 88 | ], 89 | a_4 = [ 90 | new Among("nsa", -1, 3), new Among("mme", -1, 3), 91 | new Among("nne", -1, 3), new Among("ni", -1, 2), 92 | new Among("si", -1, 1), new Among("an", -1, 4), 93 | new Among("en", -1, 6), new Among("\u00E4n", -1, 5), 94 | new Among("ns\u00E4", -1, 3) 95 | ], 96 | a_5 = [new Among("aa", -1, -1), 97 | new Among("ee", -1, -1), new Among("ii", -1, -1), 98 | new Among("oo", -1, -1), new Among("uu", -1, -1), 99 | new Among("\u00E4\u00E4", -1, -1), 100 | new Among("\u00F6\u00F6", -1, -1) 101 | ], 102 | a_6 = [new Among("a", -1, 8), 103 | new Among("lla", 0, -1), new Among("na", 0, -1), 104 | new Among("ssa", 0, -1), new Among("ta", 0, -1), 105 | new Among("lta", 4, -1), new Among("sta", 4, -1), 106 | new Among("tta", 4, 9), new Among("lle", -1, -1), 107 | new Among("ine", -1, -1), new Among("ksi", -1, -1), 108 | new Among("n", -1, 7), new Among("han", 11, 1), 109 | new Among("den", 11, -1, r_VI), new Among("seen", 11, -1, r_LONG), 110 | new Among("hen", 11, 2), new Among("tten", 11, -1, r_VI), 111 | new Among("hin", 11, 3), new Among("siin", 11, -1, r_VI), 112 | new Among("hon", 11, 4), new Among("h\u00E4n", 11, 5), 113 | new Among("h\u00F6n", 11, 6), new Among("\u00E4", -1, 8), 114 | new Among("ll\u00E4", 22, -1), new Among("n\u00E4", 22, -1), 115 | new Among("ss\u00E4", 22, -1), new Among("t\u00E4", 22, -1), 116 | new Among("lt\u00E4", 26, -1), new Among("st\u00E4", 26, -1), 117 | new Among("tt\u00E4", 26, 9) 118 | ], 119 | a_7 = [new Among("eja", -1, -1), 120 | new Among("mma", -1, 1), new Among("imma", 1, -1), 121 | new Among("mpa", -1, 1), new Among("impa", 3, -1), 122 | new Among("mmi", -1, 1), new Among("immi", 5, -1), 123 | new Among("mpi", -1, 1), new Among("impi", 7, -1), 124 | new Among("ej\u00E4", -1, -1), new Among("mm\u00E4", -1, 1), 125 | new Among("imm\u00E4", 10, -1), new Among("mp\u00E4", -1, 1), 126 | new Among("imp\u00E4", 12, -1) 127 | ], 128 | a_8 = [new Among("i", -1, -1), 129 | new Among("j", -1, -1) 130 | ], 131 | a_9 = [new Among("mma", -1, 1), 132 | new Among("imma", 0, -1) 133 | ], 134 | g_AEI = [17, 1, 0, 0, 0, 0, 0, 0, 0, 0, 135 | 0, 0, 0, 0, 0, 0, 8 136 | ], 137 | g_V1 = [17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 138 | 0, 0, 0, 0, 0, 8, 0, 32 139 | ], 140 | g_V2 = [17, 65, 16, 0, 0, 0, 0, 0, 0, 0, 141 | 0, 0, 0, 0, 0, 0, 8, 0, 32 142 | ], 143 | g_particle_end = [17, 97, 24, 1, 0, 0, 144 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 32 145 | ], 146 | B_ending_removed, S_x, I_p2, I_p1, sbp = new SnowballProgram(); 147 | this.setCurrent = function(word) { 148 | sbp.setCurrent(word); 149 | }; 150 | this.getCurrent = function() { 151 | return sbp.getCurrent(); 152 | }; 153 | 154 | function r_mark_regions() { 155 | I_p1 = sbp.limit; 156 | I_p2 = I_p1; 157 | if (!habr1()) { 158 | I_p1 = sbp.cursor; 159 | if (!habr1()) 160 | I_p2 = sbp.cursor; 161 | } 162 | } 163 | 164 | function habr1() { 165 | var v_1; 166 | while (true) { 167 | v_1 = sbp.cursor; 168 | if (sbp.in_grouping(g_V1, 97, 246)) 169 | break; 170 | sbp.cursor = v_1; 171 | if (v_1 >= sbp.limit) 172 | return true; 173 | sbp.cursor++; 174 | } 175 | sbp.cursor = v_1; 176 | while (!sbp.out_grouping(g_V1, 97, 246)) { 177 | if (sbp.cursor >= sbp.limit) 178 | return true; 179 | sbp.cursor++; 180 | } 181 | return false; 182 | } 183 | 184 | function r_R2() { 185 | return I_p2 <= sbp.cursor; 186 | } 187 | 188 | function r_particle_etc() { 189 | var among_var, v_1; 190 | if (sbp.cursor >= I_p1) { 191 | v_1 = sbp.limit_backward; 192 | sbp.limit_backward = I_p1; 193 | sbp.ket = sbp.cursor; 194 | among_var = sbp.find_among_b(a_0, 10); 195 | if (among_var) { 196 | sbp.bra = sbp.cursor; 197 | sbp.limit_backward = v_1; 198 | switch (among_var) { 199 | case 1: 200 | if (!sbp.in_grouping_b(g_particle_end, 97, 246)) 201 | return; 202 | break; 203 | case 2: 204 | if (!r_R2()) 205 | return; 206 | break; 207 | } 208 | sbp.slice_del(); 209 | } else 210 | sbp.limit_backward = v_1; 211 | } 212 | } 213 | 214 | function r_possessive() { 215 | var among_var, v_1, v_2; 216 | if (sbp.cursor >= I_p1) { 217 | v_1 = sbp.limit_backward; 218 | sbp.limit_backward = I_p1; 219 | sbp.ket = sbp.cursor; 220 | among_var = sbp.find_among_b(a_4, 9); 221 | if (among_var) { 222 | sbp.bra = sbp.cursor; 223 | sbp.limit_backward = v_1; 224 | switch (among_var) { 225 | case 1: 226 | v_2 = sbp.limit - sbp.cursor; 227 | if (!sbp.eq_s_b(1, "k")) { 228 | sbp.cursor = sbp.limit - v_2; 229 | sbp.slice_del(); 230 | } 231 | break; 232 | case 2: 233 | sbp.slice_del(); 234 | sbp.ket = sbp.cursor; 235 | if (sbp.eq_s_b(3, "kse")) { 236 | sbp.bra = sbp.cursor; 237 | sbp.slice_from("ksi"); 238 | } 239 | break; 240 | case 3: 241 | sbp.slice_del(); 242 | break; 243 | case 4: 244 | if (sbp.find_among_b(a_1, 6)) 245 | sbp.slice_del(); 246 | break; 247 | case 5: 248 | if (sbp.find_among_b(a_2, 6)) 249 | sbp.slice_del(); 250 | break; 251 | case 6: 252 | if (sbp.find_among_b(a_3, 2)) 253 | sbp.slice_del(); 254 | break; 255 | } 256 | } else 257 | sbp.limit_backward = v_1; 258 | } 259 | } 260 | 261 | function r_LONG() { 262 | return sbp.find_among_b(a_5, 7); 263 | } 264 | 265 | function r_VI() { 266 | return sbp.eq_s_b(1, "i") && sbp.in_grouping_b(g_V2, 97, 246); 267 | } 268 | 269 | function r_case_ending() { 270 | var among_var, v_1, v_2; 271 | if (sbp.cursor >= I_p1) { 272 | v_1 = sbp.limit_backward; 273 | sbp.limit_backward = I_p1; 274 | sbp.ket = sbp.cursor; 275 | among_var = sbp.find_among_b(a_6, 30); 276 | if (among_var) { 277 | sbp.bra = sbp.cursor; 278 | sbp.limit_backward = v_1; 279 | switch (among_var) { 280 | case 1: 281 | if (!sbp.eq_s_b(1, "a")) 282 | return; 283 | break; 284 | case 2: 285 | case 9: 286 | if (!sbp.eq_s_b(1, "e")) 287 | return; 288 | break; 289 | case 3: 290 | if (!sbp.eq_s_b(1, "i")) 291 | return; 292 | break; 293 | case 4: 294 | if (!sbp.eq_s_b(1, "o")) 295 | return; 296 | break; 297 | case 5: 298 | if (!sbp.eq_s_b(1, "\u00E4")) 299 | return; 300 | break; 301 | case 6: 302 | if (!sbp.eq_s_b(1, "\u00F6")) 303 | return; 304 | break; 305 | case 7: 306 | v_2 = sbp.limit - sbp.cursor; 307 | if (!r_LONG()) { 308 | sbp.cursor = sbp.limit - v_2; 309 | if (!sbp.eq_s_b(2, "ie")) { 310 | sbp.cursor = sbp.limit - v_2; 311 | break; 312 | } 313 | } 314 | sbp.cursor = sbp.limit - v_2; 315 | if (sbp.cursor <= sbp.limit_backward) { 316 | sbp.cursor = sbp.limit - v_2; 317 | break; 318 | } 319 | sbp.cursor--; 320 | sbp.bra = sbp.cursor; 321 | break; 322 | case 8: 323 | if (!sbp.in_grouping_b(g_V1, 97, 246) || !sbp.out_grouping_b(g_V1, 97, 246)) 324 | return; 325 | break; 326 | } 327 | sbp.slice_del(); 328 | B_ending_removed = true; 329 | } else 330 | sbp.limit_backward = v_1; 331 | } 332 | } 333 | 334 | function r_other_endings() { 335 | var among_var, v_1, v_2; 336 | if (sbp.cursor >= I_p2) { 337 | v_1 = sbp.limit_backward; 338 | sbp.limit_backward = I_p2; 339 | sbp.ket = sbp.cursor; 340 | among_var = sbp.find_among_b(a_7, 14); 341 | if (among_var) { 342 | sbp.bra = sbp.cursor; 343 | sbp.limit_backward = v_1; 344 | if (among_var == 1) { 345 | v_2 = sbp.limit - sbp.cursor; 346 | if (sbp.eq_s_b(2, "po")) 347 | return; 348 | sbp.cursor = sbp.limit - v_2; 349 | } 350 | sbp.slice_del(); 351 | } else 352 | sbp.limit_backward = v_1; 353 | } 354 | } 355 | 356 | function r_i_plural() { 357 | var v_1; 358 | if (sbp.cursor >= I_p1) { 359 | v_1 = sbp.limit_backward; 360 | sbp.limit_backward = I_p1; 361 | sbp.ket = sbp.cursor; 362 | if (sbp.find_among_b(a_8, 2)) { 363 | sbp.bra = sbp.cursor; 364 | sbp.limit_backward = v_1; 365 | sbp.slice_del(); 366 | } else 367 | sbp.limit_backward = v_1; 368 | } 369 | } 370 | 371 | function r_t_plural() { 372 | var among_var, v_1, v_2, v_3, v_4, v_5; 373 | if (sbp.cursor >= I_p1) { 374 | v_1 = sbp.limit_backward; 375 | sbp.limit_backward = I_p1; 376 | sbp.ket = sbp.cursor; 377 | if (sbp.eq_s_b(1, "t")) { 378 | sbp.bra = sbp.cursor; 379 | v_2 = sbp.limit - sbp.cursor; 380 | if (sbp.in_grouping_b(g_V1, 97, 246)) { 381 | sbp.cursor = sbp.limit - v_2; 382 | sbp.slice_del(); 383 | sbp.limit_backward = v_1; 384 | v_3 = sbp.limit - sbp.cursor; 385 | if (sbp.cursor >= I_p2) { 386 | sbp.cursor = I_p2; 387 | v_4 = sbp.limit_backward; 388 | sbp.limit_backward = sbp.cursor; 389 | sbp.cursor = sbp.limit - v_3; 390 | sbp.ket = sbp.cursor; 391 | among_var = sbp.find_among_b(a_9, 2); 392 | if (among_var) { 393 | sbp.bra = sbp.cursor; 394 | sbp.limit_backward = v_4; 395 | if (among_var == 1) { 396 | v_5 = sbp.limit - sbp.cursor; 397 | if (sbp.eq_s_b(2, "po")) 398 | return; 399 | sbp.cursor = sbp.limit - v_5; 400 | } 401 | sbp.slice_del(); 402 | return; 403 | } 404 | } 405 | } 406 | } 407 | sbp.limit_backward = v_1; 408 | } 409 | } 410 | 411 | function r_tidy() { 412 | var v_1, v_2, v_3, v_4; 413 | if (sbp.cursor >= I_p1) { 414 | v_1 = sbp.limit_backward; 415 | sbp.limit_backward = I_p1; 416 | v_2 = sbp.limit - sbp.cursor; 417 | if (r_LONG()) { 418 | sbp.cursor = sbp.limit - v_2; 419 | sbp.ket = sbp.cursor; 420 | if (sbp.cursor > sbp.limit_backward) { 421 | sbp.cursor--; 422 | sbp.bra = sbp.cursor; 423 | sbp.slice_del(); 424 | } 425 | } 426 | sbp.cursor = sbp.limit - v_2; 427 | sbp.ket = sbp.cursor; 428 | if (sbp.in_grouping_b(g_AEI, 97, 228)) { 429 | sbp.bra = sbp.cursor; 430 | if (sbp.out_grouping_b(g_V1, 97, 246)) 431 | sbp.slice_del(); 432 | } 433 | sbp.cursor = sbp.limit - v_2; 434 | sbp.ket = sbp.cursor; 435 | if (sbp.eq_s_b(1, "j")) { 436 | sbp.bra = sbp.cursor; 437 | v_3 = sbp.limit - sbp.cursor; 438 | if (!sbp.eq_s_b(1, "o")) { 439 | sbp.cursor = sbp.limit - v_3; 440 | if (sbp.eq_s_b(1, "u")) 441 | sbp.slice_del(); 442 | } else 443 | sbp.slice_del(); 444 | } 445 | sbp.cursor = sbp.limit - v_2; 446 | sbp.ket = sbp.cursor; 447 | if (sbp.eq_s_b(1, "o")) { 448 | sbp.bra = sbp.cursor; 449 | if (sbp.eq_s_b(1, "j")) 450 | sbp.slice_del(); 451 | } 452 | sbp.cursor = sbp.limit - v_2; 453 | sbp.limit_backward = v_1; 454 | while (true) { 455 | v_4 = sbp.limit - sbp.cursor; 456 | if (sbp.out_grouping_b(g_V1, 97, 246)) { 457 | sbp.cursor = sbp.limit - v_4; 458 | break; 459 | } 460 | sbp.cursor = sbp.limit - v_4; 461 | if (sbp.cursor <= sbp.limit_backward) 462 | return; 463 | sbp.cursor--; 464 | } 465 | sbp.ket = sbp.cursor; 466 | if (sbp.cursor > sbp.limit_backward) { 467 | sbp.cursor--; 468 | sbp.bra = sbp.cursor; 469 | S_x = sbp.slice_to(); 470 | if (sbp.eq_v_b(S_x)) 471 | sbp.slice_del(); 472 | } 473 | } 474 | } 475 | this.stem = function() { 476 | var v_1 = sbp.cursor; 477 | r_mark_regions(); 478 | B_ending_removed = false; 479 | sbp.limit_backward = v_1; 480 | sbp.cursor = sbp.limit; 481 | r_particle_etc(); 482 | sbp.cursor = sbp.limit; 483 | r_possessive(); 484 | sbp.cursor = sbp.limit; 485 | r_case_ending(); 486 | sbp.cursor = sbp.limit; 487 | r_other_endings(); 488 | sbp.cursor = sbp.limit; 489 | if (B_ending_removed) { 490 | r_i_plural(); 491 | sbp.cursor = sbp.limit; 492 | } else { 493 | sbp.cursor = sbp.limit; 494 | r_t_plural(); 495 | sbp.cursor = sbp.limit; 496 | } 497 | r_tidy(); 498 | return true; 499 | } 500 | }; 501 | 502 | /* and return a function that stems a word for the current locale */ 503 | return function(word) { 504 | st.setCurrent(word); 505 | st.stem(); 506 | return st.getCurrent(); 507 | } 508 | })(); 509 | 510 | lunr.Pipeline.registerFunction(lunr.fi.stemmer, 'stemmer-fi'); 511 | 512 | /* stop word filter function */ 513 | lunr.fi.stopWordFilter = function(token) { 514 | if (lunr.fi.stopWordFilter.stopWords.indexOf(token) === -1) { 515 | return token; 516 | } 517 | }; 518 | 519 | lunr.fi.stopWordFilter.stopWords = new lunr.SortedSet(); 520 | lunr.fi.stopWordFilter.stopWords.length = 236; 521 | 522 | // The space at the beginning is crucial: It marks the empty string 523 | // as a stop word. lunr.js crashes during search when documents 524 | // processed by the pipeline still contain the empty string. 525 | lunr.fi.stopWordFilter.stopWords.elements = ' ei eivät emme en et ette että he heidän heidät heihin heille heillä heiltä heissä heistä heitä hän häneen hänelle hänellä häneltä hänen hänessä hänestä hänet häntä itse ja johon joiden joihin joiksi joilla joille joilta joina joissa joista joita joka joksi jolla jolle jolta jona jonka jos jossa josta jota jotka kanssa keiden keihin keiksi keille keillä keiltä keinä keissä keistä keitä keneen keneksi kenelle kenellä keneltä kenen kenenä kenessä kenestä kenet ketkä ketkä ketä koska kuin kuka kun me meidän meidät meihin meille meillä meiltä meissä meistä meitä mihin miksi mikä mille millä miltä minkä minkä minua minulla minulle minulta minun minussa minusta minut minuun minä minä missä mistä mitkä mitä mukaan mutta ne niiden niihin niiksi niille niillä niiltä niin niin niinä niissä niistä niitä noiden noihin noiksi noilla noille noilta noin noina noissa noista noita nuo nyt näiden näihin näiksi näille näillä näiltä näinä näissä näistä näitä nämä ole olemme olen olet olette oli olimme olin olisi olisimme olisin olisit olisitte olisivat olit olitte olivat olla olleet ollut on ovat poikki se sekä sen siihen siinä siitä siksi sille sillä sillä siltä sinua sinulla sinulle sinulta sinun sinussa sinusta sinut sinuun sinä sinä sitä tai te teidän teidät teihin teille teillä teiltä teissä teistä teitä tuo tuohon tuoksi tuolla tuolle tuolta tuon tuona tuossa tuosta tuota tähän täksi tälle tällä tältä tämä tämän tänä tässä tästä tätä vaan vai vaikka yli'.split(' '); 526 | 527 | lunr.Pipeline.registerFunction(lunr.fi.stopWordFilter, 'stopWordFilter-fi'); 528 | }; 529 | })) -------------------------------------------------------------------------------- /vendor/assets/javascripts/lunr.hu.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Lunr languages, `Hungarian` 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.hu = function() { 57 | this.pipeline.reset(); 58 | this.pipeline.add( 59 | lunr.hu.stopWordFilter, 60 | lunr.hu.stemmer 61 | ); 62 | }; 63 | 64 | /* lunr stemmer function */ 65 | lunr.hu.stemmer = (function() { 66 | /* create the wrapped stemmer object */ 67 | var Among = lunr.stemmerSupport.Among, 68 | SnowballProgram = lunr.stemmerSupport.SnowballProgram, 69 | st = new function HungarianStemmer() { 70 | var a_0 = [new Among("cs", -1, -1), new Among("dzs", -1, -1), 71 | new Among("gy", -1, -1), new Among("ly", -1, -1), 72 | new Among("ny", -1, -1), new Among("sz", -1, -1), 73 | new Among("ty", -1, -1), new Among("zs", -1, -1) 74 | ], 75 | a_1 = [ 76 | new Among("\u00E1", -1, 1), new Among("\u00E9", -1, 2) 77 | ], 78 | a_2 = [ 79 | new Among("bb", -1, -1), new Among("cc", -1, -1), 80 | new Among("dd", -1, -1), new Among("ff", -1, -1), 81 | new Among("gg", -1, -1), new Among("jj", -1, -1), 82 | new Among("kk", -1, -1), new Among("ll", -1, -1), 83 | new Among("mm", -1, -1), new Among("nn", -1, -1), 84 | new Among("pp", -1, -1), new Among("rr", -1, -1), 85 | new Among("ccs", -1, -1), new Among("ss", -1, -1), 86 | new Among("zzs", -1, -1), new Among("tt", -1, -1), 87 | new Among("vv", -1, -1), new Among("ggy", -1, -1), 88 | new Among("lly", -1, -1), new Among("nny", -1, -1), 89 | new Among("tty", -1, -1), new Among("ssz", -1, -1), 90 | new Among("zz", -1, -1) 91 | ], 92 | a_3 = [new Among("al", -1, 1), 93 | new Among("el", -1, 2) 94 | ], 95 | a_4 = [new Among("ba", -1, -1), 96 | new Among("ra", -1, -1), new Among("be", -1, -1), 97 | new Among("re", -1, -1), new Among("ig", -1, -1), 98 | new Among("nak", -1, -1), new Among("nek", -1, -1), 99 | new Among("val", -1, -1), new Among("vel", -1, -1), 100 | new Among("ul", -1, -1), new Among("n\u00E1l", -1, -1), 101 | new Among("n\u00E9l", -1, -1), new Among("b\u00F3l", -1, -1), 102 | new Among("r\u00F3l", -1, -1), new Among("t\u00F3l", -1, -1), 103 | new Among("b\u00F5l", -1, -1), new Among("r\u00F5l", -1, -1), 104 | new Among("t\u00F5l", -1, -1), new Among("\u00FCl", -1, -1), 105 | new Among("n", -1, -1), new Among("an", 19, -1), 106 | new Among("ban", 20, -1), new Among("en", 19, -1), 107 | new Among("ben", 22, -1), new Among("k\u00E9ppen", 22, -1), 108 | new Among("on", 19, -1), new Among("\u00F6n", 19, -1), 109 | new Among("k\u00E9pp", -1, -1), new Among("kor", -1, -1), 110 | new Among("t", -1, -1), new Among("at", 29, -1), 111 | new Among("et", 29, -1), new Among("k\u00E9nt", 29, -1), 112 | new Among("ank\u00E9nt", 32, -1), new Among("enk\u00E9nt", 32, -1), 113 | new Among("onk\u00E9nt", 32, -1), new Among("ot", 29, -1), 114 | new Among("\u00E9rt", 29, -1), new Among("\u00F6t", 29, -1), 115 | new Among("hez", -1, -1), new Among("hoz", -1, -1), 116 | new Among("h\u00F6z", -1, -1), new Among("v\u00E1", -1, -1), 117 | new Among("v\u00E9", -1, -1) 118 | ], 119 | a_5 = [new Among("\u00E1n", -1, 2), 120 | new Among("\u00E9n", -1, 1), new Among("\u00E1nk\u00E9nt", -1, 3) 121 | ], 122 | a_6 = [ 123 | new Among("stul", -1, 2), new Among("astul", 0, 1), 124 | new Among("\u00E1stul", 0, 3), new Among("st\u00FCl", -1, 2), 125 | new Among("est\u00FCl", 3, 1), new Among("\u00E9st\u00FCl", 3, 4) 126 | ], 127 | a_7 = [ 128 | new Among("\u00E1", -1, 1), new Among("\u00E9", -1, 2) 129 | ], 130 | a_8 = [ 131 | new Among("k", -1, 7), new Among("ak", 0, 4), 132 | new Among("ek", 0, 6), new Among("ok", 0, 5), 133 | new Among("\u00E1k", 0, 1), new Among("\u00E9k", 0, 2), 134 | new Among("\u00F6k", 0, 3) 135 | ], 136 | a_9 = [new Among("\u00E9i", -1, 7), 137 | new Among("\u00E1\u00E9i", 0, 6), new Among("\u00E9\u00E9i", 0, 5), 138 | new Among("\u00E9", -1, 9), new Among("k\u00E9", 3, 4), 139 | new Among("ak\u00E9", 4, 1), new Among("ek\u00E9", 4, 1), 140 | new Among("ok\u00E9", 4, 1), new Among("\u00E1k\u00E9", 4, 3), 141 | new Among("\u00E9k\u00E9", 4, 2), new Among("\u00F6k\u00E9", 4, 1), 142 | new Among("\u00E9\u00E9", 3, 8) 143 | ], 144 | a_10 = [new Among("a", -1, 18), 145 | new Among("ja", 0, 17), new Among("d", -1, 16), 146 | new Among("ad", 2, 13), new Among("ed", 2, 13), 147 | new Among("od", 2, 13), new Among("\u00E1d", 2, 14), 148 | new Among("\u00E9d", 2, 15), new Among("\u00F6d", 2, 13), 149 | new Among("e", -1, 18), new Among("je", 9, 17), 150 | new Among("nk", -1, 4), new Among("unk", 11, 1), 151 | new Among("\u00E1nk", 11, 2), new Among("\u00E9nk", 11, 3), 152 | new Among("\u00FCnk", 11, 1), new Among("uk", -1, 8), 153 | new Among("juk", 16, 7), new Among("\u00E1juk", 17, 5), 154 | new Among("\u00FCk", -1, 8), new Among("j\u00FCk", 19, 7), 155 | new Among("\u00E9j\u00FCk", 20, 6), new Among("m", -1, 12), 156 | new Among("am", 22, 9), new Among("em", 22, 9), 157 | new Among("om", 22, 9), new Among("\u00E1m", 22, 10), 158 | new Among("\u00E9m", 22, 11), new Among("o", -1, 18), 159 | new Among("\u00E1", -1, 19), new Among("\u00E9", -1, 20) 160 | ], 161 | a_11 = [ 162 | new Among("id", -1, 10), new Among("aid", 0, 9), 163 | new Among("jaid", 1, 6), new Among("eid", 0, 9), 164 | new Among("jeid", 3, 6), new Among("\u00E1id", 0, 7), 165 | new Among("\u00E9id", 0, 8), new Among("i", -1, 15), 166 | new Among("ai", 7, 14), new Among("jai", 8, 11), 167 | new Among("ei", 7, 14), new Among("jei", 10, 11), 168 | new Among("\u00E1i", 7, 12), new Among("\u00E9i", 7, 13), 169 | new Among("itek", -1, 24), new Among("eitek", 14, 21), 170 | new Among("jeitek", 15, 20), new Among("\u00E9itek", 14, 23), 171 | new Among("ik", -1, 29), new Among("aik", 18, 26), 172 | new Among("jaik", 19, 25), new Among("eik", 18, 26), 173 | new Among("jeik", 21, 25), new Among("\u00E1ik", 18, 27), 174 | new Among("\u00E9ik", 18, 28), new Among("ink", -1, 20), 175 | new Among("aink", 25, 17), new Among("jaink", 26, 16), 176 | new Among("eink", 25, 17), new Among("jeink", 28, 16), 177 | new Among("\u00E1ink", 25, 18), new Among("\u00E9ink", 25, 19), 178 | new Among("aitok", -1, 21), new Among("jaitok", 32, 20), 179 | new Among("\u00E1itok", -1, 22), new Among("im", -1, 5), 180 | new Among("aim", 35, 4), new Among("jaim", 36, 1), 181 | new Among("eim", 35, 4), new Among("jeim", 38, 1), 182 | new Among("\u00E1im", 35, 2), new Among("\u00E9im", 35, 3) 183 | ], 184 | g_v = [ 185 | 17, 65, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 17, 52, 14 186 | ], 187 | I_p1, sbp = new SnowballProgram(); 188 | this.setCurrent = function(word) { 189 | sbp.setCurrent(word); 190 | }; 191 | this.getCurrent = function() { 192 | return sbp.getCurrent(); 193 | }; 194 | 195 | function r_mark_regions() { 196 | var v_1 = sbp.cursor, 197 | v_2; 198 | I_p1 = sbp.limit; 199 | if (sbp.in_grouping(g_v, 97, 252)) { 200 | while (true) { 201 | v_2 = sbp.cursor; 202 | if (sbp.out_grouping(g_v, 97, 252)) { 203 | sbp.cursor = v_2; 204 | if (!sbp.find_among(a_0, 8)) { 205 | sbp.cursor = v_2; 206 | if (v_2 < sbp.limit) 207 | sbp.cursor++; 208 | } 209 | I_p1 = sbp.cursor; 210 | return; 211 | } 212 | sbp.cursor = v_2; 213 | if (v_2 >= sbp.limit) { 214 | I_p1 = v_2; 215 | return; 216 | } 217 | sbp.cursor++; 218 | } 219 | } 220 | sbp.cursor = v_1; 221 | if (sbp.out_grouping(g_v, 97, 252)) { 222 | while (!sbp.in_grouping(g_v, 97, 252)) { 223 | if (sbp.cursor >= sbp.limit) 224 | return; 225 | sbp.cursor++; 226 | } 227 | I_p1 = sbp.cursor; 228 | } 229 | } 230 | 231 | function r_R1() { 232 | return I_p1 <= sbp.cursor; 233 | } 234 | 235 | function r_v_ending() { 236 | var among_var; 237 | sbp.ket = sbp.cursor; 238 | among_var = sbp.find_among_b(a_1, 2); 239 | if (among_var) { 240 | sbp.bra = sbp.cursor; 241 | if (r_R1()) { 242 | switch (among_var) { 243 | case 1: 244 | sbp.slice_from("a"); 245 | break; 246 | case 2: 247 | sbp.slice_from("e"); 248 | break; 249 | } 250 | } 251 | } 252 | } 253 | 254 | function r_double() { 255 | var v_1 = sbp.limit - sbp.cursor; 256 | if (!sbp.find_among_b(a_2, 23)) 257 | return false; 258 | sbp.cursor = sbp.limit - v_1; 259 | return true; 260 | } 261 | 262 | function r_undouble() { 263 | if (sbp.cursor > sbp.limit_backward) { 264 | sbp.cursor--; 265 | sbp.ket = sbp.cursor; 266 | var c = sbp.cursor - 1; 267 | if (sbp.limit_backward <= c && c <= sbp.limit) { 268 | sbp.cursor = c; 269 | sbp.bra = c; 270 | sbp.slice_del(); 271 | } 272 | } 273 | } 274 | 275 | function r_instrum() { 276 | var among_var; 277 | sbp.ket = sbp.cursor; 278 | among_var = sbp.find_among_b(a_3, 2); 279 | if (among_var) { 280 | sbp.bra = sbp.cursor; 281 | if (r_R1()) { 282 | if (among_var == 1 || among_var == 2) 283 | if (!r_double()) 284 | return; 285 | sbp.slice_del(); 286 | r_undouble(); 287 | } 288 | } 289 | } 290 | 291 | function r_case() { 292 | sbp.ket = sbp.cursor; 293 | if (sbp.find_among_b(a_4, 44)) { 294 | sbp.bra = sbp.cursor; 295 | if (r_R1()) { 296 | sbp.slice_del(); 297 | r_v_ending(); 298 | } 299 | } 300 | } 301 | 302 | function r_case_special() { 303 | var among_var; 304 | sbp.ket = sbp.cursor; 305 | among_var = sbp.find_among_b(a_5, 3); 306 | if (among_var) { 307 | sbp.bra = sbp.cursor; 308 | if (r_R1()) { 309 | switch (among_var) { 310 | case 1: 311 | sbp.slice_from("e"); 312 | break; 313 | case 2: 314 | case 3: 315 | sbp.slice_from("a"); 316 | break; 317 | } 318 | } 319 | } 320 | } 321 | 322 | function r_case_other() { 323 | var among_var; 324 | sbp.ket = sbp.cursor; 325 | among_var = sbp.find_among_b(a_6, 6); 326 | if (among_var) { 327 | sbp.bra = sbp.cursor; 328 | if (r_R1()) { 329 | switch (among_var) { 330 | case 1: 331 | case 2: 332 | sbp.slice_del(); 333 | break; 334 | case 3: 335 | sbp.slice_from("a"); 336 | break; 337 | case 4: 338 | sbp.slice_from("e"); 339 | break; 340 | } 341 | } 342 | } 343 | } 344 | 345 | function r_factive() { 346 | var among_var; 347 | sbp.ket = sbp.cursor; 348 | among_var = sbp.find_among_b(a_7, 2); 349 | if (among_var) { 350 | sbp.bra = sbp.cursor; 351 | if (r_R1()) { 352 | if (among_var == 1 || among_var == 2) 353 | if (!r_double()) 354 | return; 355 | sbp.slice_del(); 356 | r_undouble() 357 | } 358 | } 359 | } 360 | 361 | function r_plural() { 362 | var among_var; 363 | sbp.ket = sbp.cursor; 364 | among_var = sbp.find_among_b(a_8, 7); 365 | if (among_var) { 366 | sbp.bra = sbp.cursor; 367 | if (r_R1()) { 368 | switch (among_var) { 369 | case 1: 370 | sbp.slice_from("a"); 371 | break; 372 | case 2: 373 | sbp.slice_from("e"); 374 | break; 375 | case 3: 376 | case 4: 377 | case 5: 378 | case 6: 379 | case 7: 380 | sbp.slice_del(); 381 | break; 382 | } 383 | } 384 | } 385 | } 386 | 387 | function r_owned() { 388 | var among_var; 389 | sbp.ket = sbp.cursor; 390 | among_var = sbp.find_among_b(a_9, 12); 391 | if (among_var) { 392 | sbp.bra = sbp.cursor; 393 | if (r_R1()) { 394 | switch (among_var) { 395 | case 1: 396 | case 4: 397 | case 7: 398 | case 9: 399 | sbp.slice_del(); 400 | break; 401 | case 2: 402 | case 5: 403 | case 8: 404 | sbp.slice_from("e"); 405 | break; 406 | case 3: 407 | case 6: 408 | sbp.slice_from("a"); 409 | break; 410 | } 411 | } 412 | } 413 | } 414 | 415 | function r_sing_owner() { 416 | var among_var; 417 | sbp.ket = sbp.cursor; 418 | among_var = sbp.find_among_b(a_10, 31); 419 | if (among_var) { 420 | sbp.bra = sbp.cursor; 421 | if (r_R1()) { 422 | switch (among_var) { 423 | case 1: 424 | case 4: 425 | case 7: 426 | case 8: 427 | case 9: 428 | case 12: 429 | case 13: 430 | case 16: 431 | case 17: 432 | case 18: 433 | sbp.slice_del(); 434 | break; 435 | case 2: 436 | case 5: 437 | case 10: 438 | case 14: 439 | case 19: 440 | sbp.slice_from("a"); 441 | break; 442 | case 3: 443 | case 6: 444 | case 11: 445 | case 15: 446 | case 20: 447 | sbp.slice_from("e"); 448 | break; 449 | } 450 | } 451 | } 452 | } 453 | 454 | function r_plur_owner() { 455 | var among_var; 456 | sbp.ket = sbp.cursor; 457 | among_var = sbp.find_among_b(a_11, 42); 458 | if (among_var) { 459 | sbp.bra = sbp.cursor; 460 | if (r_R1()) { 461 | switch (among_var) { 462 | case 1: 463 | case 4: 464 | case 5: 465 | case 6: 466 | case 9: 467 | case 10: 468 | case 11: 469 | case 14: 470 | case 15: 471 | case 16: 472 | case 17: 473 | case 20: 474 | case 21: 475 | case 24: 476 | case 25: 477 | case 26: 478 | case 29: 479 | sbp.slice_del(); 480 | break; 481 | case 2: 482 | case 7: 483 | case 12: 484 | case 18: 485 | case 22: 486 | case 27: 487 | sbp.slice_from("a"); 488 | break; 489 | case 3: 490 | case 8: 491 | case 13: 492 | case 19: 493 | case 23: 494 | case 28: 495 | sbp.slice_from("e"); 496 | break; 497 | } 498 | } 499 | } 500 | } 501 | this.stem = function() { 502 | var v_1 = sbp.cursor; 503 | r_mark_regions(); 504 | sbp.limit_backward = v_1; 505 | sbp.cursor = sbp.limit; 506 | r_instrum(); 507 | sbp.cursor = sbp.limit; 508 | r_case(); 509 | sbp.cursor = sbp.limit; 510 | r_case_special(); 511 | sbp.cursor = sbp.limit; 512 | r_case_other(); 513 | sbp.cursor = sbp.limit; 514 | r_factive(); 515 | sbp.cursor = sbp.limit; 516 | r_owned(); 517 | sbp.cursor = sbp.limit; 518 | r_sing_owner(); 519 | sbp.cursor = sbp.limit; 520 | r_plur_owner(); 521 | sbp.cursor = sbp.limit; 522 | r_plural(); 523 | return true; 524 | } 525 | }; 526 | 527 | /* and return a function that stems a word for the current locale */ 528 | return function(word) { 529 | st.setCurrent(word); 530 | st.stem(); 531 | return st.getCurrent(); 532 | } 533 | })(); 534 | 535 | lunr.Pipeline.registerFunction(lunr.hu.stemmer, 'stemmer-hu'); 536 | 537 | /* stop word filter function */ 538 | lunr.hu.stopWordFilter = function(token) { 539 | if (lunr.hu.stopWordFilter.stopWords.indexOf(token) === -1) { 540 | return token; 541 | } 542 | }; 543 | 544 | lunr.hu.stopWordFilter.stopWords = new lunr.SortedSet(); 545 | lunr.hu.stopWordFilter.stopWords.length = 200; 546 | 547 | // The space at the beginning is crucial: It marks the empty string 548 | // as a stop word. lunr.js crashes during search when documents 549 | // processed by the pipeline still contain the empty string. 550 | lunr.hu.stopWordFilter.stopWords.elements = ' a abban ahhoz ahogy ahol aki akik akkor alatt amely amelyek amelyekben amelyeket amelyet amelynek ami amikor amit amolyan amíg annak arra arról az azok azon azonban azt aztán azután azzal azért be belül benne bár cikk cikkek cikkeket csak de e ebben eddig egy egyes egyetlen egyik egyre egyéb egész ehhez ekkor el ellen elsõ elég elõ elõször elõtt emilyen ennek erre ez ezek ezen ezt ezzel ezért fel felé hanem hiszen hogy hogyan igen ill ill. illetve ilyen ilyenkor ismét ison itt jobban jó jól kell kellett keressünk keresztül ki kívül között közül legalább legyen lehet lehetett lenne lenni lesz lett maga magát majd majd meg mellett mely melyek mert mi mikor milyen minden mindenki mindent mindig mint mintha mit mivel miért most már más másik még míg nagy nagyobb nagyon ne nekem neki nem nincs néha néhány nélkül olyan ott pedig persze rá s saját sem semmi sok sokat sokkal szemben szerint szinte számára talán tehát teljes tovább továbbá több ugyanis utolsó után utána vagy vagyis vagyok valaki valami valamint való van vannak vele vissza viszont volna volt voltak voltam voltunk által általában át én éppen és így õ õk õket össze úgy új újabb újra'.split(' '); 551 | 552 | lunr.Pipeline.registerFunction(lunr.hu.stopWordFilter, 'stopWordFilter-hu'); 553 | }; 554 | })) -------------------------------------------------------------------------------- /vendor/assets/javascripts/lunr.jp.js: -------------------------------------------------------------------------------- 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 | })) -------------------------------------------------------------------------------- /vendor/assets/javascripts/lunr.min.js: -------------------------------------------------------------------------------- 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(en.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;t1;){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]&&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();rp;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= 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 | })) -------------------------------------------------------------------------------- /vendor/assets/javascripts/lunr.pt.js: -------------------------------------------------------------------------------- 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 | })) -------------------------------------------------------------------------------- /vendor/assets/javascripts/lunr.ro.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Lunr languages, `Romanian` 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.ro = function() { 57 | this.pipeline.reset(); 58 | this.pipeline.add( 59 | lunr.ro.stopWordFilter, 60 | lunr.ro.stemmer 61 | ); 62 | }; 63 | 64 | /* lunr stemmer function */ 65 | lunr.ro.stemmer = (function() { 66 | /* create the wrapped stemmer object */ 67 | var Among = lunr.stemmerSupport.Among, 68 | SnowballProgram = lunr.stemmerSupport.SnowballProgram, 69 | st = new function RomanianStemmer() { 70 | var a_0 = [new Among("", -1, 3), new Among("I", 0, 1), new Among("U", 0, 2)], 71 | a_1 = [ 72 | new Among("ea", -1, 3), new Among("a\u0163ia", -1, 7), 73 | new Among("aua", -1, 2), new Among("iua", -1, 4), 74 | new Among("a\u0163ie", -1, 7), new Among("ele", -1, 3), 75 | new Among("ile", -1, 5), new Among("iile", 6, 4), 76 | new Among("iei", -1, 4), new Among("atei", -1, 6), 77 | new Among("ii", -1, 4), new Among("ului", -1, 1), 78 | new Among("ul", -1, 1), new Among("elor", -1, 3), 79 | new Among("ilor", -1, 4), new Among("iilor", 14, 4) 80 | ], 81 | a_2 = [ 82 | new Among("icala", -1, 4), new Among("iciva", -1, 4), 83 | new Among("ativa", -1, 5), new Among("itiva", -1, 6), 84 | new Among("icale", -1, 4), new Among("a\u0163iune", -1, 5), 85 | new Among("i\u0163iune", -1, 6), new Among("atoare", -1, 5), 86 | new Among("itoare", -1, 6), new Among("\u0103toare", -1, 5), 87 | new Among("icitate", -1, 4), new Among("abilitate", -1, 1), 88 | new Among("ibilitate", -1, 2), new Among("ivitate", -1, 3), 89 | new Among("icive", -1, 4), new Among("ative", -1, 5), 90 | new Among("itive", -1, 6), new Among("icali", -1, 4), 91 | new Among("atori", -1, 5), new Among("icatori", 18, 4), 92 | new Among("itori", -1, 6), new Among("\u0103tori", -1, 5), 93 | new Among("icitati", -1, 4), new Among("abilitati", -1, 1), 94 | new Among("ivitati", -1, 3), new Among("icivi", -1, 4), 95 | new Among("ativi", -1, 5), new Among("itivi", -1, 6), 96 | new Among("icit\u0103i", -1, 4), new Among("abilit\u0103i", -1, 1), 97 | new Among("ivit\u0103i", -1, 3), 98 | new Among("icit\u0103\u0163i", -1, 4), 99 | new Among("abilit\u0103\u0163i", -1, 1), 100 | new Among("ivit\u0103\u0163i", -1, 3), new Among("ical", -1, 4), 101 | new Among("ator", -1, 5), new Among("icator", 35, 4), 102 | new Among("itor", -1, 6), new Among("\u0103tor", -1, 5), 103 | new Among("iciv", -1, 4), new Among("ativ", -1, 5), 104 | new Among("itiv", -1, 6), new Among("ical\u0103", -1, 4), 105 | new Among("iciv\u0103", -1, 4), new Among("ativ\u0103", -1, 5), 106 | new Among("itiv\u0103", -1, 6) 107 | ], 108 | a_3 = [new Among("ica", -1, 1), 109 | new Among("abila", -1, 1), new Among("ibila", -1, 1), 110 | new Among("oasa", -1, 1), new Among("ata", -1, 1), 111 | new Among("ita", -1, 1), new Among("anta", -1, 1), 112 | new Among("ista", -1, 3), new Among("uta", -1, 1), 113 | new Among("iva", -1, 1), new Among("ic", -1, 1), 114 | new Among("ice", -1, 1), new Among("abile", -1, 1), 115 | new Among("ibile", -1, 1), new Among("isme", -1, 3), 116 | new Among("iune", -1, 2), new Among("oase", -1, 1), 117 | new Among("ate", -1, 1), new Among("itate", 17, 1), 118 | new Among("ite", -1, 1), new Among("ante", -1, 1), 119 | new Among("iste", -1, 3), new Among("ute", -1, 1), 120 | new Among("ive", -1, 1), new Among("ici", -1, 1), 121 | new Among("abili", -1, 1), new Among("ibili", -1, 1), 122 | new Among("iuni", -1, 2), new Among("atori", -1, 1), 123 | new Among("osi", -1, 1), new Among("ati", -1, 1), 124 | new Among("itati", 30, 1), new Among("iti", -1, 1), 125 | new Among("anti", -1, 1), new Among("isti", -1, 3), 126 | new Among("uti", -1, 1), new Among("i\u015Fti", -1, 3), 127 | new Among("ivi", -1, 1), new Among("it\u0103i", -1, 1), 128 | new Among("o\u015Fi", -1, 1), new Among("it\u0103\u0163i", -1, 1), 129 | new Among("abil", -1, 1), new Among("ibil", -1, 1), 130 | new Among("ism", -1, 3), new Among("ator", -1, 1), 131 | new Among("os", -1, 1), new Among("at", -1, 1), 132 | new Among("it", -1, 1), new Among("ant", -1, 1), 133 | new Among("ist", -1, 3), new Among("ut", -1, 1), 134 | new Among("iv", -1, 1), new Among("ic\u0103", -1, 1), 135 | new Among("abil\u0103", -1, 1), new Among("ibil\u0103", -1, 1), 136 | new Among("oas\u0103", -1, 1), new Among("at\u0103", -1, 1), 137 | new Among("it\u0103", -1, 1), new Among("ant\u0103", -1, 1), 138 | new Among("ist\u0103", -1, 3), new Among("ut\u0103", -1, 1), 139 | new Among("iv\u0103", -1, 1) 140 | ], 141 | a_4 = [new Among("ea", -1, 1), 142 | new Among("ia", -1, 1), new Among("esc", -1, 1), 143 | new Among("\u0103sc", -1, 1), new Among("ind", -1, 1), 144 | new Among("\u00E2nd", -1, 1), new Among("are", -1, 1), 145 | new Among("ere", -1, 1), new Among("ire", -1, 1), 146 | new Among("\u00E2re", -1, 1), new Among("se", -1, 2), 147 | new Among("ase", 10, 1), new Among("sese", 10, 2), 148 | new Among("ise", 10, 1), new Among("use", 10, 1), 149 | new Among("\u00E2se", 10, 1), new Among("e\u015Fte", -1, 1), 150 | new Among("\u0103\u015Fte", -1, 1), new Among("eze", -1, 1), 151 | new Among("ai", -1, 1), new Among("eai", 19, 1), 152 | new Among("iai", 19, 1), new Among("sei", -1, 2), 153 | new Among("e\u015Fti", -1, 1), new Among("\u0103\u015Fti", -1, 1), 154 | new Among("ui", -1, 1), new Among("ezi", -1, 1), 155 | new Among("\u00E2i", -1, 1), new Among("a\u015Fi", -1, 1), 156 | new Among("se\u015Fi", -1, 2), new Among("ase\u015Fi", 29, 1), 157 | new Among("sese\u015Fi", 29, 2), new Among("ise\u015Fi", 29, 1), 158 | new Among("use\u015Fi", 29, 1), 159 | new Among("\u00E2se\u015Fi", 29, 1), new Among("i\u015Fi", -1, 1), 160 | new Among("u\u015Fi", -1, 1), new Among("\u00E2\u015Fi", -1, 1), 161 | new Among("a\u0163i", -1, 2), new Among("ea\u0163i", 38, 1), 162 | new Among("ia\u0163i", 38, 1), new Among("e\u0163i", -1, 2), 163 | new Among("i\u0163i", -1, 2), new Among("\u00E2\u0163i", -1, 2), 164 | new Among("ar\u0103\u0163i", -1, 1), 165 | new Among("ser\u0103\u0163i", -1, 2), 166 | new Among("aser\u0103\u0163i", 45, 1), 167 | new Among("seser\u0103\u0163i", 45, 2), 168 | new Among("iser\u0103\u0163i", 45, 1), 169 | new Among("user\u0103\u0163i", 45, 1), 170 | new Among("\u00E2ser\u0103\u0163i", 45, 1), 171 | new Among("ir\u0103\u0163i", -1, 1), 172 | new Among("ur\u0103\u0163i", -1, 1), 173 | new Among("\u00E2r\u0103\u0163i", -1, 1), new Among("am", -1, 1), 174 | new Among("eam", 54, 1), new Among("iam", 54, 1), 175 | new Among("em", -1, 2), new Among("asem", 57, 1), 176 | new Among("sesem", 57, 2), new Among("isem", 57, 1), 177 | new Among("usem", 57, 1), new Among("\u00E2sem", 57, 1), 178 | new Among("im", -1, 2), new Among("\u00E2m", -1, 2), 179 | new Among("\u0103m", -1, 2), new Among("ar\u0103m", 65, 1), 180 | new Among("ser\u0103m", 65, 2), new Among("aser\u0103m", 67, 1), 181 | new Among("seser\u0103m", 67, 2), new Among("iser\u0103m", 67, 1), 182 | new Among("user\u0103m", 67, 1), 183 | new Among("\u00E2ser\u0103m", 67, 1), 184 | new Among("ir\u0103m", 65, 1), new Among("ur\u0103m", 65, 1), 185 | new Among("\u00E2r\u0103m", 65, 1), new Among("au", -1, 1), 186 | new Among("eau", 76, 1), new Among("iau", 76, 1), 187 | new Among("indu", -1, 1), new Among("\u00E2ndu", -1, 1), 188 | new Among("ez", -1, 1), new Among("easc\u0103", -1, 1), 189 | new Among("ar\u0103", -1, 1), new Among("ser\u0103", -1, 2), 190 | new Among("aser\u0103", 84, 1), new Among("seser\u0103", 84, 2), 191 | new Among("iser\u0103", 84, 1), new Among("user\u0103", 84, 1), 192 | new Among("\u00E2ser\u0103", 84, 1), new Among("ir\u0103", -1, 1), 193 | new Among("ur\u0103", -1, 1), new Among("\u00E2r\u0103", -1, 1), 194 | new Among("eaz\u0103", -1, 1) 195 | ], 196 | a_5 = [new Among("a", -1, 1), 197 | new Among("e", -1, 1), new Among("ie", 1, 1), 198 | new Among("i", -1, 1), new Among("\u0103", -1, 1) 199 | ], 200 | g_v = [17, 65, 201 | 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 32, 0, 0, 4 202 | ], 203 | B_standard_suffix_removed, I_p2, I_p1, I_pV, sbp = new SnowballProgram(); 204 | this.setCurrent = function(word) { 205 | sbp.setCurrent(word); 206 | }; 207 | this.getCurrent = function() { 208 | return sbp.getCurrent(); 209 | }; 210 | 211 | function habr1(c1, c2) { 212 | if (sbp.eq_s(1, c1)) { 213 | sbp.ket = sbp.cursor; 214 | if (sbp.in_grouping(g_v, 97, 259)) 215 | sbp.slice_from(c2); 216 | } 217 | } 218 | 219 | function r_prelude() { 220 | var v_1, v_2; 221 | while (true) { 222 | v_1 = sbp.cursor; 223 | if (sbp.in_grouping(g_v, 97, 259)) { 224 | v_2 = sbp.cursor; 225 | sbp.bra = v_2; 226 | habr1("u", "U"); 227 | sbp.cursor = v_2; 228 | habr1("i", "I"); 229 | } 230 | sbp.cursor = v_1; 231 | if (sbp.cursor >= sbp.limit) { 232 | break; 233 | } 234 | sbp.cursor++; 235 | } 236 | } 237 | 238 | function habr2() { 239 | if (sbp.out_grouping(g_v, 97, 259)) { 240 | while (!sbp.in_grouping(g_v, 97, 259)) { 241 | if (sbp.cursor >= sbp.limit) 242 | return true; 243 | sbp.cursor++; 244 | } 245 | return false; 246 | } 247 | return true; 248 | } 249 | 250 | function habr3() { 251 | if (sbp.in_grouping(g_v, 97, 259)) { 252 | while (!sbp.out_grouping(g_v, 97, 259)) { 253 | if (sbp.cursor >= sbp.limit) 254 | return true; 255 | sbp.cursor++; 256 | } 257 | } 258 | return false; 259 | } 260 | 261 | function habr4() { 262 | var v_1 = sbp.cursor, 263 | v_2, v_3; 264 | if (sbp.in_grouping(g_v, 97, 259)) { 265 | v_2 = sbp.cursor; 266 | if (habr2()) { 267 | sbp.cursor = v_2; 268 | if (!habr3()) { 269 | I_pV = sbp.cursor; 270 | return; 271 | } 272 | } else { 273 | I_pV = sbp.cursor; 274 | return; 275 | } 276 | } 277 | sbp.cursor = v_1; 278 | if (sbp.out_grouping(g_v, 97, 259)) { 279 | v_3 = sbp.cursor; 280 | if (habr2()) { 281 | sbp.cursor = v_3; 282 | if (sbp.in_grouping(g_v, 97, 259) && sbp.cursor < sbp.limit) 283 | sbp.cursor++; 284 | } 285 | I_pV = sbp.cursor; 286 | } 287 | } 288 | 289 | function habr5() { 290 | while (!sbp.in_grouping(g_v, 97, 259)) { 291 | if (sbp.cursor >= sbp.limit) 292 | return false; 293 | sbp.cursor++; 294 | } 295 | while (!sbp.out_grouping(g_v, 97, 259)) { 296 | if (sbp.cursor >= sbp.limit) 297 | return false; 298 | sbp.cursor++; 299 | } 300 | return true; 301 | } 302 | 303 | function r_mark_regions() { 304 | var v_1 = sbp.cursor; 305 | I_pV = sbp.limit; 306 | I_p1 = I_pV; 307 | I_p2 = I_pV; 308 | habr4(); 309 | sbp.cursor = v_1; 310 | if (habr5()) { 311 | I_p1 = sbp.cursor; 312 | if (habr5()) 313 | I_p2 = sbp.cursor; 314 | } 315 | } 316 | 317 | function r_postlude() { 318 | var among_var; 319 | while (true) { 320 | sbp.bra = sbp.cursor; 321 | among_var = sbp.find_among(a_0, 3); 322 | if (among_var) { 323 | sbp.ket = sbp.cursor; 324 | switch (among_var) { 325 | case 1: 326 | sbp.slice_from("i"); 327 | continue; 328 | case 2: 329 | sbp.slice_from("u"); 330 | continue; 331 | case 3: 332 | if (sbp.cursor >= sbp.limit) 333 | break; 334 | sbp.cursor++; 335 | continue; 336 | } 337 | } 338 | break; 339 | } 340 | } 341 | 342 | function r_RV() { 343 | return I_pV <= sbp.cursor; 344 | } 345 | 346 | function r_R1() { 347 | return I_p1 <= sbp.cursor; 348 | } 349 | 350 | function r_R2() { 351 | return I_p2 <= sbp.cursor; 352 | } 353 | 354 | function r_step_0() { 355 | var among_var, v_1; 356 | sbp.ket = sbp.cursor; 357 | among_var = sbp.find_among_b(a_1, 16); 358 | if (among_var) { 359 | sbp.bra = sbp.cursor; 360 | if (r_R1()) { 361 | switch (among_var) { 362 | case 1: 363 | sbp.slice_del(); 364 | break; 365 | case 2: 366 | sbp.slice_from("a"); 367 | break; 368 | case 3: 369 | sbp.slice_from("e"); 370 | break; 371 | case 4: 372 | sbp.slice_from("i"); 373 | break; 374 | case 5: 375 | v_1 = sbp.limit - sbp.cursor; 376 | if (!sbp.eq_s_b(2, "ab")) { 377 | sbp.cursor = sbp.limit - v_1; 378 | sbp.slice_from("i"); 379 | } 380 | break; 381 | case 6: 382 | sbp.slice_from("at"); 383 | break; 384 | case 7: 385 | sbp.slice_from("a\u0163i"); 386 | break; 387 | } 388 | } 389 | } 390 | } 391 | 392 | function r_combo_suffix() { 393 | var among_var, v_1 = sbp.limit - sbp.cursor; 394 | sbp.ket = sbp.cursor; 395 | among_var = sbp.find_among_b(a_2, 46); 396 | if (among_var) { 397 | sbp.bra = sbp.cursor; 398 | if (r_R1()) { 399 | switch (among_var) { 400 | case 1: 401 | sbp.slice_from("abil"); 402 | break; 403 | case 2: 404 | sbp.slice_from("ibil"); 405 | break; 406 | case 3: 407 | sbp.slice_from("iv"); 408 | break; 409 | case 4: 410 | sbp.slice_from("ic"); 411 | break; 412 | case 5: 413 | sbp.slice_from("at"); 414 | break; 415 | case 6: 416 | sbp.slice_from("it"); 417 | break; 418 | } 419 | B_standard_suffix_removed = true; 420 | sbp.cursor = sbp.limit - v_1; 421 | return true; 422 | } 423 | } 424 | return false; 425 | } 426 | 427 | function r_standard_suffix() { 428 | var among_var, v_1; 429 | B_standard_suffix_removed = false; 430 | while (true) { 431 | v_1 = sbp.limit - sbp.cursor; 432 | if (!r_combo_suffix()) { 433 | sbp.cursor = sbp.limit - v_1; 434 | break; 435 | } 436 | } 437 | sbp.ket = sbp.cursor; 438 | among_var = sbp.find_among_b(a_3, 62); 439 | if (among_var) { 440 | sbp.bra = sbp.cursor; 441 | if (r_R2()) { 442 | switch (among_var) { 443 | case 1: 444 | sbp.slice_del(); 445 | break; 446 | case 2: 447 | if (sbp.eq_s_b(1, "\u0163")) { 448 | sbp.bra = sbp.cursor; 449 | sbp.slice_from("t"); 450 | } 451 | break; 452 | case 3: 453 | sbp.slice_from("ist"); 454 | break; 455 | } 456 | B_standard_suffix_removed = true; 457 | } 458 | } 459 | } 460 | 461 | function r_verb_suffix() { 462 | var among_var, v_1, v_2; 463 | if (sbp.cursor >= I_pV) { 464 | v_1 = sbp.limit_backward; 465 | sbp.limit_backward = I_pV; 466 | sbp.ket = sbp.cursor; 467 | among_var = sbp.find_among_b(a_4, 94); 468 | if (among_var) { 469 | sbp.bra = sbp.cursor; 470 | switch (among_var) { 471 | case 1: 472 | v_2 = sbp.limit - sbp.cursor; 473 | if (!sbp.out_grouping_b(g_v, 97, 259)) { 474 | sbp.cursor = sbp.limit - v_2; 475 | if (!sbp.eq_s_b(1, "u")) 476 | break; 477 | } 478 | case 2: 479 | sbp.slice_del(); 480 | break; 481 | } 482 | } 483 | sbp.limit_backward = v_1; 484 | } 485 | } 486 | 487 | function r_vowel_suffix() { 488 | var among_var; 489 | sbp.ket = sbp.cursor; 490 | among_var = sbp.find_among_b(a_5, 5); 491 | if (among_var) { 492 | sbp.bra = sbp.cursor; 493 | if (r_RV() && among_var == 1) 494 | sbp.slice_del(); 495 | } 496 | } 497 | this.stem = function() { 498 | var v_1 = sbp.cursor; 499 | r_prelude(); 500 | sbp.cursor = v_1; 501 | r_mark_regions(); 502 | sbp.limit_backward = v_1; 503 | sbp.cursor = sbp.limit; 504 | r_step_0(); 505 | sbp.cursor = sbp.limit; 506 | r_standard_suffix(); 507 | sbp.cursor = sbp.limit; 508 | if (!B_standard_suffix_removed) { 509 | sbp.cursor = sbp.limit; 510 | r_verb_suffix(); 511 | sbp.cursor = sbp.limit; 512 | } 513 | r_vowel_suffix(); 514 | sbp.cursor = sbp.limit_backward; 515 | r_postlude(); 516 | return true; 517 | } 518 | }; 519 | 520 | /* and return a function that stems a word for the current locale */ 521 | return function(word) { 522 | st.setCurrent(word); 523 | st.stem(); 524 | return st.getCurrent(); 525 | } 526 | })(); 527 | 528 | lunr.Pipeline.registerFunction(lunr.ro.stemmer, 'stemmer-ro'); 529 | 530 | /* stop word filter function */ 531 | lunr.ro.stopWordFilter = function(token) { 532 | if (lunr.ro.stopWordFilter.stopWords.indexOf(token) === -1) { 533 | return token; 534 | } 535 | }; 536 | 537 | lunr.ro.stopWordFilter.stopWords = new lunr.SortedSet(); 538 | lunr.ro.stopWordFilter.stopWords.length = 282; 539 | 540 | // The space at the beginning is crucial: It marks the empty string 541 | // as a stop word. lunr.js crashes during search when documents 542 | // processed by the pipeline still contain the empty string. 543 | lunr.ro.stopWordFilter.stopWords.elements = ' 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 ale alea altceva altcineva am ar are asemenea asta astea astăzi asupra au avea avem aveţi azi aş aşadar aţi bine bucur bună ca care caut ce cel ceva chiar cinci cine cineva contra cu cum cumva curând curînd când cât câte câtva câţi cînd cît cîte cîtva cîţi că căci cărei căror cărui către da dacă dar datorită dată dau de deci deja deoarece departe deşi din dinaintea dintr- dintre doi doilea două drept după dă ea ei el ele eram este eu eşti face fata fi fie fiecare fii fim fiu fiţi frumos fără graţie halbă iar ieri la le li lor lui lângă lîngă mai mea mei mele mereu meu mi mie mine mult multă mulţi mulţumesc mâine mîine mă ne nevoie nici nicăieri nimeni nimeri nimic nişte noastre noastră noi noroc nostru nouă noştri nu opt ori oricare orice oricine oricum oricând oricât oricînd oricît oriunde patra patru patrulea pe pentru peste pic poate pot prea prima primul prin puţin puţina puţină până pînă rog sa sale sau se spate spre sub sunt suntem sunteţi sută sînt sîntem sînteţi să săi său ta tale te timp tine toate toată tot totuşi toţi trei treia treilea tu tăi tău un una unde undeva unei uneia unele uneori unii unor unora unu unui unuia unul vi voastre voastră voi vostru vouă voştri vreme vreo vreun vă zece zero zi zice îi îl îmi împotriva în înainte înaintea încotro încât încît între întrucât întrucît îţi ăla ălea ăsta ăstea ăştia şapte şase şi ştiu ţi ţie'.split(' '); 544 | 545 | lunr.Pipeline.registerFunction(lunr.ro.stopWordFilter, 'stopWordFilter-ro'); 546 | }; 547 | })) -------------------------------------------------------------------------------- /vendor/assets/javascripts/lunr.ru.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Lunr languages, `Russian` 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.ru = function() { 57 | this.pipeline.reset(); 58 | this.pipeline.add( 59 | lunr.ru.stopWordFilter, 60 | lunr.ru.stemmer 61 | ); 62 | }; 63 | 64 | /* lunr stemmer function */ 65 | lunr.ru.stemmer = (function() { 66 | /* create the wrapped stemmer object */ 67 | var Among = lunr.stemmerSupport.Among, 68 | SnowballProgram = lunr.stemmerSupport.SnowballProgram, 69 | st = new function RussianStemmer() { 70 | var a_0 = [new Among("\u0432", -1, 1), new Among("\u0438\u0432", 0, 2), 71 | new Among("\u044B\u0432", 0, 2), 72 | new Among("\u0432\u0448\u0438", -1, 1), 73 | new Among("\u0438\u0432\u0448\u0438", 3, 2), 74 | new Among("\u044B\u0432\u0448\u0438", 3, 2), 75 | new Among("\u0432\u0448\u0438\u0441\u044C", -1, 1), 76 | new Among("\u0438\u0432\u0448\u0438\u0441\u044C", 6, 2), 77 | new Among("\u044B\u0432\u0448\u0438\u0441\u044C", 6, 2) 78 | ], 79 | a_1 = [ 80 | new Among("\u0435\u0435", -1, 1), new Among("\u0438\u0435", -1, 1), 81 | new Among("\u043E\u0435", -1, 1), new Among("\u044B\u0435", -1, 1), 82 | new Among("\u0438\u043C\u0438", -1, 1), 83 | new Among("\u044B\u043C\u0438", -1, 1), 84 | new Among("\u0435\u0439", -1, 1), new Among("\u0438\u0439", -1, 1), 85 | new Among("\u043E\u0439", -1, 1), new Among("\u044B\u0439", -1, 1), 86 | new Among("\u0435\u043C", -1, 1), new Among("\u0438\u043C", -1, 1), 87 | new Among("\u043E\u043C", -1, 1), new Among("\u044B\u043C", -1, 1), 88 | new Among("\u0435\u0433\u043E", -1, 1), 89 | new Among("\u043E\u0433\u043E", -1, 1), 90 | new Among("\u0435\u043C\u0443", -1, 1), 91 | new Among("\u043E\u043C\u0443", -1, 1), 92 | new Among("\u0438\u0445", -1, 1), new Among("\u044B\u0445", -1, 1), 93 | new Among("\u0435\u044E", -1, 1), new Among("\u043E\u044E", -1, 1), 94 | new Among("\u0443\u044E", -1, 1), new Among("\u044E\u044E", -1, 1), 95 | new Among("\u0430\u044F", -1, 1), new Among("\u044F\u044F", -1, 1) 96 | ], 97 | a_2 = [ 98 | new Among("\u0435\u043C", -1, 1), new Among("\u043D\u043D", -1, 1), 99 | new Among("\u0432\u0448", -1, 1), 100 | new Among("\u0438\u0432\u0448", 2, 2), 101 | new Among("\u044B\u0432\u0448", 2, 2), new Among("\u0449", -1, 1), 102 | new Among("\u044E\u0449", 5, 1), 103 | new Among("\u0443\u044E\u0449", 6, 2) 104 | ], 105 | a_3 = [ 106 | new Among("\u0441\u044C", -1, 1), new Among("\u0441\u044F", -1, 1) 107 | ], 108 | a_4 = [ 109 | new Among("\u043B\u0430", -1, 1), 110 | new Among("\u0438\u043B\u0430", 0, 2), 111 | new Among("\u044B\u043B\u0430", 0, 2), 112 | new Among("\u043D\u0430", -1, 1), 113 | new Among("\u0435\u043D\u0430", 3, 2), 114 | new Among("\u0435\u0442\u0435", -1, 1), 115 | new Among("\u0438\u0442\u0435", -1, 2), 116 | new Among("\u0439\u0442\u0435", -1, 1), 117 | new Among("\u0435\u0439\u0442\u0435", 7, 2), 118 | new Among("\u0443\u0439\u0442\u0435", 7, 2), 119 | new Among("\u043B\u0438", -1, 1), 120 | new Among("\u0438\u043B\u0438", 10, 2), 121 | new Among("\u044B\u043B\u0438", 10, 2), new Among("\u0439", -1, 1), 122 | new Among("\u0435\u0439", 13, 2), new Among("\u0443\u0439", 13, 2), 123 | new Among("\u043B", -1, 1), new Among("\u0438\u043B", 16, 2), 124 | new Among("\u044B\u043B", 16, 2), new Among("\u0435\u043C", -1, 1), 125 | new Among("\u0438\u043C", -1, 2), new Among("\u044B\u043C", -1, 2), 126 | new Among("\u043D", -1, 1), new Among("\u0435\u043D", 22, 2), 127 | new Among("\u043B\u043E", -1, 1), 128 | new Among("\u0438\u043B\u043E", 24, 2), 129 | new Among("\u044B\u043B\u043E", 24, 2), 130 | new Among("\u043D\u043E", -1, 1), 131 | new Among("\u0435\u043D\u043E", 27, 2), 132 | new Among("\u043D\u043D\u043E", 27, 1), 133 | new Among("\u0435\u0442", -1, 1), 134 | new Among("\u0443\u0435\u0442", 30, 2), 135 | new Among("\u0438\u0442", -1, 2), new Among("\u044B\u0442", -1, 2), 136 | new Among("\u044E\u0442", -1, 1), 137 | new Among("\u0443\u044E\u0442", 34, 2), 138 | new Among("\u044F\u0442", -1, 2), new Among("\u043D\u044B", -1, 1), 139 | new Among("\u0435\u043D\u044B", 37, 2), 140 | new Among("\u0442\u044C", -1, 1), 141 | new Among("\u0438\u0442\u044C", 39, 2), 142 | new Among("\u044B\u0442\u044C", 39, 2), 143 | new Among("\u0435\u0448\u044C", -1, 1), 144 | new Among("\u0438\u0448\u044C", -1, 2), new Among("\u044E", -1, 2), 145 | new Among("\u0443\u044E", 44, 2) 146 | ], 147 | a_5 = [ 148 | new Among("\u0430", -1, 1), new Among("\u0435\u0432", -1, 1), 149 | new Among("\u043E\u0432", -1, 1), new Among("\u0435", -1, 1), 150 | new Among("\u0438\u0435", 3, 1), new Among("\u044C\u0435", 3, 1), 151 | new Among("\u0438", -1, 1), new Among("\u0435\u0438", 6, 1), 152 | new Among("\u0438\u0438", 6, 1), 153 | new Among("\u0430\u043C\u0438", 6, 1), 154 | new Among("\u044F\u043C\u0438", 6, 1), 155 | new Among("\u0438\u044F\u043C\u0438", 10, 1), 156 | new Among("\u0439", -1, 1), new Among("\u0435\u0439", 12, 1), 157 | new Among("\u0438\u0435\u0439", 13, 1), 158 | new Among("\u0438\u0439", 12, 1), new Among("\u043E\u0439", 12, 1), 159 | new Among("\u0430\u043C", -1, 1), new Among("\u0435\u043C", -1, 1), 160 | new Among("\u0438\u0435\u043C", 18, 1), 161 | new Among("\u043E\u043C", -1, 1), new Among("\u044F\u043C", -1, 1), 162 | new Among("\u0438\u044F\u043C", 21, 1), new Among("\u043E", -1, 1), 163 | new Among("\u0443", -1, 1), new Among("\u0430\u0445", -1, 1), 164 | new Among("\u044F\u0445", -1, 1), 165 | new Among("\u0438\u044F\u0445", 26, 1), new Among("\u044B", -1, 1), 166 | new Among("\u044C", -1, 1), new Among("\u044E", -1, 1), 167 | new Among("\u0438\u044E", 30, 1), new Among("\u044C\u044E", 30, 1), 168 | new Among("\u044F", -1, 1), new Among("\u0438\u044F", 33, 1), 169 | new Among("\u044C\u044F", 33, 1) 170 | ], 171 | a_6 = [ 172 | new Among("\u043E\u0441\u0442", -1, 1), 173 | new Among("\u043E\u0441\u0442\u044C", -1, 1) 174 | ], 175 | a_7 = [ 176 | new Among("\u0435\u0439\u0448\u0435", -1, 1), 177 | new Among("\u043D", -1, 2), new Among("\u0435\u0439\u0448", -1, 1), 178 | new Among("\u044C", -1, 3) 179 | ], 180 | g_v = [33, 65, 8, 232], 181 | I_p2, I_pV, sbp = new SnowballProgram(); 182 | this.setCurrent = function(word) { 183 | sbp.setCurrent(word); 184 | }; 185 | this.getCurrent = function() { 186 | return sbp.getCurrent(); 187 | }; 188 | 189 | function habr3() { 190 | while (!sbp.in_grouping(g_v, 1072, 1103)) { 191 | if (sbp.cursor >= sbp.limit) 192 | return false; 193 | sbp.cursor++; 194 | } 195 | return true; 196 | } 197 | 198 | function habr4() { 199 | while (!sbp.out_grouping(g_v, 1072, 1103)) { 200 | if (sbp.cursor >= sbp.limit) 201 | return false; 202 | sbp.cursor++; 203 | } 204 | return true; 205 | } 206 | 207 | function r_mark_regions() { 208 | I_pV = sbp.limit; 209 | I_p2 = I_pV; 210 | if (habr3()) { 211 | I_pV = sbp.cursor; 212 | if (habr4()) 213 | if (habr3()) 214 | if (habr4()) 215 | I_p2 = sbp.cursor; 216 | } 217 | } 218 | 219 | function r_R2() { 220 | return I_p2 <= sbp.cursor; 221 | } 222 | 223 | function habr2(a, n) { 224 | var among_var, v_1; 225 | sbp.ket = sbp.cursor; 226 | among_var = sbp.find_among_b(a, n); 227 | if (among_var) { 228 | sbp.bra = sbp.cursor; 229 | switch (among_var) { 230 | case 1: 231 | v_1 = sbp.limit - sbp.cursor; 232 | if (!sbp.eq_s_b(1, "\u0430")) { 233 | sbp.cursor = sbp.limit - v_1; 234 | if (!sbp.eq_s_b(1, "\u044F")) 235 | return false; 236 | } 237 | case 2: 238 | sbp.slice_del(); 239 | break; 240 | } 241 | return true; 242 | } 243 | return false; 244 | } 245 | 246 | function r_perfective_gerund() { 247 | return habr2(a_0, 9); 248 | } 249 | 250 | function habr1(a, n) { 251 | var among_var; 252 | sbp.ket = sbp.cursor; 253 | among_var = sbp.find_among_b(a, n); 254 | if (among_var) { 255 | sbp.bra = sbp.cursor; 256 | if (among_var == 1) 257 | sbp.slice_del(); 258 | return true; 259 | } 260 | return false; 261 | } 262 | 263 | function r_adjective() { 264 | return habr1(a_1, 26); 265 | } 266 | 267 | function r_adjectival() { 268 | var among_var; 269 | if (r_adjective()) { 270 | habr2(a_2, 8); 271 | return true; 272 | } 273 | return false; 274 | } 275 | 276 | function r_reflexive() { 277 | return habr1(a_3, 2); 278 | } 279 | 280 | function r_verb() { 281 | return habr2(a_4, 46); 282 | } 283 | 284 | function r_noun() { 285 | habr1(a_5, 36); 286 | } 287 | 288 | function r_derivational() { 289 | var among_var; 290 | sbp.ket = sbp.cursor; 291 | among_var = sbp.find_among_b(a_6, 2); 292 | if (among_var) { 293 | sbp.bra = sbp.cursor; 294 | if (r_R2() && among_var == 1) 295 | sbp.slice_del(); 296 | } 297 | } 298 | 299 | function r_tidy_up() { 300 | var among_var; 301 | sbp.ket = sbp.cursor; 302 | among_var = sbp.find_among_b(a_7, 4); 303 | if (among_var) { 304 | sbp.bra = sbp.cursor; 305 | switch (among_var) { 306 | case 1: 307 | sbp.slice_del(); 308 | sbp.ket = sbp.cursor; 309 | if (!sbp.eq_s_b(1, "\u043D")) 310 | break; 311 | sbp.bra = sbp.cursor; 312 | case 2: 313 | if (!sbp.eq_s_b(1, "\u043D")) 314 | break; 315 | case 3: 316 | sbp.slice_del(); 317 | break; 318 | } 319 | } 320 | } 321 | this.stem = function() { 322 | r_mark_regions(); 323 | sbp.cursor = sbp.limit; 324 | if (sbp.cursor < I_pV) 325 | return false; 326 | sbp.limit_backward = I_pV; 327 | if (!r_perfective_gerund()) { 328 | sbp.cursor = sbp.limit; 329 | if (!r_reflexive()) 330 | sbp.cursor = sbp.limit; 331 | if (!r_adjectival()) { 332 | sbp.cursor = sbp.limit; 333 | if (!r_verb()) { 334 | sbp.cursor = sbp.limit; 335 | r_noun(); 336 | } 337 | } 338 | } 339 | sbp.cursor = sbp.limit; 340 | sbp.ket = sbp.cursor; 341 | if (sbp.eq_s_b(1, "\u0438")) { 342 | sbp.bra = sbp.cursor; 343 | sbp.slice_del(); 344 | } else 345 | sbp.cursor = sbp.limit; 346 | r_derivational(); 347 | sbp.cursor = sbp.limit; 348 | r_tidy_up(); 349 | return true; 350 | } 351 | }; 352 | 353 | /* and return a function that stems a word for the current locale */ 354 | return function(word) { 355 | st.setCurrent(word); 356 | st.stem(); 357 | return st.getCurrent(); 358 | } 359 | })(); 360 | 361 | lunr.Pipeline.registerFunction(lunr.ru.stemmer, 'stemmer-ru'); 362 | 363 | /* stop word filter function */ 364 | lunr.ru.stopWordFilter = function(token) { 365 | if (lunr.ru.stopWordFilter.stopWords.indexOf(token) === -1) { 366 | return token; 367 | } 368 | }; 369 | 370 | lunr.ru.stopWordFilter.stopWords = new lunr.SortedSet(); 371 | lunr.ru.stopWordFilter.stopWords.length = 422; 372 | 373 | // The space at the beginning is crucial: It marks the empty string 374 | // as a stop word. lunr.js crashes during search when documents 375 | // processed by the pipeline still contain the empty string. 376 | lunr.ru.stopWordFilter.stopWords.elements = ' алло без близко более больше будем будет будете будешь будто буду будут будь бы бывает бывь был была были было быть в важная важное важные важный вам вами вас ваш ваша ваше ваши вверх вдали вдруг ведь везде весь вниз внизу во вокруг вон восемнадцатый восемнадцать восемь восьмой вот впрочем времени время все всегда всего всем всеми всему всех всею всю всюду вся всё второй вы г где говорил говорит год года году да давно даже далеко дальше даром два двадцатый двадцать две двенадцатый двенадцать двух девятнадцатый девятнадцать девятый девять действительно дел день десятый десять для до довольно долго должно другая другие других друго другое другой е его ее ей ему если есть еще ещё ею её ж же жизнь за занят занята занято заняты затем зато зачем здесь значит и из или им именно иметь ими имя иногда их к каждая каждое каждые каждый кажется как какая какой кем когда кого ком кому конечно которая которого которой которые который которых кроме кругом кто куда лет ли лишь лучше люди м мало между меля менее меньше меня миллионов мимо мира мне много многочисленная многочисленное многочисленные многочисленный мной мною мог могут мож может можно можхо мои мой мор мочь моя моё мы на наверху над надо назад наиболее наконец нам нами нас начала наш наша наше наши не него недавно недалеко нее ней нельзя нем немного нему непрерывно нередко несколько нет нею неё ни нибудь ниже низко никогда никуда ними них ничего но ну нужно нх о об оба обычно один одиннадцатый одиннадцать однажды однако одного одной около он она они оно опять особенно от отовсюду отсюда очень первый перед по под пожалуйста позже пока пор пора после посреди потом потому почему почти прекрасно при про просто против процентов пятнадцатый пятнадцать пятый пять раз разве рано раньше рядом с сам сама сами самим самими самих само самого самой самом самому саму свое своего своей свои своих свою сеаой себе себя сегодня седьмой сейчас семнадцатый семнадцать семь сих сказал сказала сказать сколько слишком сначала снова со собой собою совсем спасибо стал суть т та так такая также такие такое такой там твой твоя твоё те тебе тебя тем теми теперь тех то тобой тобою тогда того тоже только том тому тот тою третий три тринадцатый тринадцать ту туда тут ты тысяч у уж уже уметь хорошо хотеть хоть хотя хочешь часто чаще чего человек чем чему через четвертый четыре четырнадцатый четырнадцать что чтоб чтобы чуть шестнадцатый шестнадцать шестой шесть эта эти этим этими этих это этого этой этом этому этот эту я а'.split(' '); 377 | 378 | lunr.Pipeline.registerFunction(lunr.ru.stopWordFilter, 'stopWordFilter-ru'); 379 | }; 380 | })) -------------------------------------------------------------------------------- /vendor/assets/javascripts/lunr.stemmer.support.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Snowball JavaScript Library v0.3 3 | * http://code.google.com/p/urim/ 4 | * http://snowball.tartarus.org/ 5 | * 6 | * Copyright 2010, Oleg Mazko 7 | * http://www.mozilla.org/MPL/ 8 | */ 9 | 10 | /** 11 | * export the module via AMD, CommonJS or as a browser global 12 | * Export code from https://github.com/umdjs/umd/blob/master/returnExports.js 13 | */ 14 | ;(function (root, factory) { 15 | if (typeof define === 'function' && define.amd) { 16 | // AMD. Register as an anonymous module. 17 | define(factory) 18 | } else if (typeof exports === 'object') { 19 | /** 20 | * Node. Does not work with strict CommonJS, but 21 | * only CommonJS-like environments that support module.exports, 22 | * like Node. 23 | */ 24 | module.exports = factory() 25 | } else { 26 | // Browser globals (root is window) 27 | factory()(root.lunr); 28 | } 29 | }(this, function () { 30 | /** 31 | * Just return a value to define the module export. 32 | * This example returns an object, but the module 33 | * can return a function as the exported value. 34 | */ 35 | return function(lunr) { 36 | /* provides utilities for the included stemmers */ 37 | lunr.stemmerSupport = { 38 | Among: function(s, substring_i, result, method) { 39 | this.toCharArray = function(s) { 40 | var sLength = s.length, charArr = new Array(sLength); 41 | for (var i = 0; i < sLength; i++) 42 | charArr[i] = s.charCodeAt(i); 43 | return charArr; 44 | }; 45 | 46 | if ((!s && s != "") || (!substring_i && (substring_i != 0)) || !result) 47 | throw ("Bad Among initialisation: s:" + s + ", substring_i: " 48 | + substring_i + ", result: " + result); 49 | this.s_size = s.length; 50 | this.s = this.toCharArray(s); 51 | this.substring_i = substring_i; 52 | this.result = result; 53 | this.method = method; 54 | }, 55 | SnowballProgram: function() { 56 | var current; 57 | return { 58 | bra : 0, 59 | ket : 0, 60 | limit : 0, 61 | cursor : 0, 62 | limit_backward : 0, 63 | setCurrent : function(word) { 64 | current = word; 65 | this.cursor = 0; 66 | this.limit = word.length; 67 | this.limit_backward = 0; 68 | this.bra = this.cursor; 69 | this.ket = this.limit; 70 | }, 71 | getCurrent : function() { 72 | var result = current; 73 | current = null; 74 | return result; 75 | }, 76 | in_grouping : function(s, min, max) { 77 | if (this.cursor < this.limit) { 78 | var ch = current.charCodeAt(this.cursor); 79 | if (ch <= max && ch >= min) { 80 | ch -= min; 81 | if (s[ch >> 3] & (0X1 << (ch & 0X7))) { 82 | this.cursor++; 83 | return true; 84 | } 85 | } 86 | } 87 | return false; 88 | }, 89 | in_grouping_b : function(s, min, max) { 90 | if (this.cursor > this.limit_backward) { 91 | var ch = current.charCodeAt(this.cursor - 1); 92 | if (ch <= max && ch >= min) { 93 | ch -= min; 94 | if (s[ch >> 3] & (0X1 << (ch & 0X7))) { 95 | this.cursor--; 96 | return true; 97 | } 98 | } 99 | } 100 | return false; 101 | }, 102 | out_grouping : function(s, min, max) { 103 | if (this.cursor < this.limit) { 104 | var ch = current.charCodeAt(this.cursor); 105 | if (ch > max || ch < min) { 106 | this.cursor++; 107 | return true; 108 | } 109 | ch -= min; 110 | if (!(s[ch >> 3] & (0X1 << (ch & 0X7)))) { 111 | this.cursor++; 112 | return true; 113 | } 114 | } 115 | return false; 116 | }, 117 | out_grouping_b : function(s, min, max) { 118 | if (this.cursor > this.limit_backward) { 119 | var ch = current.charCodeAt(this.cursor - 1); 120 | if (ch > max || ch < min) { 121 | this.cursor--; 122 | return true; 123 | } 124 | ch -= min; 125 | if (!(s[ch >> 3] & (0X1 << (ch & 0X7)))) { 126 | this.cursor--; 127 | return true; 128 | } 129 | } 130 | return false; 131 | }, 132 | eq_s : function(s_size, s) { 133 | if (this.limit - this.cursor < s_size) 134 | return false; 135 | for (var i = 0; i < s_size; i++) 136 | if (current.charCodeAt(this.cursor + i) != s.charCodeAt(i)) 137 | return false; 138 | this.cursor += s_size; 139 | return true; 140 | }, 141 | eq_s_b : function(s_size, s) { 142 | if (this.cursor - this.limit_backward < s_size) 143 | return false; 144 | for (var i = 0; i < s_size; i++) 145 | if (current.charCodeAt(this.cursor - s_size + i) != s 146 | .charCodeAt(i)) 147 | return false; 148 | this.cursor -= s_size; 149 | return true; 150 | }, 151 | find_among : function(v, v_size) { 152 | var i = 0, j = v_size, c = this.cursor, l = this.limit, common_i = 0, common_j = 0, first_key_inspected = false; 153 | while (true) { 154 | var k = i + ((j - i) >> 1), diff = 0, common = common_i < common_j 155 | ? common_i 156 | : common_j, w = v[k]; 157 | for (var i2 = common; i2 < w.s_size; i2++) { 158 | if (c + common == l) { 159 | diff = -1; 160 | break; 161 | } 162 | diff = current.charCodeAt(c + common) - w.s[i2]; 163 | if (diff) 164 | break; 165 | common++; 166 | } 167 | if (diff < 0) { 168 | j = k; 169 | common_j = common; 170 | } else { 171 | i = k; 172 | common_i = common; 173 | } 174 | if (j - i <= 1) { 175 | if (i > 0 || j == i || first_key_inspected) 176 | break; 177 | first_key_inspected = true; 178 | } 179 | } 180 | while (true) { 181 | var w = v[i]; 182 | if (common_i >= w.s_size) { 183 | this.cursor = c + w.s_size; 184 | if (!w.method) 185 | return w.result; 186 | var res = w.method(); 187 | this.cursor = c + w.s_size; 188 | if (res) 189 | return w.result; 190 | } 191 | i = w.substring_i; 192 | if (i < 0) 193 | return 0; 194 | } 195 | }, 196 | find_among_b : function(v, v_size) { 197 | var i = 0, j = v_size, c = this.cursor, lb = this.limit_backward, common_i = 0, common_j = 0, first_key_inspected = false; 198 | while (true) { 199 | var k = i + ((j - i) >> 1), diff = 0, common = common_i < common_j 200 | ? common_i 201 | : common_j, w = v[k]; 202 | for (var i2 = w.s_size - 1 - common; i2 >= 0; i2--) { 203 | if (c - common == lb) { 204 | diff = -1; 205 | break; 206 | } 207 | diff = current.charCodeAt(c - 1 - common) - w.s[i2]; 208 | if (diff) 209 | break; 210 | common++; 211 | } 212 | if (diff < 0) { 213 | j = k; 214 | common_j = common; 215 | } else { 216 | i = k; 217 | common_i = common; 218 | } 219 | if (j - i <= 1) { 220 | if (i > 0 || j == i || first_key_inspected) 221 | break; 222 | first_key_inspected = true; 223 | } 224 | } 225 | while (true) { 226 | var w = v[i]; 227 | if (common_i >= w.s_size) { 228 | this.cursor = c - w.s_size; 229 | if (!w.method) 230 | return w.result; 231 | var res = w.method(); 232 | this.cursor = c - w.s_size; 233 | if (res) 234 | return w.result; 235 | } 236 | i = w.substring_i; 237 | if (i < 0) 238 | return 0; 239 | } 240 | }, 241 | replace_s : function(c_bra, c_ket, s) { 242 | var adjustment = s.length - (c_ket - c_bra), left = current 243 | .substring(0, c_bra), right = current.substring(c_ket); 244 | current = left + s + right; 245 | this.limit += adjustment; 246 | if (this.cursor >= c_ket) 247 | this.cursor += adjustment; 248 | else if (this.cursor > c_bra) 249 | this.cursor = c_bra; 250 | return adjustment; 251 | }, 252 | slice_check : function() { 253 | if (this.bra < 0 || this.bra > this.ket || this.ket > this.limit 254 | || this.limit > current.length) 255 | throw ("faulty slice operation"); 256 | }, 257 | slice_from : function(s) { 258 | this.slice_check(); 259 | this.replace_s(this.bra, this.ket, s); 260 | }, 261 | slice_del : function() { 262 | this.slice_from(""); 263 | }, 264 | insert : function(c_bra, c_ket, s) { 265 | var adjustment = this.replace_s(c_bra, c_ket, s); 266 | if (c_bra <= this.bra) 267 | this.bra += adjustment; 268 | if (c_bra <= this.ket) 269 | this.ket += adjustment; 270 | }, 271 | slice_to : function() { 272 | this.slice_check(); 273 | return current.substring(this.bra, this.ket); 274 | }, 275 | eq_v_b : function(s) { 276 | return this.eq_s_b(s.length, s); 277 | } 278 | }; 279 | } 280 | }; 281 | } 282 | })); 283 | -------------------------------------------------------------------------------- /vendor/assets/javascripts/lunr.sv.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Lunr languages, `Swedish` 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.sv = function() { 57 | this.pipeline.reset(); 58 | this.pipeline.add( 59 | lunr.sv.stopWordFilter, 60 | lunr.sv.stemmer 61 | ); 62 | }; 63 | 64 | /* lunr stemmer function */ 65 | lunr.sv.stemmer = (function() { 66 | /* create the wrapped stemmer object */ 67 | var Among = lunr.stemmerSupport.Among, 68 | SnowballProgram = lunr.stemmerSupport.SnowballProgram, 69 | st = new function SwedishStemmer() { 70 | var a_0 = [new Among("a", -1, 1), new Among("arna", 0, 1), 71 | new Among("erna", 0, 1), new Among("heterna", 2, 1), 72 | new Among("orna", 0, 1), new Among("ad", -1, 1), 73 | new Among("e", -1, 1), new Among("ade", 6, 1), 74 | new Among("ande", 6, 1), new Among("arne", 6, 1), 75 | new Among("are", 6, 1), new Among("aste", 6, 1), 76 | new Among("en", -1, 1), new Among("anden", 12, 1), 77 | new Among("aren", 12, 1), new Among("heten", 12, 1), 78 | new Among("ern", -1, 1), new Among("ar", -1, 1), 79 | new Among("er", -1, 1), new Among("heter", 18, 1), 80 | new Among("or", -1, 1), new Among("s", -1, 2), 81 | new Among("as", 21, 1), new Among("arnas", 22, 1), 82 | new Among("ernas", 22, 1), new Among("ornas", 22, 1), 83 | new Among("es", 21, 1), new Among("ades", 26, 1), 84 | new Among("andes", 26, 1), new Among("ens", 21, 1), 85 | new Among("arens", 29, 1), new Among("hetens", 29, 1), 86 | new Among("erns", 21, 1), new Among("at", -1, 1), 87 | new Among("andet", -1, 1), new Among("het", -1, 1), 88 | new Among("ast", -1, 1) 89 | ], 90 | a_1 = [new Among("dd", -1, -1), 91 | new Among("gd", -1, -1), new Among("nn", -1, -1), 92 | new Among("dt", -1, -1), new Among("gt", -1, -1), 93 | new Among("kt", -1, -1), new Among("tt", -1, -1) 94 | ], 95 | a_2 = [ 96 | new Among("ig", -1, 1), new Among("lig", 0, 1), 97 | new Among("els", -1, 1), new Among("fullt", -1, 3), 98 | new Among("l\u00F6st", -1, 2) 99 | ], 100 | g_v = [17, 65, 16, 1, 0, 0, 0, 0, 101 | 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 32 102 | ], 103 | g_s_ending = [119, 127, 149], 104 | I_x, I_p1, sbp = new SnowballProgram(); 105 | this.setCurrent = function(word) { 106 | sbp.setCurrent(word); 107 | }; 108 | this.getCurrent = function() { 109 | return sbp.getCurrent(); 110 | }; 111 | 112 | function r_mark_regions() { 113 | var v_1, c = sbp.cursor + 3; 114 | I_p1 = sbp.limit; 115 | if (0 <= c || c <= sbp.limit) { 116 | I_x = c; 117 | while (true) { 118 | v_1 = sbp.cursor; 119 | if (sbp.in_grouping(g_v, 97, 246)) { 120 | sbp.cursor = v_1; 121 | break; 122 | } 123 | sbp.cursor = v_1; 124 | if (sbp.cursor >= sbp.limit) 125 | return; 126 | sbp.cursor++; 127 | } 128 | while (!sbp.out_grouping(g_v, 97, 246)) { 129 | if (sbp.cursor >= sbp.limit) 130 | return; 131 | sbp.cursor++; 132 | } 133 | I_p1 = sbp.cursor; 134 | if (I_p1 < I_x) 135 | I_p1 = I_x; 136 | } 137 | } 138 | 139 | function r_main_suffix() { 140 | var among_var, v_2 = sbp.limit_backward; 141 | if (sbp.cursor >= I_p1) { 142 | sbp.limit_backward = I_p1; 143 | sbp.cursor = sbp.limit; 144 | sbp.ket = sbp.cursor; 145 | among_var = sbp.find_among_b(a_0, 37); 146 | sbp.limit_backward = v_2; 147 | if (among_var) { 148 | sbp.bra = sbp.cursor; 149 | switch (among_var) { 150 | case 1: 151 | sbp.slice_del(); 152 | break; 153 | case 2: 154 | if (sbp.in_grouping_b(g_s_ending, 98, 121)) 155 | sbp.slice_del(); 156 | break; 157 | } 158 | } 159 | } 160 | } 161 | 162 | function r_consonant_pair() { 163 | var v_1 = sbp.limit_backward; 164 | if (sbp.cursor >= I_p1) { 165 | sbp.limit_backward = I_p1; 166 | sbp.cursor = sbp.limit; 167 | if (sbp.find_among_b(a_1, 7)) { 168 | sbp.cursor = sbp.limit; 169 | sbp.ket = sbp.cursor; 170 | if (sbp.cursor > sbp.limit_backward) { 171 | sbp.bra = --sbp.cursor; 172 | sbp.slice_del(); 173 | } 174 | } 175 | sbp.limit_backward = v_1; 176 | } 177 | } 178 | 179 | function r_other_suffix() { 180 | var among_var, v_2; 181 | if (sbp.cursor >= I_p1) { 182 | v_2 = sbp.limit_backward; 183 | sbp.limit_backward = I_p1; 184 | sbp.cursor = sbp.limit; 185 | sbp.ket = sbp.cursor; 186 | among_var = sbp.find_among_b(a_2, 5); 187 | if (among_var) { 188 | sbp.bra = sbp.cursor; 189 | switch (among_var) { 190 | case 1: 191 | sbp.slice_del(); 192 | break; 193 | case 2: 194 | sbp.slice_from("l\u00F6s"); 195 | break; 196 | case 3: 197 | sbp.slice_from("full"); 198 | break; 199 | } 200 | } 201 | sbp.limit_backward = v_2; 202 | } 203 | } 204 | this.stem = function() { 205 | var v_1 = sbp.cursor; 206 | r_mark_regions(); 207 | sbp.limit_backward = v_1; 208 | sbp.cursor = sbp.limit; 209 | r_main_suffix(); 210 | sbp.cursor = sbp.limit; 211 | r_consonant_pair(); 212 | sbp.cursor = sbp.limit; 213 | r_other_suffix(); 214 | return true; 215 | } 216 | }; 217 | 218 | /* and return a function that stems a word for the current locale */ 219 | return function(word) { 220 | st.setCurrent(word); 221 | st.stem(); 222 | return st.getCurrent(); 223 | } 224 | })(); 225 | 226 | lunr.Pipeline.registerFunction(lunr.sv.stemmer, 'stemmer-sv'); 227 | 228 | /* stop word filter function */ 229 | lunr.sv.stopWordFilter = function(token) { 230 | if (lunr.sv.stopWordFilter.stopWords.indexOf(token) === -1) { 231 | return token; 232 | } 233 | }; 234 | 235 | lunr.sv.stopWordFilter.stopWords = new lunr.SortedSet(); 236 | lunr.sv.stopWordFilter.stopWords.length = 115; 237 | 238 | // The space at the beginning is crucial: It marks the empty string 239 | // as a stop word. lunr.js crashes during search when documents 240 | // processed by the pipeline still contain the empty string. 241 | lunr.sv.stopWordFilter.stopWords.elements = ' alla allt att av blev bli blir blivit de dem den denna deras dess dessa det detta dig din dina ditt du där då efter ej eller en er era ert ett från för ha hade han hans har henne hennes hon honom hur här i icke ingen inom inte jag ju kan kunde man med mellan men mig min mina mitt mot mycket ni nu när någon något några och om oss på samma sedan sig sin sina sitta själv skulle som så sådan sådana sådant till under upp ut utan vad var vara varför varit varje vars vart vem vi vid vilka vilkas vilken vilket vår våra vårt än är åt över'.split(' '); 242 | 243 | lunr.Pipeline.registerFunction(lunr.sv.stopWordFilter, 'stopWordFilter-sv'); 244 | }; 245 | })) --------------------------------------------------------------------------------