testing going on past participles

This commit is contained in:
adueck 2023-04-11 18:21:32 +04:00
parent 76f9158e2a
commit 092c64f967
6 changed files with 1354 additions and 1156 deletions

View File

@ -19,7 +19,7 @@ import { isPastTense } from "../phrase-building/vp-tools";
import { makePsString, removeFVarients } from "../accent-and-ps-utils";
import { pashtoConsonants } from "../pashto-consonants";
import { getPastParticiple, getRootStem } from "./roots-and-stems";
import { verbEndingConcat } from "./rs-helpers";
import { getAspect, isKedul, perfectTenseToEquative, verbEndingConcat } from "./rs-helpers";
// For the chart display of the results: base the length thing on the VBE at the end, if there are other
// length variations earlier in the blocks, flatten those into the variations
@ -238,32 +238,3 @@ function ensure3rdPast(rs: T.PsString[], ending: T.PsString[], verb: T.VerbEntry
...ending,
] : ending).map(e => concatPsString(rs[0], e));
}
function getAspect(tense: T.VerbTense | T.AbilityTense): T.Aspect {
const t = tense.replace("Modal", "");
if (["presentVerb", "imperfectiveFuture", "imperfectivePast", "habitualImperfectivePast"].includes(t)) {
return "imperfective";
} else {
return "perfective";
}
}
function isKedul(v: T.VerbEntry): boolean {
return v.entry.p === "کېدل";
}
function perfectTenseToEquative(t: T.PerfectTense): keyof typeof equativeEndings {
return t === "presentPerfect"
? "present"
: t === "futurePerfect"
? "habitual"
: t === "habitualPerfect"
? "habitual"
: t === "pastPerfect"
? "past"
: t === "pastSubjunctivePerfect"
? "pastSubjunctive"
: t === "wouldBePerfect"
? "past"
: "subjunctive"
}

File diff suppressed because it is too large Load Diff

View File

@ -13,10 +13,11 @@ import * as T from "../../../types";
import { makePsString, removeFVarientsFromVerb } from "../accent-and-ps-utils";
import { accentOnNFromEnd, accentSyllable, removeAccents } from "../accent-helpers";
import { isKawulVerb, isTlulVerb } from "../type-predicates";
import { vEntry, addAbilityEnding, weld, removeL, addTrailingAccent, tlulPerfectiveStem, getLongVB } from "./rs-helpers";
import { vEntry, addAbilityEnding, weld, removeL, addTrailingAccent, tlulPerfectiveStem, getLongVB, possiblePPartLengths, isStatComp, statCompImperfectiveSpace, makeComplement } from "./rs-helpers";
import { inflectPattern3 } from "./new-inflectors";
const kedulStat = vEntry({"ts":1581086654898,"i":11100,"p":"کېدل","f":"kedul","g":"kedul","e":"to become _____","r":2,"c":"v. intrans.","ssp":"ش","ssf":"sh","prp":"شول","prf":"shwul","pprtp":"شوی","pprtf":"shúwey","noOo":true,"ec":"become"});
const kawulStat = vEntry({"ts":1579015359582,"i":11030,"p":"کول","f":"kawul","g":"kawul","e":"to make ____ ____ (as in \"He's making me angry.\")","r":4,"c":"v. trans.","ssp":"کړ","ssf":"kR","prp":"کړل","prf":"kRul","pprtp":"کړی","pprtf":"kúRey","noOo":true,"ec":"make,makes,making,made,made"});
const shwulVB: T.VBBasic = {
type: "VB",
@ -30,6 +31,57 @@ const shVB: T.VBBasic = {
ps: [{ p: "ش", f: "sh" }],
}
// TODO: figure out how to handle dynamic / stative verbs
export function getRootStem({ verb, rs, aspect, type, genderNumber, voice }: {
verb: T.VerbEntry,
rs: "root" | "stem",
aspect: T.Aspect,
voice: T.Voice,
type: "basic" | "ability",
genderNumber: {
gender: T.Gender,
number: T.NounNumber,
},
}): T.RootsStemsOutput {
const v = removeFVarientsFromVerb(verb);
if (type === "ability") {
return getAbilityRs(v, aspect, rs, voice, genderNumber);
}
if (voice === "passive") {
return getPassiveRs(v, aspect, rs, genderNumber);
}
return rs === "stem"
? aspect === "imperfective"
? getImperfectiveStem(v, genderNumber)
: getPerfectiveStem(v, genderNumber)
: aspect === "imperfective"
? getImperfectiveRoot(v, genderNumber)
: getPerfectiveRoot(v, genderNumber);
}
function getAbilityRs(
verb: T.VerbEntryNoFVars,
aspect: T.Aspect,
rs: "root" | "stem",
voice: T.Voice,
genderNum: T.GenderNumber,
): [[] | [T.VHead], [T.VB, T.VBA]] {
const losesAspect = isTlulVerb(verb) || (isStatComp(verb) && verb.entry.c?.includes("intrans."));
const [vhead, [basicroot]] = voice === "passive"
// passive ability loses aspect
? getPassiveRs(verb, "imperfective", "root", genderNum)
: aspect === "imperfective" || losesAspect
? getImperfectiveRoot(verb, genderNum)
: getPerfectiveRoot(verb, genderNum);
return [
vhead,
[
addAbilityEnding(basicroot),
rs === "root" ? shwulVB : shVB,
],
];
}
// TODO: kuRee shuwey etc
export function getPastParticiple(verb: T.VerbEntry, voice: T.Voice, { gender, number }: { gender: T.Gender, number: T.NounNumber }): T.VBGenNum | T.WeldedGN {
const v = removeFVarientsFromVerb(verb);
@ -45,7 +97,7 @@ export function getPastParticiple(verb: T.VerbEntry, voice: T.Voice, { gender, n
number,
};
}
const [_, [basicRoot]] = getImperfectiveRoot(removeFVarientsFromVerb(verb));
const basicRoot = getImperfectiveRoot(removeFVarientsFromVerb(verb), { gender, number })[1][0];
const longRoot = getLongVB(basicRoot);
const rootWLengths = possiblePPartLengths(longRoot);
@ -80,98 +132,19 @@ export function getPastParticiple(verb: T.VerbEntry, voice: T.Voice, { gender, n
}
}
function possiblePPartLengths(vba: T.VBNoLenghts<T.VBBasic>): T.VBBasic;
function possiblePPartLengths(vba: T.VBNoLenghts<T.VBA>): T.VBA;
function possiblePPartLengths(vba: T.VBNoLenghts<T.VBA>): T.VBA {
const shortenableEndings = ["ښتل", "ستل", "وتل"];
const wrul = ["وړل", "راوړل", "وروړل", "دروړل"];
if ("right" in vba) {
return {
...vba,
right: possiblePPartLengths(vba.right),
};
}
const infinitive = vba.ps[0];
const [trimP, trimF] = (infinitive.p.slice(-4) === "ښودل" && infinitive.p.length > 4 && infinitive.p !== "کېښودل" && infinitive.p !== "کښېښودل")
// special thing for اېښودل - پرېښودل
? [3, 4]
: (wrul.includes(infinitive.p) || (shortenableEndings.includes(infinitive.p.slice(-3)) && infinitive.p.slice(-4) !== "استل"))
? [1, 2]
: [0, 0];
if (trimP) {
return {
type: "VB",
ps: {
long: [infinitive],
short: [accentOnNFromEnd(trimOffPs(infinitive, trimP, trimF), 0)],
},
};
}
return vba;
}
export function getRootStem({ verb, rs, aspect, type, genderNumber, voice }: {
verb: T.VerbEntry,
rs: "root" | "stem",
aspect: T.Aspect,
voice: T.Voice,
type: "basic" | "ability",
genderNumber: {
gender: T.Gender,
number: T.NounNumber,
},
}): T.RootsStemsOutput {
const v = removeFVarientsFromVerb(verb);
if (type === "ability") {
return getAbilityRs(v, aspect, rs, voice);
}
if (voice === "passive") {
return getPassiveRs(v, aspect, rs);
}
return rs === "stem"
? aspect === "imperfective"
? getImperfectiveStem(v)
: getPerfectiveStem(v, genderNumber)
: aspect === "imperfective"
? getImperfectiveRoot(v)
: getPerfectiveRoot(v);
}
function getAbilityRs(
verb: T.VerbEntryNoFVars,
aspect: T.Aspect,
rs: "root" | "stem",
voice: T.Voice,
): [[] | [T.VHead], [T.VB, T.VBA]] {
const losesAspect = isTlulVerb(verb); // or is intransitive stative compound
const [vhead, [basicroot]] = voice === "passive"
// passive ability loses aspect
? getPassiveRs(verb, "imperfective", "root")
: aspect === "imperfective" || losesAspect
? getImperfectiveRoot(verb)
: getPerfectiveRoot(verb);
return [
vhead,
[
addAbilityEnding(basicroot),
rs === "root" ? shwulVB : shVB,
],
];
}
function getPassivePp(verb: T.VerbEntryNoFVars, genderNumber: T.GenderNumber): T.WeldedGN {
const [_, [basicRoot]] = getImperfectiveRoot(verb);
const basicRoot = getImperfectiveRoot(verb, genderNumber)[1][0];
const longRoot = getLongVB(basicRoot);
const kedulVb: T.VBGenNum = getPastParticiple(kedulStat, "active", genderNumber) as T.VBGenNum;
return weld(longRoot, kedulVb);
}
// TODO: could combine these two functions...
function getPassiveRs(verb: T.VerbEntryNoFVars, aspect: T.Aspect, rs: "root" | "stem"): [[] | [T.VHead], [T.VBA]] {
function getPassiveRs(verb: T.VerbEntryNoFVars, aspect: T.Aspect, rs: "root" | "stem", genderNumber: T.GenderNumber): [[] | [T.VHead], [T.VBA]] {
const [vHead, [basicRoot]] = (aspect === "imperfective"
? getImperfectiveRoot
: getPerfectiveRoot
)(verb);
)(verb, genderNumber);
const longRoot = getLongVB(basicRoot);
const kedulVba = getRootStem({ verb: kedulStat, aspect, rs, type: "basic", voice: "active", genderNumber: { gender: "masc", number: "singular" }})[1][0] as T.VBBasic;
return [
@ -180,7 +153,22 @@ function getPassiveRs(verb: T.VerbEntryNoFVars, aspect: T.Aspect, rs: "root" | "
];
}
function getImperfectiveRoot(verb: T.VerbEntryNoFVars): [[], [T.VBA]] {
function getImperfectiveRoot(verb: T.VerbEntryNoFVars, genderNum: T.GenderNumber): [[], [T.VBA]] {
if (verb.complement && isStatComp(verb) && statCompImperfectiveSpace(verb)) {
const auxStem = getImperfectiveRoot(verb.entry.c?.includes("intrans.")
? kedulStat
: kawulStat
, genderNum)[1][0];
return [
[],
[
weld(
makeComplement(verb.complement, genderNum),
auxStem as T.VBBasic,
),
],
];
}
const infinitive = accentOnNFromEnd(makePsString(verb.entry.p, verb.entry.f), 0);
return [
[],
@ -196,7 +184,17 @@ function getImperfectiveRoot(verb: T.VerbEntryNoFVars): [[], [T.VBA]] {
];
}
function getPerfectiveRoot(verb: T.VerbEntryNoFVars): [[T.VHead] | [], [T.VBA]] {
function getPerfectiveRoot(verb: T.VerbEntryNoFVars, genderNum: T.GenderNumber): [[T.VHead] | [], [T.VBA]] {
if (verb.complement && isStatComp(verb)) {
const auxStem = getPerfectiveRoot(verb.entry.c?.includes("intrans.")
? kedulStat
: kawulStat,
genderNum)[1][0];
return [
[makeComplement(verb.complement, genderNum)],
[auxStem as T.VBBasic],
];
}
const base = removeAccents(
(verb.entry.prp && verb.entry.prf)
? makePsString(verb.entry.prp, verb.entry.prf)
@ -220,7 +218,22 @@ function getPerfectiveRoot(verb: T.VerbEntryNoFVars): [[T.VHead] | [], [T.VBA]]
];
}
function getImperfectiveStem(verb: T.VerbEntryNoFVars): T.RootsStemsOutput {
function getImperfectiveStem(verb: T.VerbEntryNoFVars, genderNum: T.GenderNumber): [[], [T.VB]] {
if (verb.complement && isStatComp(verb) && statCompImperfectiveSpace(verb)) {
const auxStem = getImperfectiveStem(verb.entry.c?.includes("intrans.")
? kedulStat
: kawulStat,
genderNum)[1][0];
return [
[],
[
weld(
makeComplement(verb.complement, genderNum),
auxStem as T.VBBasic,
),
],
];
}
if (verb.entry.psp && verb.entry.psf) {
return [
[],
@ -262,9 +275,19 @@ function getImperfectiveStem(verb: T.VerbEntryNoFVars): T.RootsStemsOutput {
];
}
function getPerfectiveStem(verb: T.VerbEntryNoFVars, person: { gender: T.Gender, number: T.NounNumber }): T.RootsStemsOutput {
function getPerfectiveStem(verb: T.VerbEntryNoFVars, genderNum: { gender: T.Gender, number: T.NounNumber }): [[T.VHead] | [], [T.VB]] {
if (verb.complement && isStatComp(verb)) {
const auxStem = getPerfectiveStem(verb.entry.c?.includes("intrans.")
? kedulStat
: kawulStat,
genderNum)[1][0];
return [
[makeComplement(verb.complement, genderNum)],
[auxStem as T.VBBasic],
];
}
if (verb.entry.f === "tlul") {
return tlulPerfectiveStem(person);
return tlulPerfectiveStem(genderNum);
}
const base = (verb.entry.ssp && verb.entry.ssf)
// with irregular perfective stem

View File

@ -1,10 +1,51 @@
import * as T from "../../../types";
import { removeFVarients } from "../accent-and-ps-utils";
import { accentPsSyllable, removeAccents, removeAccentsWLength } from "../accent-helpers";
import { concatPsString, trimOffPs } from "../p-text-helpers";
import { accentOnNFromEnd, accentPsSyllable, countSyllables, removeAccents, removeAccentsWLength } from "../accent-helpers";
import { concatPsString, isUnisexSet, psStringFromEntry, trimOffPs } from "../p-text-helpers";
import { getRootStem } from "./roots-and-stems";
import { inflectPattern1 } from "./new-inflectors";
import { getLength } from "../p-text-helpers";
import { equativeEndings } from "../grammar-units";
import { isAdjectiveEntry } from "../type-predicates";
import { inflectWord } from "../pashto-inflector";
export function isStatComp(v: T.VerbEntry): boolean {
return !!v.entry.c?.includes("stat. comp.") && !!v.complement;
}
export function statCompImperfectiveSpace(v: T.VerbEntryNoFVars): boolean {
return v.entry.p.startsWith(`${v.complement?.p} `);
}
export function makeComplement(e: T.DictionaryEntryNoFVars, { gender, number }: T.GenderNumber): T.NComp {
if (isAdjectiveEntry(e)) {
const infs = inflectWord(e);
const ps = infs && infs.inflections && isUnisexSet(infs.inflections)
? infs.inflections[gender][number === "singular" ? 0 : 1][0]
: psStringFromEntry(e);
return {
type: "NComp",
comp: {
type: "AdjComp",
ps: lightEnforceCompAccent(ps),
gender,
number,
},
};
}
return {
type: "NComp",
comp: {
type: "Comp",
ps: lightEnforceCompAccent(psStringFromEntry(e)),
},
};
function lightEnforceCompAccent(ps: T.PsString): T.PsString {
return countSyllables(ps) === 1
? accentPsSyllable(ps)
: ps;
}
}
export function vEntry(e: any, c?: any): T.VerbEntryNoFVars {
return {
@ -114,7 +155,7 @@ export function removeL(ps: T.PsString): T.PsString {
return trimOffPs(ps, 1, 2);
}
export function tlulPerfectiveStem(person: { gender: T.Gender, number: T.NounNumber }): T.RootsStemsOutput {
export function tlulPerfectiveStem(person: { gender: T.Gender, number: T.NounNumber }): [[T.PH], [T.VB]] {
return [
[
{
@ -161,6 +202,37 @@ export function addToVBBasicEnd(vb: T.VBBasic, end: T.PsString[]): T.VBBasic {
};
}
export function possiblePPartLengths(vba: T.VBNoLenghts<T.VBBasic>): T.VBBasic;
export function possiblePPartLengths(vba: T.VBNoLenghts<T.VBA>): T.VBA;
export function possiblePPartLengths(vba: T.VBNoLenghts<T.VBA>): T.VBA {
const shortenableEndings = ["ښتل", "ستل", "وتل"];
const wrul = ["وړل", "راوړل", "وروړل", "دروړل"];
if ("right" in vba) {
return {
...vba,
right: possiblePPartLengths(vba.right),
};
}
const infinitive = vba.ps[0];
const [trimP, trimF] = (infinitive.p.slice(-4) === "ښودل" && infinitive.p.length > 4 && infinitive.p !== "کېښودل" && infinitive.p !== "کښېښودل")
// special thing for اېښودل - پرېښودل
? [3, 4]
: (wrul.includes(infinitive.p) || (shortenableEndings.includes(infinitive.p.slice(-3)) && infinitive.p.slice(-4) !== "استل"))
? [1, 2]
: [0, 0];
if (trimP) {
return {
type: "VB",
ps: {
long: [infinitive],
short: [accentOnNFromEnd(trimOffPs(infinitive, trimP, trimF), 0)],
},
};
}
return vba;
}
export function getLongVB(vb: T.VBBasic): T.VBNoLenghts<T.VBBasic>;
export function getLongVB(vb: T.VBA): T.VBNoLenghts<T.VBA>;
export function getLongVB(vb: T.VBA): T.VBNoLenghts<T.VBA> {
@ -174,4 +246,33 @@ export function getLongVB(vb: T.VBA): T.VBNoLenghts<T.VBA> {
...vb,
ps: getLength(vb.ps, "long"),
};
}
export function getAspect(tense: T.VerbTense | T.AbilityTense): T.Aspect {
const t = tense.replace("Modal", "");
if (["presentVerb", "imperfectiveFuture", "imperfectivePast", "habitualImperfectivePast"].includes(t)) {
return "imperfective";
} else {
return "perfective";
}
}
export function isKedul(v: T.VerbEntry): boolean {
return v.entry.p === "کېدل";
}
export function perfectTenseToEquative(t: T.PerfectTense): keyof typeof equativeEndings {
return t === "presentPerfect"
? "present"
: t === "futurePerfect"
? "habitual"
: t === "habitualPerfect"
? "habitual"
: t === "pastPerfect"
? "past"
: t === "pastSubjunctivePerfect"
? "pastSubjunctive"
: t === "wouldBePerfect"
? "past"
: "subjunctive"
}

View File

@ -1136,9 +1136,6 @@ export type Comp = {
gender: Gender,
number: NounNumber,
} | {
type: "LocAdvComp",
ps: PsString,
} | {
type: "NounComp",
type: "Comp",
ps: PsString,
};