From 6f57ee43a4525b0995d40779e04a508a23524fef Mon Sep 17 00:00:00 2001 From: adueck Date: Sat, 24 Sep 2022 17:58:03 +0400 Subject: [PATCH] fixed issue with converting instead of reverting spelling --- website/src/lib/dictionary.ts | 4 ++-- website/src/lib/wee-bit-fuzzy.ts | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/website/src/lib/dictionary.ts b/website/src/lib/dictionary.ts index 0acdb06..ba1ae17 100644 --- a/website/src/lib/dictionary.ts +++ b/website/src/lib/dictionary.ts @@ -11,9 +11,9 @@ import sanitizePashto from "./sanitize-pashto"; import fillerWords from "./filler-words"; import { Types as T, - convertSpelling, simplifyPhonetics, typePredicates as tp, + revertSpelling, } from "@lingdocs/pashto-inflector"; import { isPashtoScript } from "./is-pashto"; import { fuzzifyPashto } from "./fuzzify-pashto/fuzzify-pashto"; @@ -447,7 +447,7 @@ export const dictionary: DictionaryAPI = { initialize: async () => await dictDb.initialize(), update: async (notifyUpdateComing: () => void) => await dictDb.updateDictionary(notifyUpdateComing), search: function(state: State): T.DictionaryEntry[] { - const searchString = convertSpelling( + const searchString = revertSpelling( state.searchValue, getTextOptions(state).spelling, ); diff --git a/website/src/lib/wee-bit-fuzzy.ts b/website/src/lib/wee-bit-fuzzy.ts index 318c32b..f7b591a 100644 --- a/website/src/lib/wee-bit-fuzzy.ts +++ b/website/src/lib/wee-bit-fuzzy.ts @@ -36,6 +36,7 @@ const dSounds = "[د|ډ]"; const rSounds = "[ر|ړ|ڼ]"; const nSounds = "[ن|ڼ]"; const hKhSounds = "[خ|ح|ښ|ه]"; +const alef = "[آ|ا]"; const pReplacer = { "ی": fiveYeys, @@ -73,6 +74,9 @@ const pReplacer = { "ح": hKhSounds, "ښ": hKhSounds, "ه": hKhSounds, + + "ا": alef, + "آ": alef, }; const fiveYeysF = "(?:eyy|ey|ee|e|uy)";