more display options

This commit is contained in:
lingdocs 2022-05-09 10:31:56 -05:00
parent 7db00e2ac2
commit c74309ba9e
1 changed files with 12 additions and 9 deletions

View File

@ -27,10 +27,12 @@ import { completeVPSelection } from "./vp-tools";
import { renderVP } from "./render-vp"; import { renderVP } from "./render-vp";
const blank: T.PsString = { const blank: T.PsString = {
p: "_______", p: "______",
f: "_______", f: "______",
}; };
const kidsBlank = makeSegment({ p: "___", f: "___" }, ["isKid"]);
type Form = T.FormVersion & { OSV?: boolean }; type Form = T.FormVersion & { OSV?: boolean };
export function compileVP(VP: T.VPRendered, form: Form): { ps: T.SingleOrLengthOpts<T.PsString[]>, e?: string [] }; export function compileVP(VP: T.VPRendered, form: Form): { ps: T.SingleOrLengthOpts<T.PsString[]>, e?: string [] };
export function compileVP(VP: T.VPRendered, form: Form, combineLengths: true): { ps: T.PsString[], e?: string [] }; export function compileVP(VP: T.VPRendered, form: Form, combineLengths: true): { ps: T.PsString[], e?: string [] };
@ -254,11 +256,11 @@ function arrangeVerbWNegative(head: T.PsString | undefined, restRaw: T.PsString[
]; ];
} }
type BlankoutOptions = { equative: boolean, ba: boolean, kidsSection: boolean };
export function compileEP(EP: T.EPRendered): { ps: T.SingleOrLengthOpts<T.PsString[]>, e?: string[] }; export function compileEP(EP: T.EPRendered): { ps: T.SingleOrLengthOpts<T.PsString[]>, e?: string[] };
export function compileEP(EP: T.EPRendered, combineLengths: true, blankOut?: { equative: boolean }): { ps: T.PsString[], e?: string[] }; export function compileEP(EP: T.EPRendered, combineLengths: true, blankOut?: BlankoutOptions): { ps: T.PsString[], e?: string[] };
export function compileEP(EP: T.EPRendered, combineLengths?: boolean, blankOut?: { equative: boolean }): { ps: T.SingleOrLengthOpts<T.PsString[]>, e?: string[] } { export function compileEP(EP: T.EPRendered, combineLengths?: boolean, blankOut?: BlankoutOptions): { ps: T.SingleOrLengthOpts<T.PsString[]>, e?: string[] } {
const { kids, NPs } = getEPSegmentsAndKids(EP); const { kids, NPs } = getEPSegmentsAndKids(EP, blankOut);
const equative = EP.equative.ps; const equative = EP.equative.ps;
const psResult = compileEPPs({ const psResult = compileEPPs({
NPs, NPs,
@ -272,14 +274,15 @@ export function compileEP(EP: T.EPRendered, combineLengths?: boolean, blankOut?:
}; };
} }
export function getEPSegmentsAndKids(EP: T.EPRendered): { kids: Segment[], NPs: Segment[] } { export function getEPSegmentsAndKids(EP: T.EPRendered, blankOut?: BlankoutOptions): { kids: Segment[], NPs: Segment[] } {
const possToShrink = findPossesivesToShrinkInEP(EP); const possToShrink = findPossesivesToShrinkInEP(EP);
const subject = makeSegment(getPashtoFromRendered(EP.subject, false)); const subject = makeSegment(getPashtoFromRendered(EP.subject, false));
const predicate = makeSegment(getPashtoFromRendered(EP.predicate, false)); const predicate = makeSegment(getPashtoFromRendered(EP.predicate, false));
return { return {
kids: orderKidsSection([ kids: blankOut?.kidsSection ? [kidsBlank] : orderKidsSection([
...EP.equative.hasBa ...EP.equative.hasBa
? [makeSegment(grammarUnits.baParticle, ["isBa", "isKid"])] ? (
blankOut?.ba ? [kidsBlank] : [makeSegment(grammarUnits.baParticle, ["isBa", "isKid"])])
: [], : [],
...possToShrink.map(a => shrinkNP(a.np)), ...possToShrink.map(a => shrinkNP(a.np)),
]), ]),