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
|
: "dynamic" in info
|
||||||
? { entry: info.dynamic.auxVerb } as VerbEntry
|
? { entry: info.dynamic.auxVerb } as VerbEntry
|
||||||
: undefined;
|
: 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 {
|
return {
|
||||||
type: "verb",
|
type: "verb",
|
||||||
verb: verb,
|
verb: verb,
|
||||||
dynAuxVerb,
|
dynAuxVerb,
|
||||||
...oldVerbSelection ? {
|
...tenseSelection,
|
||||||
// TODO: carry it over from the old selection!!
|
|
||||||
tense: "presentVerb",
|
|
||||||
tenseCategory: "basic",
|
|
||||||
} : {
|
|
||||||
tense: "presentVerb",
|
|
||||||
tenseCategory: "basic",
|
|
||||||
},
|
|
||||||
object,
|
object,
|
||||||
transitivity,
|
transitivity,
|
||||||
isCompound,
|
isCompound,
|
||||||
|
|
|
@ -8,6 +8,12 @@ import {
|
||||||
} from "@lingdocs/pashto-inflector";
|
} from "@lingdocs/pashto-inflector";
|
||||||
import { removeBa } from "./vp-tools";
|
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: make it an option to include O S V order ?
|
||||||
// TODO: tu ba laaR nu she hyphens all messed up
|
// TODO: tu ba laaR nu she hyphens all messed up
|
||||||
type Form = FormVersion & { OSV?: boolean };
|
type Form = FormVersion & { OSV?: boolean };
|
||||||
|
@ -161,6 +167,14 @@ function arrangeVerbWNegative(head: T.PsString | undefined, restRaw: T.PsString[
|
||||||
if (!headSegment) {
|
if (!headSegment) {
|
||||||
if ("front" in rest) {
|
if ("front" in rest) {
|
||||||
return [
|
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"]),
|
makeSegment(nu, ["isNu"]),
|
||||||
rest.last.adjust({ ps: removeAccents }),
|
rest.last.adjust({ ps: removeAccents }),
|
||||||
|
@ -233,6 +247,10 @@ function shrinkNP(np: Rendered<NPSelection>): Segment {
|
||||||
return makeSegment(grammarUnits.pronouns.mini[row][col], ["isKid", "isMiniPronoun"]);
|
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)[] {
|
function addSpacesBetweenSegments(segments: Segment[]): (Segment | " " | "" | T.PsString)[] {
|
||||||
const o: (Segment | " " | "" | T.PsString)[] = [];
|
const o: (Segment | " " | "" | T.PsString)[] = [];
|
||||||
for (let i = 0; i < segments.length; i++) {
|
for (let i = 0; i < segments.length; i++) {
|
||||||
|
|
|
@ -152,7 +152,7 @@ function getPsVerbConjugation(conj: T.VerbConjugation, vs: VerbSelection, person
|
||||||
},
|
},
|
||||||
hasBa: boolean,
|
hasBa: boolean,
|
||||||
} {
|
} {
|
||||||
const f = getTenseVerbForm(conj, vs.tense);
|
const f = getTenseVerbForm(conj, vs.tense, vs.tenseCategory);
|
||||||
const block = getMatrixBlock(f, objectPerson, person);
|
const block = getMatrixBlock(f, objectPerson, person);
|
||||||
const perfective = isPerfective(vs.tense);
|
const perfective = isPerfective(vs.tense);
|
||||||
const verbForm = getVerbFromBlock(block, person);
|
const verbForm = getVerbFromBlock(block, person);
|
||||||
|
@ -254,7 +254,8 @@ function getMatrixBlock<U>(f: {
|
||||||
return f[personToLabel(person)];
|
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") {
|
if (tense === "presentVerb") {
|
||||||
return conj.imperfective.nonImperative;
|
return conj.imperfective.nonImperative;
|
||||||
}
|
}
|
||||||
|
@ -279,27 +280,8 @@ function getTenseVerbForm(conj: T.VerbConjugation, tense: VerbTense | PerfectTen
|
||||||
if (tense === "habitualPerfectivePast") {
|
if (tense === "habitualPerfectivePast") {
|
||||||
return conj.perfective.habitualPast;
|
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") {
|
if (tense === "presentVerb") {
|
||||||
return conj.imperfective.modal.nonImperative;
|
return conj.imperfective.modal.nonImperative;
|
||||||
}
|
}
|
||||||
|
@ -324,6 +306,28 @@ function getTenseVerbForm(conj: T.VerbConjugation, tense: VerbTense | PerfectTen
|
||||||
if (tense === "habitualPerfectivePast") {
|
if (tense === "habitualPerfectivePast") {
|
||||||
return conj.perfective.modal.habitualPast;
|
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");
|
throw new Error("unknown tense");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue