1
0
mirror of https://github.com/nextapps-de/flexsearch.git synced 2025-09-01 18:03:56 +02:00

refactor english language preset (looped stemmer)

This commit is contained in:
Thomas Wilkerling
2025-04-17 10:10:47 +02:00
parent b75cccb0f8
commit 357a37be9e

View File

@@ -129,7 +129,7 @@ export const filter = new Set([
"out", "out",
"over", "over",
"own", "own",
"people", //"people",
"same", "same",
"say", "say",
"see", "see",
@@ -223,22 +223,22 @@ export const filter = new Set([
*/ */
export const stemmer = new Map([ export const stemmer = new Map([
["ational", ""], //["ational", "ate"],
["iveness", ""], //["iveness", ""],
["fulness", ""], //["fulness", ""],
["ousness", ""], //["ousness", ""],
["ization", ""], ["ization", ""],
["tional", "tion"], //["tional", "tion"],
["biliti", ""], ["biliti", ""],
["icate", ""], ["icate", ""],
["ative", ""], ["ative", ""],
["alize", ""], //["alize", ""],
["iciti", ""], //["iciti", ""],
["entli", ""], //["entli", ""],
["ousli", ""], //["ousli", ""],
["alism", ""], //["alism", ""],
["ation", ""], ["ation", ""],
["aliti", ""], //["aliti", ""],
["iviti", ""], ["iviti", ""],
["ement", ""], ["ement", ""],
["izer", ""], ["izer", ""],
@@ -254,6 +254,7 @@ export const stemmer = new Map([
["ness", ""], ["ness", ""],
["ble", ""], ["ble", ""],
["ment", ""], ["ment", ""],
//["nal", "n"],
["eli", ""], ["eli", ""],
["bli", ""], ["bli", ""],
["ful", ""], ["ful", ""],
@@ -272,7 +273,7 @@ export const stemmer = new Map([
["ou", ""], ["ou", ""],
["er", ""], ["er", ""],
["ed", ""], ["ed", ""],
["es", "e"], //["es", "e"],
["ic", ""], ["ic", ""],
["ly", ""], ["ly", ""],
["li", ""], ["li", ""],
@@ -315,7 +316,7 @@ const options = {
return str return str
// normalize symbols // normalize symbols
.replace(/´`ʼ/g, "'") .replace(/´`ʼ/g, "'")
.replace(/_+/g, " ") //.replace(/[_\-]+/g, " ")
.replace(/&/g, " and ") .replace(/&/g, " and ")
.replace(/\$/g, " USD ") .replace(/\$/g, " USD ")
.replace(/£/g, " GBP ") .replace(/£/g, " GBP ")