From e22116aa197ddb94b168f3bcbced85b492545405 Mon Sep 17 00:00:00 2001 From: adueck Date: Sat, 18 Feb 2023 14:56:38 +0500 Subject: [PATCH] better handling of english apostrophe --- package-lock.json | 4 ++-- package.json | 2 +- src/components/package.json | 2 +- src/lib/package.json | 2 +- src/lib/src/phrase-building/np-tools.ts | 5 +++-- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index 26e4ac3..ed67401 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "pashto-inflector", - "version": "5.8.1", + "version": "5.8.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "pashto-inflector", - "version": "5.8.1", + "version": "5.8.2", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index 7e5e8fb..918ddcc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pashto-inflector", - "version": "5.8.1", + "version": "5.8.2", "author": "lingdocs.com", "description": "A Pashto inflection and verb conjugation engine, inculding React components for displaying Pashto text, inflections, and conjugations", "homepage": "https://verbs.lingdocs.com", diff --git a/src/components/package.json b/src/components/package.json index a16185b..650e53c 100644 --- a/src/components/package.json +++ b/src/components/package.json @@ -1,6 +1,6 @@ { "name": "@lingdocs/ps-react", - "version": "5.8.1", + "version": "5.8.2", "description": "Pashto inflector library module with React components", "main": "dist/components/library.js", "module": "dist/components/library.js", diff --git a/src/lib/package.json b/src/lib/package.json index 215eab4..4643e89 100644 --- a/src/lib/package.json +++ b/src/lib/package.json @@ -1,6 +1,6 @@ { "name": "@lingdocs/inflect", - "version": "5.8.1", + "version": "5.8.2", "description": "Pashto inflector library", "main": "dist/index.js", "types": "dist/lib/library.d.ts", diff --git a/src/lib/src/phrase-building/np-tools.ts b/src/lib/src/phrase-building/np-tools.ts index c11d89c..bd60782 100644 --- a/src/lib/src/phrase-building/np-tools.ts +++ b/src/lib/src/phrase-building/np-tools.ts @@ -173,9 +173,10 @@ function addPossesors(possesor: T.Rendered | undefined, base: str } const possesorE = getEnglishFromRendered(possesor); if (!possesorE) return undefined; + const withApostrophe = `${possesorE}'${possesorE.endsWith("s") ? "" : "s"}`; return type === "noun" - ? `${possesorE}'s ${removeArticles(base)}` - : `(${possesorE}'s) ${removeArticles(base)} (${possesorE})`; + ? `${withApostrophe} ${removeArticles(base)}` + : `(${withApostrophe}) ${removeArticles(base)} (${possesorE})`; } function pronounPossEng(p: T.Person): string {