got perfect working! (I think)
This commit is contained in:
parent
a74d3a3f35
commit
f8964c6799
|
@ -9,14 +9,15 @@ import {
|
||||||
ButtonSelect,
|
ButtonSelect,
|
||||||
getVerbInfo,
|
getVerbInfo,
|
||||||
} from "@lingdocs/pashto-inflector";
|
} from "@lingdocs/pashto-inflector";
|
||||||
|
import { isEquativeTense } from "../lib/phrase-building/vp-tools";
|
||||||
// import { useState } from "react";
|
// import { useState } from "react";
|
||||||
|
|
||||||
const tenseOptions: { label: string | JSX.Element, value: VerbTense }[] = [{
|
const tenseOptions: { label: string | JSX.Element, value: VerbTense }[] = [{
|
||||||
label: <div><i className="fas fa-video mr-2" />present</div>,
|
label: <div><i className="fas fa-video mr-2" />present</div>,
|
||||||
value: "present",
|
value: "presentVerb",
|
||||||
}, {
|
}, {
|
||||||
label: <div><i className="fas fa-camera mr-2" />subjunctive</div>,
|
label: <div><i className="fas fa-camera mr-2" />subjunctive</div>,
|
||||||
value: "subjunctive",
|
value: "subjunctiveVerb",
|
||||||
}, {
|
}, {
|
||||||
label: <div><i className="fas fa-video mr-2" />imperf. future</div>,
|
label: <div><i className="fas fa-video mr-2" />imperf. future</div>,
|
||||||
value: "imperfectiveFuture",
|
value: "imperfectiveFuture",
|
||||||
|
@ -37,6 +38,29 @@ const tenseOptions: { label: string | JSX.Element, value: VerbTense }[] = [{
|
||||||
value: "habitualPerfectivePast",
|
value: "habitualPerfectivePast",
|
||||||
}];
|
}];
|
||||||
|
|
||||||
|
const equativeTenseOptions: { label: string | JSX.Element, value: EquativeTense }[] = [{
|
||||||
|
label: "Present Perfect",
|
||||||
|
value: "present",
|
||||||
|
}, {
|
||||||
|
label: "Habitual Perfect",
|
||||||
|
value: "habitual",
|
||||||
|
}, {
|
||||||
|
label: "Subjunctive Perfect",
|
||||||
|
value: "subjunctive",
|
||||||
|
}, {
|
||||||
|
label: "Future Perfect",
|
||||||
|
value: "future",
|
||||||
|
}, {
|
||||||
|
label: "Past Perfect",
|
||||||
|
value: "past",
|
||||||
|
}, {
|
||||||
|
label: "Would Be Perfect",
|
||||||
|
value: "wouldBe",
|
||||||
|
}, {
|
||||||
|
label: "Past Subjunctive Perfect",
|
||||||
|
value: "pastSubjunctive",
|
||||||
|
}];
|
||||||
|
|
||||||
// type Filters = {
|
// type Filters = {
|
||||||
// stative: boolean,
|
// stative: boolean,
|
||||||
// dynamic: boolean,
|
// dynamic: boolean,
|
||||||
|
@ -62,12 +86,21 @@ function VerbPicker({ onChange, verb, verbs }: { verbs: VerbEntry[], verb: VerbS
|
||||||
}
|
}
|
||||||
onChange(makeVerbSelection(v, verb));
|
onChange(makeVerbSelection(v, verb));
|
||||||
}
|
}
|
||||||
function onTenseSelect({ value }: { label: string, value: VerbTense }) {
|
function onTenseSelect({ value }: { label: string, value: VerbTense | EquativeTense }) {
|
||||||
if (verb) {
|
if (verb) {
|
||||||
|
if (isEquativeTense(value)) {
|
||||||
onChange({
|
onChange({
|
||||||
...verb,
|
...verb,
|
||||||
tense: value,
|
tense: value,
|
||||||
|
tenseCategory: "perfect",
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
onChange({
|
||||||
|
...verb,
|
||||||
|
tense: value,
|
||||||
|
tenseCategory: verb.tenseCategory === "perfect" ? "basic" : verb.tenseCategory,
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function onPosNegSelect(value: string) {
|
function onPosNegSelect(value: string) {
|
||||||
|
@ -78,12 +111,21 @@ function VerbPicker({ onChange, verb, verbs }: { verbs: VerbEntry[], verb: VerbS
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function onTenseCategorySelect(value: "basic" | "modal") {
|
function onTenseCategorySelect(value: "basic" | "modal" | "perfect") {
|
||||||
if (verb) {
|
if (verb) {
|
||||||
|
if (value === "perfect") {
|
||||||
onChange({
|
onChange({
|
||||||
...verb,
|
...verb,
|
||||||
tenseCategory: value,
|
tenseCategory: value,
|
||||||
|
tense: isEquativeTense(verb.tense) ? verb.tense : "present",
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
onChange({
|
||||||
|
...verb,
|
||||||
|
tenseCategory: value,
|
||||||
|
tense: isEquativeTense(verb.tense) ? "presentVerb" : verb.tense,
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function notInstransitive(t: "transitive" | "intransitive" | "grammatically transitive"): "transitive" | "grammatically transitive" {
|
function notInstransitive(t: "transitive" | "intransitive" | "grammatically transitive"): "transitive" | "grammatically transitive" {
|
||||||
|
@ -123,6 +165,9 @@ function VerbPicker({ onChange, verb, verbs }: { verbs: VerbEntry[], verb: VerbS
|
||||||
}, {
|
}, {
|
||||||
label: "Modal",
|
label: "Modal",
|
||||||
value: "modal",
|
value: "modal",
|
||||||
|
}, {
|
||||||
|
label: "Perfect",
|
||||||
|
value: "perfect",
|
||||||
}]}
|
}]}
|
||||||
handleChange={onTenseCategorySelect}
|
handleChange={onTenseCategorySelect}
|
||||||
/>
|
/>
|
||||||
|
@ -135,8 +180,13 @@ function VerbPicker({ onChange, verb, verbs }: { verbs: VerbEntry[], verb: VerbS
|
||||||
onChange={onTenseSelect}
|
onChange={onTenseSelect}
|
||||||
className="mb-2"
|
className="mb-2"
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
options={tenseOptions}
|
options={verb?.tenseCategory === "perfect" ? equativeTenseOptions : tenseOptions}
|
||||||
placeholder={verb ? tenseOptions.find(o => o.value === verb.tense)?.label : "Select Tense..."}
|
placeholder={verb ? (() => {
|
||||||
|
const label = (verb.tenseCategory === "perfect")
|
||||||
|
? equativeTenseOptions.find(o => o.value === verb.tense)?.label
|
||||||
|
: tenseOptions.find(o => o.value === verb.tense)?.label;
|
||||||
|
return label || "Select Tense...";
|
||||||
|
})() : undefined}
|
||||||
{...zIndexProps}
|
{...zIndexProps}
|
||||||
/>
|
/>
|
||||||
{verb && <div className="text-center my-3">
|
{verb && <div className="text-center my-3">
|
||||||
|
@ -223,11 +273,17 @@ function makeVerbSelection(verb: VerbEntry, oldVerbSelection?: VerbSelection): V
|
||||||
type: "verb",
|
type: "verb",
|
||||||
verb: verb,
|
verb: verb,
|
||||||
dynAuxVerb,
|
dynAuxVerb,
|
||||||
tense: oldVerbSelection ? oldVerbSelection.tense : "present",
|
...oldVerbSelection ? {
|
||||||
|
// TODO: carry it over from the old selection!!
|
||||||
|
tense: "presentVerb",
|
||||||
|
tenseCategory: "basic",
|
||||||
|
} : {
|
||||||
|
tense: "presentVerb",
|
||||||
|
tenseCategory: "basic",
|
||||||
|
},
|
||||||
object,
|
object,
|
||||||
transitivity,
|
transitivity,
|
||||||
isCompound,
|
isCompound,
|
||||||
tenseCategory: oldVerbSelection ? oldVerbSelection.tenseCategory : "basic",
|
|
||||||
negative: oldVerbSelection ? oldVerbSelection.negative : false,
|
negative: oldVerbSelection ? oldVerbSelection.negative : false,
|
||||||
...("grammaticallyTransitive" in info) ? {
|
...("grammaticallyTransitive" in info) ? {
|
||||||
changeTransitivity: function (t) {
|
changeTransitivity: function (t) {
|
||||||
|
|
|
@ -20,7 +20,7 @@ export function compileVP(VP: VPRendered, form: Form, combineLengths?: true): {
|
||||||
NPs,
|
NPs,
|
||||||
kids,
|
kids,
|
||||||
verb,
|
verb,
|
||||||
hasLeapfrog: VP.verb.tenseCategory === "modal",
|
hasLeapfrog: VP.verb.tenseCategory !== "basic",
|
||||||
negative: VP.verb.negative,
|
negative: VP.verb.negative,
|
||||||
isCompound: VP.isCompound,
|
isCompound: VP.isCompound,
|
||||||
});
|
});
|
||||||
|
|
|
@ -5,6 +5,16 @@ import {
|
||||||
parseEc,
|
parseEc,
|
||||||
} from "@lingdocs/pashto-inflector";
|
} from "@lingdocs/pashto-inflector";
|
||||||
|
|
||||||
|
function engHave(s: T.Person): string {
|
||||||
|
function isThirdPersonSing(p: T.Person): boolean {
|
||||||
|
return (
|
||||||
|
p === T.Person.ThirdSingMale ||
|
||||||
|
p === T.Person.ThirdSingFemale
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return isThirdPersonSing(s) ? "has" : "have";
|
||||||
|
}
|
||||||
|
|
||||||
export function renderEnglishVPBase({ subjectPerson, object, vs }: {
|
export function renderEnglishVPBase({ subjectPerson, object, vs }: {
|
||||||
subjectPerson: T.Person,
|
subjectPerson: T.Person,
|
||||||
object: NPSelection | ObjectNP,
|
object: NPSelection | ObjectNP,
|
||||||
|
@ -12,7 +22,6 @@ export function renderEnglishVPBase({ subjectPerson, object, vs }: {
|
||||||
}): string[] {
|
}): string[] {
|
||||||
const ec = parseEc(vs.verb.entry.ec || "");
|
const ec = parseEc(vs.verb.entry.ec || "");
|
||||||
const ep = vs.verb.entry.ep;
|
const ep = vs.verb.entry.ep;
|
||||||
const tense = vs.tense;
|
|
||||||
function engEquative(tense: "past" | "present", s: T.Person): string {
|
function engEquative(tense: "past" | "present", s: T.Person): string {
|
||||||
const [row, col] = getVerbBlockPosFromPerson(s);
|
const [row, col] = getVerbBlockPosFromPerson(s);
|
||||||
return grammarUnits.englishEquative[tense][row][col];
|
return grammarUnits.englishEquative[tense][row][col];
|
||||||
|
@ -33,17 +42,17 @@ export function renderEnglishVPBase({ subjectPerson, object, vs }: {
|
||||||
`$SUBJ will${n ? " not" : ""} ${isToBe(ec) ? "be" : ec[0]}`,
|
`$SUBJ will${n ? " not" : ""} ${isToBe(ec) ? "be" : ec[0]}`,
|
||||||
]);
|
]);
|
||||||
// TODO: Pull these out to a seperate entity and import it
|
// TODO: Pull these out to a seperate entity and import it
|
||||||
const builders: Record<
|
const basicBuilders: Record<
|
||||||
VerbTense,
|
VerbTense,
|
||||||
(s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => string[]
|
(s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => string[]
|
||||||
> = {
|
> = {
|
||||||
present: (s: T.Person, ec: T.EnglishVerbConjugationEc, n: boolean) => ([
|
presentVerb: (s: T.Person, ec: T.EnglishVerbConjugationEc, n: boolean) => ([
|
||||||
`$SUBJ ${isToBe(ec)
|
`$SUBJ ${isToBe(ec)
|
||||||
? `${engEquative("present", s)}${n ? " not" : ""}`
|
? `${engEquative("present", s)}${n ? " not" : ""}`
|
||||||
: `${n ? engPresC(s, ["don't", "doesn't"]) : ""} ${n ? ec[0] : engPresC(s, ec)}`}`,
|
: `${n ? engPresC(s, ["don't", "doesn't"]) : ""} ${n ? ec[0] : engPresC(s, ec)}`}`,
|
||||||
`$SUBJ ${engEquative("present", s)}${n ? " not" : ""} ${ec[2]}`,
|
`$SUBJ ${engEquative("present", s)}${n ? " not" : ""} ${ec[2]}`,
|
||||||
]),
|
]),
|
||||||
subjunctive: (s: T.Person, ec: T.EnglishVerbConjugationEc, n: boolean) => ([
|
subjunctiveVerb: (s: T.Person, ec: T.EnglishVerbConjugationEc, n: boolean) => ([
|
||||||
`that $SUBJ ${n ? " won't" : " will"} ${isToBe(ec) ? "be" : ec[0]}`,
|
`that $SUBJ ${n ? " won't" : " will"} ${isToBe(ec) ? "be" : ec[0]}`,
|
||||||
`should $SUBJ ${n ? " not" : ""} ${isToBe(ec) ? "be" : ec[0]}`,
|
`should $SUBJ ${n ? " not" : ""} ${isToBe(ec) ? "be" : ec[0]}`,
|
||||||
]),
|
]),
|
||||||
|
@ -76,10 +85,10 @@ export function renderEnglishVPBase({ subjectPerson, object, vs }: {
|
||||||
VerbTense,
|
VerbTense,
|
||||||
(s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => string[]
|
(s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => string[]
|
||||||
> = {
|
> = {
|
||||||
present: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
|
presentVerb: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
|
||||||
`$SUBJ can${n ? "'t" : ""} ${isToBe(v) ? "be" : v[0]}`,
|
`$SUBJ can${n ? "'t" : ""} ${isToBe(v) ? "be" : v[0]}`,
|
||||||
]),
|
]),
|
||||||
subjunctive: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
|
subjunctiveVerb: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
|
||||||
`that $SUBJ can${n ? "'t" : ""} ${isToBe(v) ? "be" : v[0]}`,
|
`that $SUBJ can${n ? "'t" : ""} ${isToBe(v) ? "be" : v[0]}`,
|
||||||
]),
|
]),
|
||||||
imperfectiveFuture: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
|
imperfectiveFuture: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
|
||||||
|
@ -105,6 +114,38 @@ export function renderEnglishVPBase({ subjectPerson, object, vs }: {
|
||||||
`$SUBJ would ${n ? " not" : ""} be able to ${isToBe(v) ? "be" : v[0]}`,
|
`$SUBJ would ${n ? " not" : ""} be able to ${isToBe(v) ? "be" : v[0]}`,
|
||||||
]),
|
]),
|
||||||
};
|
};
|
||||||
const base = (vs.tenseCategory === "basic" ? builders : modalBuilders)[tense](subjectPerson, ec, vs.negative);
|
const perfectBuilders: Record<
|
||||||
|
EquativeTense,
|
||||||
|
(s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => string[]
|
||||||
|
> = {
|
||||||
|
present: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
|
||||||
|
`$SUBJ ${engHave(s)}${n ? " not" : ""} ${v[4]}`,
|
||||||
|
]),
|
||||||
|
past: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
|
||||||
|
`$SUBJ had${n ? " not" : ""} ${v[4]}`,
|
||||||
|
]),
|
||||||
|
habitual: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
|
||||||
|
`$SUBJ ${engHave(s)}${n ? " not" : ""} ${v[4]}`,
|
||||||
|
]),
|
||||||
|
subjunctive: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
|
||||||
|
`that $SUBJ will have${n ? " not" : ""} ${v[4]}`,
|
||||||
|
]),
|
||||||
|
future: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
|
||||||
|
`$SUBJ will${n ? " not" : ""} have ${v[4]}`,
|
||||||
|
]),
|
||||||
|
wouldBe: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
|
||||||
|
`$SUBJ would${n ? " not" : ""} have ${v[4]}`,
|
||||||
|
]),
|
||||||
|
pastSubjunctive: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
|
||||||
|
`$SUBJ would${n ? " not" : ""} have ${v[4]}`,
|
||||||
|
`$SUBJ should${n ? " not" : ""} have ${v[4]}`,
|
||||||
|
]),
|
||||||
|
}
|
||||||
|
const base = (
|
||||||
|
(vs.tenseCategory === "perfect")
|
||||||
|
? perfectBuilders[vs.tense]
|
||||||
|
: vs.tenseCategory === "basic"
|
||||||
|
? basicBuilders[vs.tense]
|
||||||
|
: modalBuilders[vs.tense])(subjectPerson, ec, vs.negative);
|
||||||
return base.map(b => `${b}${typeof object === "object" ? " $OBJ" : ""}${ep ? ` ${ep}` : ""}`);
|
return base.map(b => `${b}${typeof object === "object" ? " $OBJ" : ""}${ep ? ` ${ep}` : ""}`);
|
||||||
}
|
}
|
|
@ -19,6 +19,7 @@ import {
|
||||||
getPersonFromNP,
|
getPersonFromNP,
|
||||||
removeBa,
|
removeBa,
|
||||||
isPastTense,
|
isPastTense,
|
||||||
|
isEquativeTense,
|
||||||
} from "./vp-tools";
|
} from "./vp-tools";
|
||||||
import { isPattern4Entry } from "../type-predicates";
|
import { isPattern4Entry } from "../type-predicates";
|
||||||
import { renderEnglishVPBase } from "./english-vp-rendering";
|
import { renderEnglishVPBase } from "./english-vp-rendering";
|
||||||
|
@ -140,24 +141,24 @@ function renderVerbSelection(vs: VerbSelection, person: T.Person, objectPerson:
|
||||||
return {
|
return {
|
||||||
...vs,
|
...vs,
|
||||||
person,
|
person,
|
||||||
...getPsVerbConjugation(conj, vs.tense, vs.tenseCategory, person, objectPerson),
|
...getPsVerbConjugation(conj, vs, person, objectPerson),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPsVerbConjugation(conj: T.VerbConjugation, tense: VerbTense, tenseCategory: "basic" | "modal", person: T.Person, objectPerson: T.Person | undefined): {
|
function getPsVerbConjugation(conj: T.VerbConjugation, vs: VerbSelection, person: T.Person, objectPerson: T.Person | undefined): {
|
||||||
ps: {
|
ps: {
|
||||||
head: T.PsString | undefined,
|
head: T.PsString | undefined,
|
||||||
rest: T.SingleOrLengthOpts<T.PsString[]>,
|
rest: T.SingleOrLengthOpts<T.PsString[]>,
|
||||||
},
|
},
|
||||||
hasBa: boolean,
|
hasBa: boolean,
|
||||||
} {
|
} {
|
||||||
const f = getTenseVerbForm(conj, tense, tenseCategory);
|
const f = getTenseVerbForm(conj, vs.tense, vs.tenseCategory);
|
||||||
const block = getMatrixBlock(f, objectPerson, person);
|
const block = getMatrixBlock(f, objectPerson, person);
|
||||||
const perfective = isPerfective(tense);
|
const perfective = isPerfective(vs.tense);
|
||||||
const verbForm = getVerbFromBlock(block, person);
|
const verbForm = getVerbFromBlock(block, person);
|
||||||
const hasBa = hasBaParticle(getLong(verbForm)[0]);
|
const hasBa = hasBaParticle(getLong(verbForm)[0]);
|
||||||
if (perfective) {
|
if (perfective) {
|
||||||
const past = isPastTense(tense);
|
const past = isPastTense(vs.tense);
|
||||||
const splitInfo = conj.info[past ? "root" : "stem"].perfectiveSplit;
|
const splitInfo = conj.info[past ? "root" : "stem"].perfectiveSplit;
|
||||||
if (!splitInfo) return { ps: { head: undefined, rest: verbForm }, hasBa };
|
if (!splitInfo) return { ps: { head: undefined, rest: verbForm }, hasBa };
|
||||||
// TODO: Either solve this in the inflector or here, it seems silly (or redundant)
|
// TODO: Either solve this in the inflector or here, it seems silly (or redundant)
|
||||||
|
@ -253,12 +254,12 @@ function getMatrixBlock<U>(f: {
|
||||||
return f[personToLabel(person)];
|
return f[personToLabel(person)];
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTenseVerbForm(conj: T.VerbConjugation, tense: VerbTense, tenseCategory: "basic" | "modal"): T.VerbForm {
|
function getTenseVerbForm(conj: T.VerbConjugation, tense: VerbTense | EquativeTense, tenseCategory: "basic" | "modal" | "perfect"): T.VerbForm {
|
||||||
if (tenseCategory === "basic") {
|
if (tenseCategory === "basic") {
|
||||||
if (tense === "present") {
|
if (tense === "presentVerb") {
|
||||||
return conj.imperfective.nonImperative;
|
return conj.imperfective.nonImperative;
|
||||||
}
|
}
|
||||||
if (tense === "subjunctive") {
|
if (tense === "subjunctiveVerb") {
|
||||||
return conj.perfective.nonImperative;
|
return conj.perfective.nonImperative;
|
||||||
}
|
}
|
||||||
if (tense === "imperfectiveFuture") {
|
if (tense === "imperfectiveFuture") {
|
||||||
|
@ -280,11 +281,34 @@ function getTenseVerbForm(conj: T.VerbConjugation, tense: VerbTense, tenseCatego
|
||||||
return conj.perfective.habitualPast;
|
return conj.perfective.habitualPast;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (tenseCategory === "modal") {
|
if (tenseCategory === "perfect") {
|
||||||
if (tense === "present") {
|
if (tense === "present") {
|
||||||
return conj.imperfective.modal.nonImperative;
|
return conj.perfect.present;
|
||||||
|
}
|
||||||
|
if (tense === "past") {
|
||||||
|
return conj.perfect.past;
|
||||||
|
}
|
||||||
|
if (tense === "future") {
|
||||||
|
return conj.perfect.future;
|
||||||
|
}
|
||||||
|
if (tense === "habitual") {
|
||||||
|
return conj.perfect.habitual;
|
||||||
}
|
}
|
||||||
if (tense === "subjunctive") {
|
if (tense === "subjunctive") {
|
||||||
|
return conj.perfect.subjunctive;
|
||||||
|
}
|
||||||
|
if (tense === "wouldBe") {
|
||||||
|
return conj.perfect.affirmational;
|
||||||
|
}
|
||||||
|
if (tense === "pastSubjunctive") {
|
||||||
|
return conj.perfect.pastSubjunctiveHypothetical;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (tenseCategory === "modal") {
|
||||||
|
if (tense === "presentVerb") {
|
||||||
|
return conj.imperfective.modal.nonImperative;
|
||||||
|
}
|
||||||
|
if (tense === "subjunctiveVerb") {
|
||||||
return conj.perfective.modal.nonImperative;
|
return conj.perfective.modal.nonImperative;
|
||||||
}
|
}
|
||||||
if (tense === "imperfectiveFuture") {
|
if (tense === "imperfectiveFuture") {
|
||||||
|
@ -376,11 +400,12 @@ function isFirstOrSecondPersPronoun(o: "none" | NPSelection | T.Person.ThirdPlur
|
||||||
return [0,1,2,3,6,7,8,9].includes(o.person);
|
return [0,1,2,3,6,7,8,9].includes(o.person);
|
||||||
}
|
}
|
||||||
|
|
||||||
function isPerfective(t: VerbTense): boolean {
|
function isPerfective(t: VerbTense | EquativeTense): boolean {
|
||||||
if (t === "present" || t === "imperfectiveFuture" || t === "imperfectivePast" || t === "habitualImperfectivePast") {
|
if (isEquativeTense(t)) return false;
|
||||||
|
if (t === "presentVerb" || t === "imperfectiveFuture" || t === "imperfectivePast" || t === "habitualImperfectivePast") {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (t === "perfectiveFuture" || t === "subjunctive" || t === "perfectivePast" || t === "habitualPerfectivePast") {
|
if (t === "perfectiveFuture" || t === "subjunctiveVerb" || t === "perfectivePast" || t === "habitualPerfectivePast") {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
throw new Error("tense not implemented yet");
|
throw new Error("tense not implemented yet");
|
||||||
|
|
|
@ -27,6 +27,14 @@ export function removeBa(ps: T.PsString): T.PsString {
|
||||||
return psRemove(ps, concatPsString(grammarUnits.baParticle, " "));
|
return psRemove(ps, concatPsString(grammarUnits.baParticle, " "));
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isPastTense(tense: VerbTense): boolean {
|
export function isEquativeTense(t: VerbTense | EquativeTense): t is EquativeTense {
|
||||||
|
return (t === "present" || t === "future" || t === "habitual" || t === "past" || t === "wouldBe" || t === "subjunctive" || t === "pastSubjunctive");
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isPastTense(tense: VerbTense | EquativeTense): boolean {
|
||||||
|
if (isEquativeTense(tense)) {
|
||||||
|
// equative tenses are used HERE for the perfect forms, which are all considered past tense
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return tense.toLowerCase().includes("past");
|
return tense.toLowerCase().includes("past");
|
||||||
}
|
}
|
|
@ -26,8 +26,8 @@ type VPRendered = {
|
||||||
englishBase?: string[],
|
englishBase?: string[],
|
||||||
}
|
}
|
||||||
|
|
||||||
type VerbTense = "present"
|
type VerbTense = "presentVerb"
|
||||||
| "subjunctive"
|
| "subjunctiveVerb"
|
||||||
| "perfectiveFuture"
|
| "perfectiveFuture"
|
||||||
| "imperfectiveFuture"
|
| "imperfectiveFuture"
|
||||||
| "perfectivePast"
|
| "perfectivePast"
|
||||||
|
@ -39,8 +39,6 @@ type VerbSelection = {
|
||||||
type: "verb",
|
type: "verb",
|
||||||
verb: VerbEntry,
|
verb: VerbEntry,
|
||||||
dynAuxVerb?: VerbEntry,
|
dynAuxVerb?: VerbEntry,
|
||||||
tense: VerbTense,
|
|
||||||
tenseCategory: "basic" | "modal",
|
|
||||||
object: VerbObject, // TODO: should have a locked in (but number changeable noun) here for dynamic compounds
|
object: VerbObject, // TODO: should have a locked in (but number changeable noun) here for dynamic compounds
|
||||||
transitivity: import("@lingdocs/pashto-inflector").Types.Transitivity,
|
transitivity: import("@lingdocs/pashto-inflector").Types.Transitivity,
|
||||||
isCompound: "stative" | "dynamic" | false,
|
isCompound: "stative" | "dynamic" | false,
|
||||||
|
@ -49,7 +47,13 @@ type VerbSelection = {
|
||||||
// TODO: changeStativeDynamic
|
// TODO: changeStativeDynamic
|
||||||
// TODO: add in aspect element here??
|
// TODO: add in aspect element here??
|
||||||
negative: boolean,
|
negative: boolean,
|
||||||
};
|
} & ({
|
||||||
|
tense: VerbTense,
|
||||||
|
tenseCategory: "basic" | "modal",
|
||||||
|
} | {
|
||||||
|
tense: EquativeTense,
|
||||||
|
tenseCategory: "perfect"
|
||||||
|
});
|
||||||
|
|
||||||
type VerbRendered = Omit<VerbSelection, "object"> & {
|
type VerbRendered = Omit<VerbSelection, "object"> & {
|
||||||
ps: {
|
ps: {
|
||||||
|
|
Loading…
Reference in New Issue