fix passive english translations

This commit is contained in:
lingdocs 2022-05-31 19:17:22 -05:00
parent 9a10fc1559
commit 3b36000a4b
3 changed files with 9 additions and 3 deletions

View File

@ -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",

View File

@ -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, {

View File

@ -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),