litte more refactoring

This commit is contained in:
adueck 2023-06-28 00:24:16 +04:00
parent 226da64608
commit 68d83d95d4
5 changed files with 134 additions and 64 deletions

View File

@ -189,6 +189,16 @@ export function getEnglishGenNumInfo(gender: T.Gender, number: T.NounNumber): st
return `${gender === "masc" ? "masc" : "fem"} ${number === "plural" ? "plur." : "sing."}`; return `${gender === "masc" ? "masc" : "fem"} ${number === "plural" ? "plur." : "sing."}`;
} }
export function personToGenNum(p: T.Person): {
gender: T.Gender,
number: T.NounNumber,
} {
return {
gender: personGender(p),
number: personNumber(p),
};
}
export function getEnglishParticipleInflection(person: T.Person, version?: "short" | "long"): string { export function getEnglishParticipleInflection(person: T.Person, version?: "short" | "long"): string {
const number = personIsPlural(person) ? "plural" : "singular"; const number = personIsPlural(person) ? "plural" : "singular";
const n = version === "short" const n = version === "short"

View File

@ -2,6 +2,7 @@ import { renderVerb } from "./render-verb";
import { vEntry } from "./rs-helpers"; import { vEntry } from "./rs-helpers";
import * as T from "../../../types"; import * as T from "../../../types";
import { negate } from "rambda"; import { negate } from "rambda";
import { personToGenNum } from "../misc-helpers";
const wahul = vEntry({"ts":1527815399,"i":15049,"p":"وهل","f":"wahul","g":"wahul","e":"to hit","r":4,"c":"v. trans.","tppp":"واهه","tppf":"waahu","ec":"hit,hits,hitting,hit,hit"}); const wahul = vEntry({"ts":1527815399,"i":15049,"p":"وهل","f":"wahul","g":"wahul","e":"to hit","r":4,"c":"v. trans.","tppp":"واهه","tppf":"waahu","ec":"hit,hits,hitting,hit,hit"});
const raawrul = vEntry({"ts":1527815214,"i":6954,"p":"راوړل","f":"raawRúl","g":"raawRul","e":"to bring, deliver (inanimate objects)","r":4,"c":"v. trans.","tppp":"راووړ","tppf":"raawoR","noOo":true,"separationAtP":2,"separationAtF":3,"ec":"bring,brings,bringing,brought,brought"}); const raawrul = vEntry({"ts":1527815214,"i":6954,"p":"راوړل","f":"raawRúl","g":"raawRul","e":"to bring, deliver (inanimate objects)","r":4,"c":"v. trans.","tppp":"راووړ","tppf":"raawoR","noOo":true,"separationAtP":2,"separationAtF":3,"ec":"bring,brings,bringing,brought,brought"});
@ -52,7 +53,7 @@ test("basic tenses", () => {
verb: wahul, verb: wahul,
tense: "presentVerb", tense: "presentVerb",
person: T.Person.FirstSingMale, person: T.Person.FirstSingMale,
complementPerson: T.Person.FirstSingMale, complementGenNum: personToGenNum(T.Person.FirstSingMale),
voice: "active", voice: "active",
negative: false, negative: false,
})).toEqual({ })).toEqual({
@ -69,7 +70,7 @@ test("basic tenses", () => {
verb: wahul, verb: wahul,
tense: "subjunctiveVerb", tense: "subjunctiveVerb",
person: T.Person.SecondSingMale, person: T.Person.SecondSingMale,
complementPerson: T.Person.SecondSingMale, complementGenNum: personToGenNum(T.Person.SecondSingMale),
voice: "active", voice: "active",
negative: false, negative: false,
})).toEqual({ })).toEqual({
@ -85,7 +86,7 @@ test("basic tenses", () => {
verb: wahul, verb: wahul,
tense: "habitualPerfectivePast", tense: "habitualPerfectivePast",
person: T.Person.ThirdSingFemale, person: T.Person.ThirdSingFemale,
complementPerson: T.Person.ThirdSingFemale, complementGenNum: personToGenNum(T.Person.ThirdSingFemale),
voice: "active", voice: "active",
negative: false, negative: false,
})).toEqual({ })).toEqual({
@ -111,7 +112,7 @@ test("basic tenses with inflecting roots/stems", () => {
verb: bandawul, verb: bandawul,
tense: "subjunctiveVerb", tense: "subjunctiveVerb",
person: T.Person.FirstSingMale, person: T.Person.FirstSingMale,
complementPerson: T.Person.ThirdSingFemale, complementGenNum: personToGenNum(T.Person.ThirdSingFemale),
voice: "active", voice: "active",
negative: false, negative: false,
})).toEqual({ })).toEqual({
@ -524,7 +525,7 @@ test("special endings", () => {
verb: x.verb, verb: x.verb,
tense: x.tense, tense: x.tense,
person: T.Person.ThirdSingMale, person: T.Person.ThirdSingMale,
complementPerson: T.Person.ThirdSingMale, complementGenNum: personToGenNum(T.Person.ThirdSingMale),
voice: "active", voice: "active",
negative: false, negative: false,
})).toEqual({ hasBa: false, vbs: x.result }); })).toEqual({ hasBa: false, vbs: x.result });
@ -534,7 +535,7 @@ test("special endings", () => {
verb: kedulStat, verb: kedulStat,
tense: "perfectivePast", tense: "perfectivePast",
person: T.Person.FirstPlurMale, person: T.Person.FirstPlurMale,
complementPerson: T.Person.FirstPlurMale, complementGenNum: personToGenNum(T.Person.FirstPlurMale),
voice: "active", voice: "active",
negative: false, negative: false,
})).toEqual({ })).toEqual({
@ -557,7 +558,7 @@ test("special endings", () => {
verb: tlul, verb: tlul,
tense: "imperfectivePast", tense: "imperfectivePast",
person: T.Person.FirstSingMale, person: T.Person.FirstSingMale,
complementPerson: T.Person.FirstSingMale, complementGenNum: personToGenNum(T.Person.FirstSingMale),
voice: "active", voice: "active",
negative: false, negative: false,
})).toEqual({ })).toEqual({
@ -581,7 +582,7 @@ test("special endings", () => {
verb: tlul, verb: tlul,
tense: "imperfectivePast", tense: "imperfectivePast",
person: T.Person.ThirdSingFemale, person: T.Person.ThirdSingFemale,
complementPerson: T.Person.ThirdSingFemale, complementGenNum: personToGenNum(T.Person.ThirdSingFemale),
voice: "active", voice: "active",
negative: false, negative: false,
})).toEqual({ })).toEqual({
@ -606,7 +607,7 @@ test("special endings", () => {
verb: khorul, verb: khorul,
tense: "imperfectivePast", tense: "imperfectivePast",
person: T.Person.ThirdPlurMale, person: T.Person.ThirdPlurMale,
complementPerson: T.Person.ThirdPlurMale, complementGenNum: personToGenNum(T.Person.ThirdPlurMale),
voice: "active", voice: "active",
negative: false, negative: false,
})).toEqual({ })).toEqual({
@ -629,7 +630,7 @@ test("special endings", () => {
verb: khorul, verb: khorul,
tense: "perfectivePast", tense: "perfectivePast",
person: T.Person.ThirdPlurMale, person: T.Person.ThirdPlurMale,
complementPerson: T.Person.ThirdPlurMale, complementGenNum: personToGenNum(T.Person.ThirdPlurMale),
voice: "active", voice: "active",
negative: false, negative: false,
})).toEqual({ })).toEqual({
@ -655,7 +656,7 @@ test("imperative tenses", () => {
verb: wahul, verb: wahul,
tense: "imperfectiveImperative", tense: "imperfectiveImperative",
person: T.Person.SecondSingMale, person: T.Person.SecondSingMale,
complementPerson: T.Person.SecondSingMale, complementGenNum: personToGenNum(T.Person.SecondSingMale),
voice: "active", voice: "active",
negative: false, negative: false,
})).toEqual({ })).toEqual({
@ -671,7 +672,7 @@ test("imperative tenses", () => {
verb: wahul, verb: wahul,
tense: "perfectiveImperative", tense: "perfectiveImperative",
person: T.Person.SecondSingFemale, person: T.Person.SecondSingFemale,
complementPerson: T.Person.SecondSingFemale, complementGenNum: personToGenNum(T.Person.SecondSingFemale),
voice: "active", voice: "active",
negative: false, negative: false,
})).toEqual({ })).toEqual({
@ -687,7 +688,7 @@ test("imperative tenses", () => {
verb: wahul, verb: wahul,
tense: "imperfectiveImperative", tense: "imperfectiveImperative",
person: T.Person.SecondPlurMale, person: T.Person.SecondPlurMale,
complementPerson: T.Person.SecondPlurMale, complementGenNum: personToGenNum(T.Person.SecondPlurMale),
voice: "active", voice: "active",
negative: false, negative: false,
})).toEqual({ })).toEqual({
@ -703,7 +704,7 @@ test("imperative tenses", () => {
verb: wahul, verb: wahul,
tense: "perfectiveImperative", tense: "perfectiveImperative",
person: T.Person.SecondPlurFemale, person: T.Person.SecondPlurFemale,
complementPerson: T.Person.SecondPlurFemale, complementGenNum: personToGenNum(T.Person.SecondPlurFemale),
voice: "active", voice: "active",
negative: false, negative: false,
})).toEqual({ })).toEqual({
@ -722,7 +723,7 @@ test("ability tenses", () => {
verb: wahul, verb: wahul,
tense: "presentVerbModal", tense: "presentVerbModal",
person: T.Person.FirstSingMale, person: T.Person.FirstSingMale,
complementPerson: T.Person.FirstSingMale, complementGenNum: personToGenNum(T.Person.FirstSingMale),
voice: "active", voice: "active",
negative: false, negative: false,
})).toEqual({ })).toEqual({
@ -758,7 +759,7 @@ test("basic tenses", () => {
verb: wahul, verb: wahul,
tense: "presentVerb", tense: "presentVerb",
person: T.Person.FirstSingMale, person: T.Person.FirstSingMale,
complementPerson: T.Person.FirstSingMale, complementGenNum: personToGenNum(T.Person.FirstSingMale),
voice: "active", voice: "active",
negative: false, negative: false,
})).toEqual({ })).toEqual({
@ -775,7 +776,7 @@ test("basic tenses", () => {
verb: wahul, verb: wahul,
tense: "subjunctiveVerb", tense: "subjunctiveVerb",
person: T.Person.SecondSingMale, person: T.Person.SecondSingMale,
complementPerson: T.Person.SecondSingMale, complementGenNum: personToGenNum(T.Person.SecondSingMale),
voice: "active", voice: "active",
negative: false, negative: false,
})).toEqual({ })).toEqual({
@ -791,7 +792,7 @@ test("basic tenses", () => {
verb: wahul, verb: wahul,
tense: "habitualPerfectivePast", tense: "habitualPerfectivePast",
person: T.Person.ThirdSingFemale, person: T.Person.ThirdSingFemale,
complementPerson: T.Person.ThirdSingFemale, complementGenNum: personToGenNum(T.Person.ThirdSingFemale),
voice: "active", voice: "active",
negative: false, negative: false,
})).toEqual({ })).toEqual({
@ -817,7 +818,7 @@ test("perfect tenses", () => {
verb: wahul, verb: wahul,
tense: "presentPerfect", tense: "presentPerfect",
person: T.Person.FirstSingMale, person: T.Person.FirstSingMale,
complementPerson: T.Person.FirstSingMale, complementGenNum: personToGenNum(T.Person.FirstSingMale),
voice: "active", voice: "active",
negative: false, negative: false,
})).toEqual({ })).toEqual({
@ -834,7 +835,7 @@ test("perfect tenses", () => {
verb: wahul, verb: wahul,
tense: "subjunctivePerfect", tense: "subjunctivePerfect",
person: T.Person.FirstSingMale, person: T.Person.FirstSingMale,
complementPerson: T.Person.FirstSingMale, complementGenNum: personToGenNum(T.Person.FirstSingMale),
voice: "active", voice: "active",
negative: false, negative: false,
})).toEqual({ })).toEqual({
@ -851,7 +852,7 @@ test("perfect tenses", () => {
verb: wahul, verb: wahul,
tense: "habitualPerfect", tense: "habitualPerfect",
person: T.Person.FirstSingMale, person: T.Person.FirstSingMale,
complementPerson: T.Person.FirstSingMale, complementGenNum: personToGenNum(T.Person.FirstSingMale),
voice: "active", voice: "active",
negative: false, negative: false,
})).toEqual({ })).toEqual({
@ -868,7 +869,7 @@ test("perfect tenses", () => {
verb: wahul, verb: wahul,
tense: "habitualPerfect", tense: "habitualPerfect",
person: T.Person.ThirdPlurMale, person: T.Person.ThirdPlurMale,
complementPerson: T.Person.ThirdPlurMale, complementGenNum: personToGenNum(T.Person.ThirdPlurMale),
voice: "active", voice: "active",
negative: false, negative: false,
})).toEqual({ })).toEqual({
@ -885,7 +886,7 @@ test("perfect tenses", () => {
verb: wahul, verb: wahul,
tense: "futurePerfect", tense: "futurePerfect",
person: T.Person.FirstSingMale, person: T.Person.FirstSingMale,
complementPerson: T.Person.FirstSingMale, complementGenNum: personToGenNum(T.Person.FirstSingMale),
voice: "active", voice: "active",
negative: false, negative: false,
})).toEqual({ })).toEqual({
@ -902,7 +903,7 @@ test("perfect tenses", () => {
verb: wahul, verb: wahul,
tense: "pastPerfect", tense: "pastPerfect",
person: T.Person.SecondSingFemale, person: T.Person.SecondSingFemale,
complementPerson: T.Person.SecondSingFemale, complementGenNum: personToGenNum(T.Person.SecondSingFemale),
voice: "active", voice: "active",
negative: false, negative: false,
})).toEqual({ })).toEqual({
@ -926,7 +927,7 @@ test("perfect tenses", () => {
verb: wahul, verb: wahul,
tense: "wouldBePerfect", tense: "wouldBePerfect",
person: T.Person.SecondSingFemale, person: T.Person.SecondSingFemale,
complementPerson: T.Person.SecondSingFemale, complementGenNum: personToGenNum(T.Person.SecondSingFemale),
voice: "active", voice: "active",
negative: false, negative: false,
})).toEqual({ })).toEqual({
@ -950,7 +951,7 @@ test("perfect tenses", () => {
verb: wahul, verb: wahul,
tense: "pastSubjunctivePerfect", tense: "pastSubjunctivePerfect",
person: T.Person.SecondSingFemale, person: T.Person.SecondSingFemale,
complementPerson: T.Person.SecondSingFemale, complementGenNum: personToGenNum(T.Person.SecondSingFemale),
voice: "active", voice: "active",
negative: false, negative: false,
})).toEqual({ })).toEqual({
@ -971,7 +972,7 @@ test("perfect tenses", () => {
verb: wahul, verb: wahul,
tense: "wouldHaveBeenPerfect", tense: "wouldHaveBeenPerfect",
person: T.Person.SecondSingFemale, person: T.Person.SecondSingFemale,
complementPerson: T.Person.SecondSingFemale, complementGenNum: personToGenNum(T.Person.SecondSingFemale),
voice: "active", voice: "active",
negative: false, negative: false,
})).toEqual({ })).toEqual({
@ -996,7 +997,7 @@ test("ending on complex verbs", () => {
tense: "presentVerbModal", tense: "presentVerbModal",
person: T.Person.SecondSingMale, person: T.Person.SecondSingMale,
voice: "active", voice: "active",
complementPerson: T.Person.ThirdSingFemale, complementGenNum: personToGenNum(T.Person.ThirdSingFemale),
negative: false, negative: false,
})).toEqual({ })).toEqual({
hasBa: false, hasBa: false,
@ -1041,7 +1042,7 @@ test("ending on complex verbs", () => {
tense: "presentVerb", tense: "presentVerb",
person: T.Person.SecondSingMale, person: T.Person.SecondSingMale,
voice: "active", voice: "active",
complementPerson: T.Person.ThirdSingFemale, complementGenNum: personToGenNum(T.Person.ThirdSingFemale),
negative: false, negative: false,
})).toEqual({ })).toEqual({
hasBa: false, hasBa: false,

View File

@ -4,6 +4,7 @@ import {
isSecondPerson, isSecondPerson,
personGender, personGender,
personNumber, personNumber,
personToGenNum,
} from "../misc-helpers"; } from "../misc-helpers";
import { import {
fmapSingleOrLengthOpts, fmapSingleOrLengthOpts,
@ -19,20 +20,90 @@ import {
imperativeEndings, imperativeEndings,
} from "../grammar-units"; } from "../grammar-units";
import { isKawulVerb, isAbilityTense, isPerfectTense, isTlulVerb, isImperativeTense } from "../type-predicates"; import { isKawulVerb, isAbilityTense, isPerfectTense, isTlulVerb, isImperativeTense } from "../type-predicates";
import { tenseHasBa } from "../phrase-building/vp-tools"; import { perfectTenseHasBa } from "../phrase-building/vp-tools";
import { isPastTense } from "../phrase-building/vp-tools";
import { makePsString, removeFVarients } from "../accent-and-ps-utils"; import { makePsString, removeFVarients } from "../accent-and-ps-utils";
import { getPastParticiple, getRootStem } from "./roots-and-stems"; import { getPastParticiple, getRootStem } from "./roots-and-stems";
import { getAspect, isKedul, perfectTenseToEquative, verbEndingConcat } from "./rs-helpers"; import { isKedul, perfectTenseToEquative, verbEndingConcat } from "./rs-helpers";
import { accentOnNFromEnd, accentPsSyllable, removeAccents } from "../accent-helpers"; import { accentOnNFromEnd, accentPsSyllable, removeAccents } from "../accent-helpers";
const formulas: Record<T.VerbTense | T.ImperativeTense, {
aspect: T.Aspect,
tenseC: "past" | "present" | "imperative",
hasBa: boolean,
}> = {
"presentVerb": {
aspect: "imperfective",
tenseC: "present",
hasBa: false,
},
"subjunctiveVerb": {
aspect: "imperfective",
tenseC: "present",
hasBa: false,
},
"perfectiveFuture": {
aspect: "perfective",
tenseC: "present",
hasBa: true,
},
"imperfectiveFuture": {
aspect: "imperfective",
tenseC: "present",
hasBa: true,
},
"perfectivePast": {
aspect: "perfective",
tenseC: "past",
hasBa: false,
},
"imperfectivePast": {
aspect: "imperfective",
tenseC: "past",
hasBa: false,
},
"habitualImperfectivePast": {
aspect: "imperfective",
tenseC: "past",
hasBa: true,
},
"habitualPerfectivePast": {
aspect: "perfective",
tenseC: "past",
hasBa: true,
},
"perfectiveImperative": {
aspect: "perfective",
tenseC: "imperative",
hasBa: false,
},
"imperfectiveImperative": {
aspect: "imperfective",
tenseC: "imperative",
hasBa: false,
},
}
// to get the chart of conjugations:
// 1. get the conjugation for all persons
// 2. if transitive present tense, check (or do all the conjugation) the conjugation with all different complement person stuff
// if necessary pull out the object option
//
// to make the verbs displayable for the charts
// - take the output of renderVerb { hasBa, VerbRenderedOutput }
// - filter out a long and short version etc if necessary
// - pass it into combineIntoText
// PROBLEM: how to handle when to specify the object
// present tense
// TODO: problem with laaR - no perfective split // TODO: problem with laaR - no perfective split
export function renderVerb({ verb, tense, person, voice, negative, complementPerson }: { export function renderVerb({ verb, tense: tense, person, voice, negative, complementGenNum }: {
verb: T.VerbEntry, verb: T.VerbEntry,
negative: boolean, negative: boolean,
tense: T.VerbTense | T.PerfectTense | T.AbilityTense | T.ImperativeTense, // TODO: make T.Tense tense: T.VerbTense | T.PerfectTense | T.AbilityTense | T.ImperativeTense, // TODO: make T.Tense
person: T.Person, person: T.Person,
complementPerson: T.Person, complementGenNum: { gender: T.Gender, number: T.NounNumber },
voice: T.Voice, voice: T.Voice,
}): { }): {
hasBa: boolean, hasBa: boolean,
@ -41,10 +112,8 @@ export function renderVerb({ verb, tense, person, voice, negative, complementPer
if (isPerfectTense(tense)) { if (isPerfectTense(tense)) {
return renderPerfectVerb({ verb, tense, voice, person }); return renderPerfectVerb({ verb, tense, voice, person });
} }
const isPast = isPastTense(tense); const { aspect, tenseC, hasBa } = formulas[removeAbility(tense)];
const hasBa = tenseHasBa(tense); const isPast = tenseC === "past";
const aspect = getAspect(tense, negative);
const isImperative = isImperativeTense(tense);
const type = isAbilityTense(tense) ? "ability" : "basic"; const type = isAbilityTense(tense) ? "ability" : "basic";
// #1 get the appropriate root / stem // #1 get the appropriate root / stem
@ -54,13 +123,10 @@ export function renderVerb({ verb, tense, person, voice, negative, complementPer
aspect, aspect,
voice, voice,
type, type,
genderNumber: { genderNumber: complementGenNum,
gender: personGender(complementPerson),
number: personNumber(complementPerson),
},
}); });
// #2 add the verb ending to it // #2 add the verb ending to it
const ending = getEnding(person, isPast, isImperative, aspect); const ending = getEnding(person, tenseC, aspect);
return { return {
hasBa, hasBa,
vbs: [ vbs: [
@ -85,13 +151,9 @@ function renderPerfectVerb({ tense, verb, voice, person }: {
person: T.Person, person: T.Person,
// TODO: Tighter typing on the output for T.VB (enforce genderNumber?) // TODO: Tighter typing on the output for T.VB (enforce genderNumber?)
}): { hasBa: boolean, vbs: [[], [T.VB, T.VBE]] } { }): { hasBa: boolean, vbs: [[], [T.VB, T.VBE]] } {
const hasBa = tenseHasBa(tense); const hasBa = perfectTenseHasBa(tense);
const genderNumber = {
gender: personGender(person),
number: personNumber(person),
};
// #1 get the past participle // #1 get the past participle
const pp = getPastParticiple(verb, voice, genderNumber); const pp = getPastParticiple(verb, voice, personToGenNum(person));
// #2 get the right equative // #2 get the right equative
const equative = equativeEndings[perfectTenseToEquative(tense)]; const equative = equativeEndings[perfectTenseToEquative(tense)];
const [row, col] = getVerbBlockPosFromPerson(person); const [row, col] = getVerbBlockPosFromPerson(person);
@ -141,7 +203,7 @@ function addEnding({ verb, rs, ending, person, pastThird, aspect, basicForm }: {
} }
const endLong = getLength(end, "long"); const endLong = getLength(end, "long");
const endShort = getLength(end, "short"); const endShort = getLength(end, "short");
// TODO: this is hackyۉ // TODO: this is hacky
return { return {
...vb, ...vb,
ps: { ps: {
@ -166,8 +228,8 @@ function addEnding({ verb, rs, ending, person, pastThird, aspect, basicForm }: {
} }
} }
function getEnding(person: T.Person, isPast: boolean, isImperative: boolean, aspect: T.Aspect) { function getEnding(person: T.Person, tenseC: "present" | "past" | "imperative", aspect: T.Aspect) {
if (isImperative) { if (tenseC === "imperative") {
if (!isSecondPerson(person)) { if (!isSecondPerson(person)) {
throw new Error("imperative forms must be second person"); throw new Error("imperative forms must be second person");
} }
@ -178,7 +240,7 @@ function getEnding(person: T.Person, isPast: boolean, isImperative: boolean, asp
: ends; : ends;
} }
const [row, col] = getVerbBlockPosFromPerson(person); const [row, col] = getVerbBlockPosFromPerson(person);
return isPast ? { return tenseC === "past" ? {
long: pastEndings.long[row][col], long: pastEndings.long[row][col],
short: pastEndings.short[row][col], short: pastEndings.short[row][col],
} : presentEndings[row][col]; } : presentEndings[row][col];
@ -242,3 +304,7 @@ function ensure3rdPast(rs: T.PsString[], ending: T.PsString[], verb: T.VerbEntry
const ends = endsInDental ? [{ p: "", f: "" }, ...ending] : ending; const ends = endsInDental ? [{ p: "", f: "" }, ...ending] : ending;
return verbEndingConcat(rs, ends); return verbEndingConcat(rs, ends);
} }
function removeAbility(tense: T.VerbTense | T.AbilityTense | T.ImperativeTense): T.VerbTense | T.ImperativeTense {
return tense.replace("Modal", "") as T.VerbTense | T.ImperativeTense;
}

View File

@ -18,6 +18,7 @@ import { getObjectSelection, getSubjectSelection, makeBlock, makeKid } from "./b
import { renderAPSelection } from "./render-ap"; import { renderAPSelection } from "./render-ap";
import { findPossesivesToShrink, orderKids, getMiniPronounPs } from "./render-common"; import { findPossesivesToShrink, orderKids, getMiniPronounPs } from "./render-common";
import { renderComplementSelection } from "./render-complement"; import { renderComplementSelection } from "./render-complement";
import { personToGenNum } from "../misc-helpers";
export function renderVP(VP: T.VPSelectionComplete): T.VPRendered { export function renderVP(VP: T.VPSelectionComplete): T.VPRendered {
const subject = getSubjectSelection(VP.blocks).selection; const subject = getSubjectSelection(VP.blocks).selection;
@ -49,7 +50,7 @@ export function renderVP(VP: T.VPSelectionComplete): T.VPRendered {
verb: VP.verb.verb, verb: VP.verb.verb,
tense: VP.verb.tense, tense: VP.verb.tense,
person: kingPerson, person: kingPerson,
complementPerson: objectPerson || kingPerson, complementGenNum: personToGenNum(objectPerson || kingPerson),
voice: VP.verb.voice, voice: VP.verb.voice,
negative: VP.verb.negative, negative: VP.verb.negative,
}); });

View File

@ -198,16 +198,8 @@ export function isPastTense(tense: T.Tense): boolean {
return tense.toLowerCase().includes("past"); return tense.toLowerCase().includes("past");
} }
export function tenseHasBa(tense: T.VerbTense | T.PerfectTense | T.AbilityTense | T.ImperativeTense): boolean { export function perfectTenseHasBa(tense: T.PerfectTense): boolean {
const withBa: Parameters<typeof tenseHasBa>[0][] = [ const withBa: Parameters<typeof perfectTenseHasBa>[0][] = [
"imperfectiveFuture",
"perfectiveFuture",
"habitualPerfectivePast",
"habitualImperfectivePast",
"imperfectiveFutureModal",
"perfectiveFutureModal",
"habitualPerfectivePastModal",
"habitualImperfectivePastModal",
"futurePerfect", "futurePerfect",
"wouldBePerfect", "wouldBePerfect",
"wouldHaveBeenPerfect", "wouldHaveBeenPerfect",