From 3b36000a4b74cf80dcb10f84dfcf707531a7fc6d Mon Sep 17 00:00:00 2001 From: lingdocs <71590811+lingdocs@users.noreply.github.com> Date: Tue, 31 May 2022 19:17:22 -0500 Subject: [PATCH] fix passive english translations --- package.json | 2 +- src/lib/phrase-building/compile.ts | 8 +++++++- src/lib/verb-info.ts | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index eec3131..ebcf7ea 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@lingdocs/pashto-inflector", - "version": "2.7.0", + "version": "2.7.1", "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/compile.ts b/src/lib/phrase-building/compile.ts index b621e6b..7cbdb0f 100644 --- a/src/lib/phrase-building/compile.ts +++ b/src/lib/phrase-building/compile.ts @@ -379,13 +379,19 @@ function addSpacesBetweenSegments(segments: Segment[]): (Segment | " " | "" | T. } function compileEnglishVP(VP: T.VPRendered): string[] | undefined { + console.log("will compile english VP"); function insertEWords(e: string, { subject, object, APs }: { subject: string, object?: string, APs: string }): string { return e.replace("$SUBJ", subject).replace("$OBJ", object || "") + APs; } const engSubj = getRenderedSubjectSelection(VP.blocks).selection; const obj = getRenderedObjectSelection(VP.blocks).selection; - const engObj = typeof obj === "object" ? obj : undefined; + const engObj = typeof obj === "object" + ? obj + : obj === "none" + ? "" + : undefined; const engAPs = getEnglishAPs(VP.blocks); + console.log({ base: VP.englishBase, obj, engSubj, engObj }) // require all English parts for making the English phrase return (VP.englishBase && engSubj && engObj !== undefined) ? VP.englishBase.map(e => insertEWords(e, { diff --git a/src/lib/verb-info.ts b/src/lib/verb-info.ts index e9ba20a..92ad2db 100644 --- a/src/lib/verb-info.ts +++ b/src/lib/verb-info.ts @@ -966,7 +966,7 @@ function makeDynamicPerfectiveSplit(comp: T.PsString, auxSplit: T.SplitInfo): T. } export function getPassiveRootsAndStems(info: T.NonComboVerbInfo): T.PassiveRootsStems | undefined { - if (info.transitivity !== "transitive") return undefined; + if (info.transitivity === "intransitive") return undefined; return { stem: getPassiveStem(info.root, info.root.perfectiveSplit), root: getPassiveRoot(info.root, info.root.perfectiveSplit),