ability to add tails in getPassiveRootsAndStems

This commit is contained in:
lingdocs 2022-07-26 15:52:25 -05:00
parent 583c5a81c8
commit e733e55e2b
3 changed files with 24 additions and 16 deletions

View File

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

View File

@ -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]}`,

View File

@ -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.Lengt
};
}
function getPassiveRoot(root: T.VerbRootSet, splitInfo: T.SplitInfo | undefined): T.VerbRootSet {
function getPassiveRoot(root: T.VerbRootSet, splitInfo: T.SplitInfo | undefined, withTails?: boolean): T.VerbRootSet {
const perfectiveRoot = withTails ? concatPsString(root.perfective, passiveRootTail) : root.perfective;
const imperfectiveRoot = withTails ? concatPsString(root.imperfective, passiveRootTail) : root.imperfective;
return {
perfective: getPassiveRootAspect(root.perfective, "perfective"),
imperfective: getPassiveRootAspect(root.imperfective, "imperfective"),
perfective: getPassiveRootAspect(perfectiveRoot, "perfective"),
imperfective: getPassiveRootAspect(imperfectiveRoot, "imperfective"),
...splitInfo ? {
perfectiveSplit: getPassiveRootPerfectiveSplit(root.perfective, splitInfo),
perfectiveSplit: getPassiveRootPerfectiveSplit(perfectiveRoot, splitInfo),
} : {},
};
}
function getPassivePastParticiple(root: T.OptionalPersonInflections<T.LengthOptions<T.PsString>>): T.OptionalPersonInflections<T.LengthOptions<T.PsString>> {
function getPassivePastParticiple(root: T.OptionalPersonInflections<T.LengthOptions<T.PsString>>, withTails?: boolean): T.OptionalPersonInflections<T.LengthOptions<T.PsString>> {
if ("mascSing" in root) {
return {
"mascSing": getPassivePastParticiple(root.mascSing) as T.LengthOptions<T.PsString>,
@ -1065,8 +1072,9 @@ function getPassivePastParticiple(root: T.OptionalPersonInflections<T.LengthOpti
"femPlur": getPassivePastParticiple(root.femPlur) as T.LengthOptions<T.PsString>,
};
}
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<T.PsString>, aspect: T.Aspect): T.FullForm<T.PsString> {