UNPKG

@skiff-org/trawler

Version:

A modern search library for Skiff

185 lines (176 loc) 2.77 kB
/** * Filter are also known as "stopwords", they completely filter out words from being indexed. * Source: http://www.ranks.nl/stopwords * Object Definition: Just provide an array of words. * @type {Array<string>} */ export const filter = [ 'aber', 'als', 'am', 'an', 'auch', 'auf', 'aus', 'bei', 'bin', 'bis', 'bist', 'da', 'dadurch', 'daher', 'darum', 'das', 'daß', 'dass', 'dein', 'deine', 'dem', 'den', 'der', 'des', 'dessen', 'deshalb', 'die', 'dies', 'dieser', 'dieses', 'doch', 'dort', 'du', 'durch', 'ein', 'eine', 'einem', 'einen', 'einer', 'eines', 'er', 'es', 'euer', 'eure', 'für', 'hatte', 'hatten', 'hattest', 'hattet', 'hier', 'hinter', 'ich', 'ihr', 'ihre', 'im', 'in', 'ist', 'ja', 'jede', 'jedem', 'jeden', 'jeder', 'jedes', 'jener', 'jenes', 'jetzt', 'kann', 'kannst', 'können', 'könnt', 'machen', 'mein', 'meine', 'mit', 'muß', 'mußt', 'musst', 'müssen', 'müßt', 'nach', 'nachdem', 'nein', 'nicht', 'nun', 'oder', 'seid', 'sein', 'seine', 'sich', 'sie', 'sind', 'soll', 'sollen', 'sollst', 'sollt', 'sonst', 'soweit', 'sowie', 'und', 'unser', 'unsere', 'unter', 'vom', 'von', 'vor', 'wann', 'warum', 'was', 'weiter', 'weitere', 'wenn', 'wer', 'werde', 'werden', 'werdet', 'weshalb', 'wie', 'wieder', 'wieso', 'wir', 'wird', 'wirst', 'wo', 'woher', 'wohin', 'zu', 'zum', 'zur', 'über' ]; /** * Stemmer removes word endings and is a kind of "partial normalization". A word ending just matched when the word length is bigger than the matched partial. * Example: The word "correct" and "correctness" could be the same word, so you can define {"ness": ""} to normalize the ending. * Object Definition: the key represents the word ending, the value contains the replacement (or empty string for removal). * @type {Object<string, string>} */ export const stemmer = { 'niss': '', 'isch': '', 'lich': '', 'heit': '', 'keit': '', 'ell': '', 'bar': '', 'end': '', 'ung': '', 'est': '', 'ern': '', 'em': '', 'er': '', 'en': '', 'es': '', 'st': '', 'ig': '', 'ik': '', 'e': '', 's': '' }; /** * Matcher replaces all occurrences of a given string regardless of its position and is also a kind of "partial normalization". * Object Definition: the key represents the target term, the value contains the search string which should be replaced (could also be an array of multiple terms). * @type {Object<string, Array<string>|string>} */ export const matcher = {}; export default { filter: filter, stemmer: stemmer, matcher: matcher };