more perfect vars
This commit is contained in:
parent
eef285aead
commit
d94b1d3d71
|
@ -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,
|
||||
|
|
|
@ -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++) {
|
||||
|
|
|
@ -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,30 +254,58 @@ function getMatrixBlock<U>(f: {
|
|||
return f[personToLabel(person)];
|
||||
}
|
||||
|
||||
function getTenseVerbForm(conj: T.VerbConjugation, tense: VerbTense | PerfectTense): T.VerbForm {
|
||||
if (tense === "presentVerb") {
|
||||
return conj.imperfective.nonImperative;
|
||||
function getTenseVerbForm(conj: T.VerbConjugation, tense: VerbTense | PerfectTense, tenseCategory: "basic" | "modal" | "perfect"): T.VerbForm {
|
||||
if (tenseCategory === "basic") {
|
||||
if (tense === "presentVerb") {
|
||||
return conj.imperfective.nonImperative;
|
||||
}
|
||||
if (tense === "subjunctiveVerb") {
|
||||
return conj.perfective.nonImperative;
|
||||
}
|
||||
if (tense === "imperfectiveFuture") {
|
||||
return conj.imperfective.future;
|
||||
}
|
||||
if (tense === "perfectiveFuture") {
|
||||
return conj.perfective.future;
|
||||
}
|
||||
if (tense === "imperfectivePast") {
|
||||
return conj.imperfective.past;
|
||||
}
|
||||
if (tense === "perfectivePast") {
|
||||
return conj.perfective.past;
|
||||
}
|
||||
if (tense === "habitualImperfectivePast") {
|
||||
return conj.imperfective.habitualPast;
|
||||
}
|
||||
if (tense === "habitualPerfectivePast") {
|
||||
return conj.perfective.habitualPast;
|
||||
}
|
||||
}
|
||||
if (tense === "subjunctiveVerb") {
|
||||
return conj.perfective.nonImperative;
|
||||
}
|
||||
if (tense === "imperfectiveFuture") {
|
||||
return conj.imperfective.future;
|
||||
}
|
||||
if (tense === "perfectiveFuture") {
|
||||
return conj.perfective.future;
|
||||
}
|
||||
if (tense === "imperfectivePast") {
|
||||
return conj.imperfective.past;
|
||||
}
|
||||
if (tense === "perfectivePast") {
|
||||
return conj.perfective.past;
|
||||
}
|
||||
if (tense === "habitualImperfectivePast") {
|
||||
return conj.imperfective.habitualPast;
|
||||
}
|
||||
if (tense === "habitualPerfectivePast") {
|
||||
return conj.perfective.habitualPast;
|
||||
if (tenseCategory === "modal") {
|
||||
if (tense === "presentVerb") {
|
||||
return conj.imperfective.modal.nonImperative;
|
||||
}
|
||||
if (tense === "subjunctiveVerb") {
|
||||
return conj.perfective.modal.nonImperative;
|
||||
}
|
||||
if (tense === "imperfectiveFuture") {
|
||||
return conj.imperfective.modal.future;
|
||||
}
|
||||
if (tense === "perfectiveFuture") {
|
||||
return conj.perfective.modal.future;
|
||||
}
|
||||
if (tense === "imperfectivePast") {
|
||||
return conj.imperfective.modal.past;
|
||||
}
|
||||
if (tense === "perfectivePast") {
|
||||
return conj.perfective.modal.past;
|
||||
}
|
||||
if (tense === "habitualImperfectivePast") {
|
||||
return conj.imperfective.modal.habitualPast;
|
||||
}
|
||||
if (tense === "habitualPerfectivePast") {
|
||||
return conj.perfective.modal.habitualPast;
|
||||
}
|
||||
}
|
||||
if (tense === "present perfect") {
|
||||
return conj.perfect.present;
|
||||
|
@ -300,30 +328,6 @@ function getTenseVerbForm(conj: T.VerbConjugation, tense: VerbTense | PerfectTen
|
|||
if (tense === "pastSubjunctive perfect") {
|
||||
return conj.perfect.pastSubjunctiveHypothetical;
|
||||
}
|
||||
if (tense === "presentVerb") {
|
||||
return conj.imperfective.modal.nonImperative;
|
||||
}
|
||||
if (tense === "subjunctiveVerb") {
|
||||
return conj.perfective.modal.nonImperative;
|
||||
}
|
||||
if (tense === "imperfectiveFuture") {
|
||||
return conj.imperfective.modal.future;
|
||||
}
|
||||
if (tense === "perfectiveFuture") {
|
||||
return conj.perfective.modal.future;
|
||||
}
|
||||
if (tense === "imperfectivePast") {
|
||||
return conj.imperfective.modal.past;
|
||||
}
|
||||
if (tense === "perfectivePast") {
|
||||
return conj.perfective.modal.past;
|
||||
}
|
||||
if (tense === "habitualImperfectivePast") {
|
||||
return conj.imperfective.modal.habitualPast;
|
||||
}
|
||||
if (tense === "habitualPerfectivePast") {
|
||||
return conj.perfective.modal.habitualPast;
|
||||
}
|
||||
throw new Error("unknown tense");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue