From e733e55e2b7b1b8fafc5b117d31891d0058da9c7 Mon Sep 17 00:00:00 2001 From: lingdocs <71590811+lingdocs@users.noreply.github.com> Date: Tue, 26 Jul 2022 15:52:25 -0500 Subject: [PATCH] ability to add tails in getPassiveRootsAndStems --- package.json | 2 +- .../phrase-building/english-vp-rendering.ts | 2 +- src/lib/verb-info.ts | 36 +++++++++++-------- 3 files changed, 24 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index b7e5179..65e65b3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@lingdocs/pashto-inflector", - "version": "3.5.4", + "version": "3.5.5", "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/english-vp-rendering.ts b/src/lib/phrase-building/english-vp-rendering.ts index 6089ebc..883c2d2 100644 --- a/src/lib/phrase-building/english-vp-rendering.ts +++ b/src/lib/phrase-building/english-vp-rendering.ts @@ -162,8 +162,8 @@ export function renderEnglishVPBase({ subjectPerson, object, vs }: { `$SUBJ ${engEquative("present", s)}${n ? " not" : ""} ${v[4]}`, ]), subjunctiveVerb: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([ - `that $SUBJ will${n ? " not" : ""} be ${v[4]}`, `$SUBJ should ${n ? " not" : ""} be ${v[4]}`, + `that $SUBJ will${n ? " not" : ""} be ${v[4]}`, ]), imperfectiveFuture: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([ `$SUBJ will${n ? " not" : ""} be ${v[4]}`, diff --git a/src/lib/verb-info.ts b/src/lib/verb-info.ts index 3b71df5..b45f23f 100644 --- a/src/lib/verb-info.ts +++ b/src/lib/verb-info.ts @@ -982,23 +982,28 @@ function makeDynamicPerfectiveSplit(comp: T.PsString, auxSplit: T.SplitInfo): T. ]; } -export function getPassiveRootsAndStems(info: T.NonComboVerbInfo): T.PassiveRootsStems | undefined { +export function getPassiveRootsAndStems(info: T.NonComboVerbInfo, withTails?: boolean): T.PassiveRootsStems | undefined { + console.log({ withTails }); if (info.transitivity === "intransitive") return undefined; return { - stem: getPassiveStem(info.root, info.root.perfectiveSplit), - root: getPassiveRoot(info.root, info.root.perfectiveSplit), + stem: getPassiveStem(info.root, info.root.perfectiveSplit, withTails), + root: getPassiveRoot(info.root, info.root.perfectiveSplit, withTails), participle: { - past: getPassivePastParticiple(info.root.imperfective), + past: getPassivePastParticiple(info.root.imperfective, withTails), }, }; } -function getPassiveStem(root: T.VerbRootSet, splitInfo: T.SplitInfo | undefined): T.VerbStemSet { +const passiveRootTail: T.PsString = { p: "ی", f: "ey" }; + +function getPassiveStem(root: T.VerbRootSet, splitInfo: T.SplitInfo | undefined, withTails?: boolean): T.VerbStemSet { + const perfectiveRoot = withTails ? concatPsString(root.perfective, passiveRootTail) : root.perfective; + const imperfectiveRoot = withTails ? concatPsString(root.imperfective, passiveRootTail) : root.imperfective; return { - perfective: getPassiveStemAspect(root.perfective, "perfective"), - imperfective: getPassiveStemAspect(root.imperfective, "imperfective"), + perfective: getPassiveStemAspect(perfectiveRoot, "perfective"), + imperfective: getPassiveStemAspect(imperfectiveRoot, "imperfective"), ...splitInfo ? { - perfectiveSplit: getPassiveStemPerfectiveSplit(root.perfective, splitInfo), + perfectiveSplit: getPassiveStemPerfectiveSplit(perfectiveRoot, splitInfo), } : {}, }; } @@ -1046,17 +1051,19 @@ function getPassiveRootPerfectiveSplit(root: T.OptionalPersonInflections>): T.OptionalPersonInflections> { +function getPassivePastParticiple(root: T.OptionalPersonInflections>, withTails?: boolean): T.OptionalPersonInflections> { if ("mascSing" in root) { return { "mascSing": getPassivePastParticiple(root.mascSing) as T.LengthOptions, @@ -1065,8 +1072,9 @@ function getPassivePastParticiple(root: T.OptionalPersonInflections, }; } + const r = withTails ? concatPsString(root, passiveRootTail) : root; // @ts-ignore - return concatPsString(getLong(root), " ", stativeAux.intransitive.info.participle.past) as T.PsString; + return concatPsString(getLong(r), " ", stativeAux.intransitive.info.participle.past) as T.PsString; } function getPassiveStemAspect(root: T.FullForm, aspect: T.Aspect): T.FullForm {