more perfect vars

This commit is contained in:
lingdocs 2022-03-30 23:36:15 +05:00
parent eef285aead
commit d94b1d3d71
3 changed files with 86 additions and 56 deletions

View File

@ -269,18 +269,26 @@ function makeVerbSelection(verb: VerbEntry, oldVerbSelection?: VerbSelection): V
: "dynamic" in info
? { entry: info.dynamic.auxVerb } as VerbEntry
: undefined;
const tenseSelection = ((): { tenseCategory: "perfect", tense: PerfectTense } | {
tenseCategory: "basic" | "modal",
tense: VerbTense,
} => {
if (!oldVerbSelection) {
return { tense: "presentVerb", tenseCategory: "basic" };
}
if (oldVerbSelection.tenseCategory === "modal") {
return { tenseCategory: "modal", tense: isPerfectTense(oldVerbSelection.tense) ? "presentVerb" : oldVerbSelection.tense };
}
if (oldVerbSelection.tenseCategory === "basic") {
return { tenseCategory: "basic", tense: isPerfectTense(oldVerbSelection.tense) ? "presentVerb" : oldVerbSelection.tense };
}
return { tenseCategory: "perfect", tense: isPerfectTense(oldVerbSelection.tense) ? oldVerbSelection.tense : "present perfect" };
})();
return {
type: "verb",
verb: verb,
dynAuxVerb,
...oldVerbSelection ? {
// TODO: carry it over from the old selection!!
tense: "presentVerb",
tenseCategory: "basic",
} : {
tense: "presentVerb",
tenseCategory: "basic",
},
...tenseSelection,
object,
transitivity,
isCompound,

View File

@ -8,6 +8,12 @@ import {
} from "@lingdocs/pashto-inflector";
import { removeBa } from "./vp-tools";
// also
// nú dey me leeduley
// نه مې دی لیدلی - nú me dey leeduley
// لیدلی مې نه دی - leeduley me nú dey
//
// TODO: make it an option to include O S V order ?
// TODO: tu ba laaR nu she hyphens all messed up
type Form = FormVersion & { OSV?: boolean };
@ -161,6 +167,14 @@ function arrangeVerbWNegative(head: T.PsString | undefined, restRaw: T.PsString[
if (!headSegment) {
if ("front" in rest) {
return [
// pefect nu dey me leeduley and nu me dey leeduley
[
mergeSegments(
makeSegment(nu, ["isNu"]),
rest.last.adjust({ ps: removeAccents }),
),
rest.front.adjust({ ps: removeAccents }),
],
[
makeSegment(nu, ["isNu"]),
rest.last.adjust({ ps: removeAccents }),
@ -233,6 +247,10 @@ function shrinkNP(np: Rendered<NPSelection>): Segment {
return makeSegment(grammarUnits.pronouns.mini[row][col], ["isKid", "isMiniPronoun"]);
}
function mergeSegments(s1: Segment, s2: Segment): Segment {
return s2.adjust({ ps: (p) => concatPsString(s1.ps[0], " ", p) });
}
function addSpacesBetweenSegments(segments: Segment[]): (Segment | " " | "" | T.PsString)[] {
const o: (Segment | " " | "" | T.PsString)[] = [];
for (let i = 0; i < segments.length; i++) {

View File

@ -152,7 +152,7 @@ function getPsVerbConjugation(conj: T.VerbConjugation, vs: VerbSelection, person
},
hasBa: boolean,
} {
const f = getTenseVerbForm(conj, vs.tense);
const f = getTenseVerbForm(conj, vs.tense, vs.tenseCategory);
const block = getMatrixBlock(f, objectPerson, person);
const perfective = isPerfective(vs.tense);
const verbForm = getVerbFromBlock(block, person);
@ -254,7 +254,8 @@ function getMatrixBlock<U>(f: {
return f[personToLabel(person)];
}
function getTenseVerbForm(conj: T.VerbConjugation, tense: VerbTense | PerfectTense): T.VerbForm {
function getTenseVerbForm(conj: T.VerbConjugation, tense: VerbTense | PerfectTense, tenseCategory: "basic" | "modal" | "perfect"): T.VerbForm {
if (tenseCategory === "basic") {
if (tense === "presentVerb") {
return conj.imperfective.nonImperative;
}
@ -279,27 +280,8 @@ function getTenseVerbForm(conj: T.VerbConjugation, tense: VerbTense | PerfectTen
if (tense === "habitualPerfectivePast") {
return conj.perfective.habitualPast;
}
if (tense === "present perfect") {
return conj.perfect.present;
}
if (tense === "past perfect") {
return conj.perfect.past;
}
if (tense === "future perfect") {
return conj.perfect.future;
}
if (tense === "habitual perfect") {
return conj.perfect.habitual;
}
if (tense === "subjunctive perfect") {
return conj.perfect.subjunctive;
}
if (tense === "wouldBe perfect") {
return conj.perfect.affirmational;
}
if (tense === "pastSubjunctive perfect") {
return conj.perfect.pastSubjunctiveHypothetical;
}
if (tenseCategory === "modal") {
if (tense === "presentVerb") {
return conj.imperfective.modal.nonImperative;
}
@ -324,6 +306,28 @@ function getTenseVerbForm(conj: T.VerbConjugation, tense: VerbTense | PerfectTen
if (tense === "habitualPerfectivePast") {
return conj.perfective.modal.habitualPast;
}
}
if (tense === "present perfect") {
return conj.perfect.present;
}
if (tense === "past perfect") {
return conj.perfect.past;
}
if (tense === "future perfect") {
return conj.perfect.future;
}
if (tense === "habitual perfect") {
return conj.perfect.habitual;
}
if (tense === "subjunctive perfect") {
return conj.perfect.subjunctive;
}
if (tense === "wouldBe perfect") {
return conj.perfect.affirmational;
}
if (tense === "pastSubjunctive perfect") {
return conj.perfect.pastSubjunctiveHypothetical;
}
throw new Error("unknown tense");
}