From 51f5920e2c4d9832b7c4ed4980df405c61f6f442 Mon Sep 17 00:00:00 2001 From: lingdocs <71590811+lingdocs@users.noreply.github.com> Date: Sun, 14 Aug 2022 14:00:36 +0430 Subject: [PATCH] when inflecting words avoid the maashoomo problem --- package.json | 2 +- src/lib/phrase-building/render-np.ts | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 46e07ba..a063d63 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@lingdocs/pashto-inflector", - "version": "3.7.2", + "version": "3.7.3", "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/lib/phrase-building/render-np.ts b/src/lib/phrase-building/render-np.ts index aeb6fa4..ea9a70f 100644 --- a/src/lib/phrase-building/render-np.ts +++ b/src/lib/phrase-building/render-np.ts @@ -52,11 +52,14 @@ export function renderNounSelection(n: T.NounSelection, inflected: boolean, role const infs = inflectWord(n.entry); const ps = n.number === "singular" ? getInf(infs, "inflections", n.gender, false, inflected) - : [ - ...getInf(infs, "plural", n.gender, true, inflected), - ...getInf(infs, "arabicPlural", n.gender, true, inflected), - ...getInf(infs, "inflections", n.gender, true, inflected), - ]; + : (() => { + const plural = getInf(infs, "plural", n.gender, true, inflected); + return [ + ...plural, + ...getInf(infs, "arabicPlural", n.gender, true, inflected), + ...!plural.length ? getInf(infs, "inflections", n.gender, true, inflected) : [], + ]; + })(); return ps.length > 0 ? ps : [psStringFromEntry(n.entry)];