bug with nu
This commit is contained in:
parent
1ab1384c78
commit
cf91b178ab
|
@ -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:
|
// 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) => (
|
return verbWNegativeVersions.flatMap((verbSegments) => (
|
||||||
// potential reordering of NPs
|
// b. potential reordering of NPs
|
||||||
NPs.flatMap(NP => {
|
NPs.flatMap(NP => {
|
||||||
// for each permutation of the possible ordering of NPs and Verb + nu
|
// for each permutation of the possible ordering of NPs and Verb + nu
|
||||||
// 1. put in kids in the kids section
|
// 1. put in kids in the kids section
|
||||||
|
@ -68,6 +68,7 @@ function getSegmentsAndKids(VP: VPRendered, form: FormVersion): { kids: Segment[
|
||||||
subject: VP.subject.ps,
|
subject: VP.subject.ps,
|
||||||
object: typeof VP.object === "object" ? VP.object.ps : undefined,
|
object: typeof VP.object === "object" ? VP.object.ps : undefined,
|
||||||
}
|
}
|
||||||
|
// TODO: simplify all this logic
|
||||||
const { removeKing, shrinkServant } = form;
|
const { removeKing, shrinkServant } = form;
|
||||||
const shrinkCanditate = (shrinkServant && VP.servant)
|
const shrinkCanditate = (shrinkServant && VP.servant)
|
||||||
? VP[VP.servant]
|
? VP[VP.servant]
|
||||||
|
@ -108,6 +109,7 @@ function putKidsInKidsSection(segments: Segment[], kids: Segment[]): Segment[] {
|
||||||
const rest = segments.slice(1);
|
const rest = segments.slice(1);
|
||||||
return [
|
return [
|
||||||
first,
|
first,
|
||||||
|
// TODO: simplify to just isKidAfterHead ??
|
||||||
...(first.isVerbHead && rest[0] && rest[0].isVerbRest)
|
...(first.isVerbHead && rest[0] && rest[0].isVerbRest)
|
||||||
? kids.map(k => k.adjust({ desc: ["isKidBetweenHeadAndRest"] }))
|
? kids.map(k => k.adjust({ desc: ["isKidBetweenHeadAndRest"] }))
|
||||||
: kids,
|
: 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 rest = makeSegment(restRaw.map(removeBa), ["isVerbRest"]);
|
||||||
const headSegment: Segment | undefined = !head
|
const headSegment: Segment | undefined = !head
|
||||||
? head
|
? head
|
||||||
|
@ -170,8 +172,8 @@ function addSpacesBetweenSegments(segments: Segment[]): (Segment | " " | "" | T.
|
||||||
if ((next.isKidBetweenHeadAndRest || next.isNu) || (next.isVerbRest && current.isKidBetweenHeadAndRest)) {
|
if ((next.isKidBetweenHeadAndRest || next.isNu) || (next.isVerbRest && current.isKidBetweenHeadAndRest)) {
|
||||||
o.push({
|
o.push({
|
||||||
f: "-",
|
f: "-",
|
||||||
p: ((current.isVerbHead && (next.isMiniPronoun || next.isNu))
|
p: ((current.isVerbHead && next.isMiniPronoun)
|
||||||
|| (current.isOoOrWaaHead && next.isBa )) ? "" : " ", // or if its waa head
|
|| (current.isOoOrWaaHead && (next.isBa || next.isNu))) ? "" : " ", // or if its waa head
|
||||||
});
|
});
|
||||||
} else if (current.isVerbHead && next.isVerbRest) {
|
} else if (current.isVerbHead && next.isVerbRest) {
|
||||||
o.push("");
|
o.push("");
|
||||||
|
@ -203,6 +205,7 @@ type SegmentDescriptions = {
|
||||||
isVerbRest?: boolean,
|
isVerbRest?: boolean,
|
||||||
isMiniPronoun?: boolean,
|
isMiniPronoun?: boolean,
|
||||||
isKid?: boolean,
|
isKid?: boolean,
|
||||||
|
// TODO: Simplify to just isKidAfterHead?
|
||||||
isKidBetweenHeadAndRest?: boolean,
|
isKidBetweenHeadAndRest?: boolean,
|
||||||
isNu?: boolean,
|
isNu?: boolean,
|
||||||
isBa?: boolean,
|
isBa?: boolean,
|
||||||
|
|
|
@ -126,12 +126,10 @@ function renderVerbSelection(vs: VerbSelection, person: T.Person, objectPerson:
|
||||||
// TODO: error handle this?
|
// TODO: error handle this?
|
||||||
// TODO: option to manually select these
|
// TODO: option to manually select these
|
||||||
const conj = "grammaticallyTransitive" in conjugations
|
const conj = "grammaticallyTransitive" in conjugations
|
||||||
// BIG TODO: allow for choice of grmatically transitive over transitive if there's both
|
|
||||||
? conjugations.transitive
|
? conjugations.transitive
|
||||||
: "stative" in conjugations
|
: "stative" in conjugations
|
||||||
? conjugations.stative
|
? conjugations.stative
|
||||||
: conjugations;
|
: conjugations;
|
||||||
// TODO: deliver the perfective split!
|
|
||||||
return {
|
return {
|
||||||
...vs,
|
...vs,
|
||||||
person,
|
person,
|
||||||
|
@ -166,6 +164,7 @@ function renderEnglishVPBase({ subjectPerson, object, vs }: {
|
||||||
const futureEngBuilder: T.EnglishBuilder = (s: T.Person, ec: T.EnglishVerbConjugationEc, n: boolean) => ([
|
const futureEngBuilder: T.EnglishBuilder = (s: T.Person, ec: T.EnglishVerbConjugationEc, n: boolean) => ([
|
||||||
`$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
|
||||||
const builders: Record<
|
const builders: Record<
|
||||||
VerbTense,
|
VerbTense,
|
||||||
(s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => string[]
|
(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[] {
|
function getInf(infs: T.InflectorOutput, t: "plural" | "arabicPlural" | "inflections", gender: T.Gender, plural: boolean, inflected: boolean): T.PsString[] {
|
||||||
|
// TODO: make this safe!!
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
if (infs && t in infs && infs[t] !== undefined && gender in infs[t] && infs[t][gender] !== undefined) {
|
if (infs && t in infs && infs[t] !== undefined && gender in infs[t] && infs[t][gender] !== undefined) {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
|
Loading…
Reference in New Issue