bug with nu

This commit is contained in:
lingdocs 2022-03-25 22:53:20 +05:00
parent 1ab1384c78
commit cf91b178ab
2 changed files with 12 additions and 9 deletions

View File

@ -45,12 +45,12 @@ function compilePs({ NPs, kids, verb: { head, rest }, negative }: CompilePsInput
} : {},
};
}
const verbWNegativeVersions = compileVerbWNegative(head, rest, negative);
const verbWNegativeVersions = arrangeVerbWNegative(head, rest, negative);
// put together all the different possible permutations based on:
// potential different versions of where the nu goes
// a. potential different versions of where the nu goes
return verbWNegativeVersions.flatMap((verbSegments) => (
// potential reordering of NPs
// b. potential reordering of NPs
NPs.flatMap(NP => {
// for each permutation of the possible ordering of NPs and Verb + nu
// 1. put in kids in the kids section
@ -68,6 +68,7 @@ function getSegmentsAndKids(VP: VPRendered, form: FormVersion): { kids: Segment[
subject: VP.subject.ps,
object: typeof VP.object === "object" ? VP.object.ps : undefined,
}
// TODO: simplify all this logic
const { removeKing, shrinkServant } = form;
const shrinkCanditate = (shrinkServant && VP.servant)
? VP[VP.servant]
@ -108,6 +109,7 @@ function putKidsInKidsSection(segments: Segment[], kids: Segment[]): Segment[] {
const rest = segments.slice(1);
return [
first,
// TODO: simplify to just isKidAfterHead ??
...(first.isVerbHead && rest[0] && rest[0].isVerbRest)
? kids.map(k => k.adjust({ desc: ["isKidBetweenHeadAndRest"] }))
: kids,
@ -115,7 +117,7 @@ function putKidsInKidsSection(segments: Segment[], kids: Segment[]): Segment[] {
];
}
function compileVerbWNegative(head: T.PsString | undefined, restRaw: T.PsString[], negative: boolean): Segment[][] {
function arrangeVerbWNegative(head: T.PsString | undefined, restRaw: T.PsString[], negative: boolean): Segment[][] {
const rest = makeSegment(restRaw.map(removeBa), ["isVerbRest"]);
const headSegment: Segment | undefined = !head
? head
@ -170,8 +172,8 @@ function addSpacesBetweenSegments(segments: Segment[]): (Segment | " " | "" | T.
if ((next.isKidBetweenHeadAndRest || next.isNu) || (next.isVerbRest && current.isKidBetweenHeadAndRest)) {
o.push({
f: "-",
p: ((current.isVerbHead && (next.isMiniPronoun || next.isNu))
|| (current.isOoOrWaaHead && next.isBa )) ? "" : " ", // or if its waa head
p: ((current.isVerbHead && next.isMiniPronoun)
|| (current.isOoOrWaaHead && (next.isBa || next.isNu))) ? "" : " ", // or if its waa head
});
} else if (current.isVerbHead && next.isVerbRest) {
o.push("");
@ -203,6 +205,7 @@ type SegmentDescriptions = {
isVerbRest?: boolean,
isMiniPronoun?: boolean,
isKid?: boolean,
// TODO: Simplify to just isKidAfterHead?
isKidBetweenHeadAndRest?: boolean,
isNu?: boolean,
isBa?: boolean,

View File

@ -126,12 +126,10 @@ function renderVerbSelection(vs: VerbSelection, person: T.Person, objectPerson:
// TODO: error handle this?
// TODO: option to manually select these
const conj = "grammaticallyTransitive" in conjugations
// BIG TODO: allow for choice of grmatically transitive over transitive if there's both
? conjugations.transitive
: "stative" in conjugations
? conjugations.stative
: conjugations;
// TODO: deliver the perfective split!
return {
...vs,
person,
@ -166,6 +164,7 @@ function renderEnglishVPBase({ subjectPerson, object, vs }: {
const futureEngBuilder: T.EnglishBuilder = (s: T.Person, ec: T.EnglishVerbConjugationEc, n: boolean) => ([
`$SUBJ will${n ? " not" : ""} ${isToBe(ec) ? "be" : ec[0]}`,
]);
// TODO: Pull these out to a seperate entity and import it
const builders: Record<
VerbTense,
(s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => string[]
@ -356,6 +355,7 @@ function getEnglishFromNoun(entry: T.DictionaryEntry, number: NounNumber): strin
}
function getInf(infs: T.InflectorOutput, t: "plural" | "arabicPlural" | "inflections", gender: T.Gender, plural: boolean, inflected: boolean): T.PsString[] {
// TODO: make this safe!!
// @ts-ignore
if (infs && t in infs && infs[t] !== undefined && gender in infs[t] && infs[t][gender] !== undefined) {
// @ts-ignore