From 5ae5458bf03d88785b5749f009ad89e5901015ce Mon Sep 17 00:00:00 2001 From: uri Date: Wed, 10 Apr 2024 12:15:38 +0300 Subject: [PATCH] add-character --- src/index.test.ts | 5 ++++- src/index.ts | 7 +++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/index.test.ts b/src/index.test.ts index 369fcbd..de54dae 100644 --- a/src/index.test.ts +++ b/src/index.test.ts @@ -34,7 +34,10 @@ const testUnaryFn = testUnaryFn( "someKewyordMatches", someKewyordMatches(["בדסמ"]), -)([["חוזרים ליסודות בהרצאת “מבוא לבדסמ” במענטש, ב-15/01/24", true]]); +)([ + ["חוזרים ליסודות בהרצאת “מבוא לבדסמ” במענטש, ב-15/01/24", true], + ["בדסמ+", true], +]); testFn( "prefixesWithSuffix", diff --git a/src/index.ts b/src/index.ts index 60afeec..16a3fc4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -162,7 +162,7 @@ export const replaceSmartQuotes = pipe( replace(/[“”]/g, '"'), ); -const replaceDidgitNames = pipe( +const replaceDigitNames = pipe( replace(/\bten\b/g, "10"), replace(/\bnine\b/g, "9"), replace(/\beight\b/g, "8"), @@ -183,11 +183,10 @@ export const simplify: (x: string) => string = pipe( (x: string) => x.trim(), replaceSmartQuotes, lowercase, - replace(/\s/g, " "), - replaceDidgitNames, + replaceDigitNames, replace(/\[.*\]/, ""), replace(/[*:'"♪]/g, ""), - replace(/[,.?!\n-]/g, " "), + replace(/[,.?!\n-+]/g, " "), replace(/\s+/g, " "), replace(/<\/?i>/g, ""), replace(/\bdoctor\b/g, "dr"),