From 0c9bf1df50d967e67b7759e67d777217773468aa Mon Sep 17 00:00:00 2001 From: adueck Date: Fri, 13 Jan 2023 14:56:41 +0500 Subject: [PATCH] allow fem inflected plural form as well for animate nouns --- package-lock.json | 4 ++-- package.json | 2 +- src/components/package.json | 2 +- src/lib/package.json | 2 +- src/lib/src/pashto-inflector.ts | 1 - src/lib/src/phrase-building/render-np.ts | 8 +++++--- 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index a82647f..7b59c8e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "pashto-inflector", - "version": "5.3.1", + "version": "5.3.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "pashto-inflector", - "version": "5.3.1", + "version": "5.3.2", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index 299891c..bc76d37 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pashto-inflector", - "version": "5.3.1", + "version": "5.3.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 05fc4a6..bd7849b 100644 --- a/src/components/package.json +++ b/src/components/package.json @@ -1,6 +1,6 @@ { "name": "@lingdocs/ps-react", - "version": "5.3.1", + "version": "5.3.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 1797449..551aa70 100644 --- a/src/lib/package.json +++ b/src/lib/package.json @@ -1,6 +1,6 @@ { "name": "@lingdocs/inflect", - "version": "5.3.1", + "version": "5.3.2", "description": "Pashto inflector library", "main": "dist/index.js", "types": "dist/lib/library.d.ts", diff --git a/src/lib/src/pashto-inflector.ts b/src/lib/src/pashto-inflector.ts index 3caaecb..9615245 100644 --- a/src/lib/src/pashto-inflector.ts +++ b/src/lib/src/pashto-inflector.ts @@ -31,7 +31,6 @@ import { } from "./accent-helpers"; import * as T from "../../types"; import { splitFIntoPhonemes } from "./phonetics-to-diacritics"; -import { isNounEntry } from "./type-predicates"; const endingInSingleARegex = /[^a]'?’?[aá]'?’?$/; const endingInHeyOrAynRegex = /[^ا][هع]$/; diff --git a/src/lib/src/phrase-building/render-np.ts b/src/lib/src/phrase-building/render-np.ts index 8229fc9..bbc03ad 100644 --- a/src/lib/src/phrase-building/render-np.ts +++ b/src/lib/src/phrase-building/render-np.ts @@ -27,7 +27,7 @@ export function renderNPSelection(NP: T.NPSelection, inflected: boolean, inflect } if (NP.selection.type === "noun") { return { - type: "NP", + type: "NP", selection: renderNounSelection(NP.selection, inflected, soRole, undefined, isPuSandwich), }; } @@ -58,8 +58,10 @@ export function renderNounSelection(n: T.NounSelection, inflected: boolean, role return [ ...plural, ...getInf(infs, "arabicPlural", n.gender, true, inflected), - // TODO: if it's an INANIMATE NOUN and it inflects allow the inflected form too? - ...!plural.length ? getInf(infs, "inflections", n.gender, true, inflected) : [], + ...(!plural.length || n.gender === "fem") + // allow for plurals like ډاکټرې as well as ډاکټرانې + ? getInf(infs, "inflections", n.gender, true, inflected) + : [], ]; })(); return ps.length > 0