better blocks for complement

This commit is contained in:
lingdocs 2022-07-19 20:17:50 -05:00
parent c7d8b49461
commit 2aec8e1dfb
10 changed files with 149 additions and 98 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@lingdocs/pashto-inflector", "name": "@lingdocs/pashto-inflector",
"version": "3.4.4", "version": "3.4.5",
"author": "lingdocs.com", "author": "lingdocs.com",
"description": "A Pashto inflection and verb conjugation engine, inculding React components for displaying Pashto text, inflections, and conjugations", "description": "A Pashto inflection and verb conjugation engine, inculding React components for displaying Pashto text, inflections, and conjugations",
"homepage": "https://verbs.lingdocs.com", "homepage": "https://verbs.lingdocs.com",

View File

@ -41,9 +41,6 @@ function Block({ opts, block, king, script }: {
if (block.block.type === "perfectiveHead") { if (block.block.type === "perfectiveHead") {
return <PerfHeadBlock opts={opts} ps={block.block.ps} script={script} /> return <PerfHeadBlock opts={opts} ps={block.block.ps} script={script} />
} }
if (block.block.type === "verbComplement") {
return <VCompBlock opts={opts} comp={block.block.complement} script={script} />;
}
if (block.block.type === "verb") { if (block.block.type === "verb") {
return <VerbSBlock opts={opts} v={block.block.block} script={script} />; return <VerbSBlock opts={opts} v={block.block.block} script={script} />;
} }
@ -103,8 +100,8 @@ function VerbSBlock({ opts, v, script }: {
{"long" in v.ps && <div className="clickable small mb-1" onClick={changeLength}>{length}</div>} {"long" in v.ps && <div className="clickable small mb-1" onClick={changeLength}>{length}</div>}
<Border> <Border>
<> <>
{(v.type === "verb" || v.type === "perfectParticipleBlock") && v.complement && <span className="mx-2"> {(v.type === "verb" || v.type === "perfectParticipleBlock") && v.complementWelded && <span className="mx-2">
<ComplementBlock opts={opts} comp={v.complement.selection} script={script} inside /> <ComplementBlock opts={opts} comp={v.complementWelded.selection} script={script} inside />
</span>} </span>}
{getLength(v.ps, length)[0][script]} {getLength(v.ps, length)[0][script]}
</> </>
@ -134,8 +131,8 @@ function ModalVerbBlock({ opts, v, script }: {
{"long" in v.ps && <div className="clickable small mb-1" onClick={changeLength}>{length}</div>} {"long" in v.ps && <div className="clickable small mb-1" onClick={changeLength}>{length}</div>}
<Border> <Border>
<> <>
{v.complement && <span className="mx-2"> {v.complementWelded && <span className="mx-2">
<ComplementBlock opts={opts} comp={v.complement.selection} script={script} inside /> <ComplementBlock opts={opts} comp={v.complementWelded.selection} script={script} inside />
</span>} </span>}
{getLength(v.ps, length)[0][script]} {getLength(v.ps, length)[0][script]}
</> </>
@ -160,20 +157,6 @@ function PerfHeadBlock({ opts, ps, script }: {
</div>; </div>;
} }
function VCompBlock({ opts, comp, script }: {
opts: T.TextOptions,
comp: T.VerbComplementBlock["complement"],
script: "p" | "f",
}) {
return <div className="text-center">
<Border>
{comp[script]}
</Border>
<div>Complement</div>
<EnglishBelow>{'\u00A0'}</EnglishBelow>
</div>;
}
function ModalAuxBlock({ opts, aux, script }: { function ModalAuxBlock({ opts, aux, script }: {
opts: T.TextOptions, opts: T.TextOptions,
aux: T.ModalVerbKedulPart, aux: T.ModalVerbKedulPart,
@ -271,7 +254,7 @@ function ComplementBlock({ opts, comp, script, inside }: {
<Border> <Border>
{adj.ps[0][script]} {adj.ps[0][script]}
</Border> </Border>
<div>Adj.</div> <div>Adj. <span className="text-muted small">({getEnglishParticipleInflection(adj.person, "short")})</span></div>
<EnglishBelow>{adj.e}</EnglishBelow> <EnglishBelow>{adj.e}</EnglishBelow>
</div>; </div>;
} }
@ -295,9 +278,7 @@ function ComplementBlock({ opts, comp, script, inside }: {
: comp.type === "loc. adv." : comp.type === "loc. adv."
? <LocAdvBlock opts={opts} adv={comp} /> ? <LocAdvBlock opts={opts} adv={comp} />
: comp.type === "noun" : comp.type === "noun"
? <Border> ? <CompNounBlock opts={opts} noun={comp} script={script} />
NOT DONE YET
</Border>
: comp.type === "unselected" : comp.type === "unselected"
? <div> ? <div>
<Border> <Border>
@ -359,6 +340,25 @@ function Sandwich({ opts, sandwich, script }: {
</div>; </div>;
} }
function CompNounBlock({ opts, noun, script }: {
opts: T.TextOptions,
noun: T.Rendered<T.NounSelection>,
script: "p" | "f",
}) {
return <div className="text-center">
<Border
extraClassName={`!inside && hasPossesor ? "pt-2" : ""`}
padding={"1rem"}
>
{noun.ps[0][script]}
</Border>
<div>
Comp. Noun
</div>
<EnglishBelow>{noun.e}</EnglishBelow>
</div>
}
export function NPBlock({ opts, children, inside, english, script }: { export function NPBlock({ opts, children, inside, english, script }: {
opts: T.TextOptions, opts: T.TextOptions,
children: T.Rendered<T.NPSelection>, children: T.Rendered<T.NPSelection>,

View File

@ -134,7 +134,7 @@ const kawulStatOrDynImperfectivePassive: T.AspectContentPassive = {
[[{p: "کول کېدلم", f: "kawul kedúlum"}], [{p: "کول کېدلو", f: "kawul kedúloo"}]], [[{p: "کول کېدلم", f: "kawul kedúlum"}], [{p: "کول کېدلو", f: "kawul kedúloo"}]],
[[{p: "کول کېدلې", f: "kawul kedúle"}], [{p: "کول کېدلئ", f: "kawul kedúleyy"}]], [[{p: "کول کېدلې", f: "kawul kedúle"}], [{p: "کول کېدلئ", f: "kawul kedúleyy"}]],
[[{p: "کول کېدلې", f: "kawul kedúle"}], [{p: "کول کېدلئ", f: "kawul kedúleyy"}]], [[{p: "کول کېدلې", f: "kawul kedúle"}], [{p: "کول کېدلئ", f: "kawul kedúleyy"}]],
[[{p: "کول کېدله", f: "kawul kedúlu"}, {p: "کول کېدلو", f: "kawul kedúlo"}], [{p: "کول کېدل", f: "kawul kedúl"}]], [[{p: "کول کېدلو", f: "kawul kedúlo"}], [{p: "کول کېدل", f: "kawul kedúl"}]],
[[{p: "کول کېدله", f: "kawul kedúla"}], [{p: "کول کېدلې", f: "kawul kedúle"}]], [[{p: "کول کېدله", f: "kawul kedúla"}], [{p: "کول کېدلې", f: "kawul kedúle"}]],
], ],
}, },
@ -152,7 +152,7 @@ const kawulStatOrDynImperfectivePassive: T.AspectContentPassive = {
[[{p: "به کول کېدلم", f: "ba kawul kedúlum"}], [{p: "به کول کېدلو", f: "ba kawul kedúloo"}]], [[{p: "به کول کېدلم", f: "ba kawul kedúlum"}], [{p: "به کول کېدلو", f: "ba kawul kedúloo"}]],
[[{p: "به کول کېدلې", f: "ba kawul kedúle"}], [{p: "به کول کېدلئ", f: "ba kawul kedúleyy"}]], [[{p: "به کول کېدلې", f: "ba kawul kedúle"}], [{p: "به کول کېدلئ", f: "ba kawul kedúleyy"}]],
[[{p: "به کول کېدلې", f: "ba kawul kedúle"}], [{p: "به کول کېدلئ", f: "ba kawul kedúleyy"}]], [[{p: "به کول کېدلې", f: "ba kawul kedúle"}], [{p: "به کول کېدلئ", f: "ba kawul kedúleyy"}]],
[[{p: "به کول کېدله", f: "ba kawul kedúlu"}, {p: "به کول کېدلو", f: "ba kawul kedúlo"}], [{p: "به کول کېدل", f: "ba kawul kedúl"}]], [[{p: "به کول کېدلو", f: "ba kawul kedúlo"}], [{p: "به کول کېدل", f: "ba kawul kedúl"}]],
[[{p: "به کول کېدله", f: "ba kawul kedúla"}], [{p: "به کول کېدلې", f: "ba kawul kedúle"}]], [[{p: "به کول کېدله", f: "ba kawul kedúla"}], [{p: "به کول کېدلې", f: "ba kawul kedúle"}]],
], ],
}, },
@ -387,7 +387,7 @@ export const kedulStat: T.VerbConjugation = {
[[{p: "کېدلم", f: "kedúlum"}], [{p: "کېدلو", f: "kedúloo"}]], [[{p: "کېدلم", f: "kedúlum"}], [{p: "کېدلو", f: "kedúloo"}]],
[[{p: "کېدلې", f: "kedúle"}], [{p: "کېدلئ", f: "kedúleyy"}]], [[{p: "کېدلې", f: "kedúle"}], [{p: "کېدلئ", f: "kedúleyy"}]],
[[{p: "کېدلې", f: "kedúle"}], [{p: "کېدلئ", f: "kedúleyy"}]], [[{p: "کېدلې", f: "kedúle"}], [{p: "کېدلئ", f: "kedúleyy"}]],
[[{p: "کېدله", f: "kedúlu"}, {p: "کېدلو", f: "kedúlo"}], [{p: "کېدل", f: "kedúl"}]], [[{p: "کېدلو", f: "kedúlo"}], [{p: "کېدل", f: "kedúl"}]],
[[{p: "کېدله", f: "kedúla"}], [{p: "کېدلې", f: "kedúle"}]], [[{p: "کېدله", f: "kedúla"}], [{p: "کېدلې", f: "kedúle"}]],
], ],
}, },
@ -405,7 +405,7 @@ export const kedulStat: T.VerbConjugation = {
[[{p: "به کېدلم", f: "ba kedúlum"}], [{p: "به کېدلو", f: "ba kedúloo"}]], [[{p: "به کېدلم", f: "ba kedúlum"}], [{p: "به کېدلو", f: "ba kedúloo"}]],
[[{p: "به کېدلې", f: "ba kedúle"}], [{p: "به کېدلئ", f: "ba kedúleyy"}]], [[{p: "به کېدلې", f: "ba kedúle"}], [{p: "به کېدلئ", f: "ba kedúleyy"}]],
[[{p: "به کېدلې", f: "ba kedúle"}], [{p: "به کېدلئ", f: "ba kedúleyy"}]], [[{p: "به کېدلې", f: "ba kedúle"}], [{p: "به کېدلئ", f: "ba kedúleyy"}]],
[[{p: "به کېدله", f: "ba kedúlu"}, {p: "به کېدلو", f: "ba kedúlo"}], [{p: "به کېدل", f: "ba kedúl"}]], [[{p: "به کېدلو", f: "ba kedúlo"}], [{p: "به کېدل", f: "ba kedúl"}]],
[[{p: "به کېدله", f: "ba kedúla"}], [{p: "به کېدلې", f: "ba kedúle"}]], [[{p: "به کېدله", f: "ba kedúla"}], [{p: "به کېدلې", f: "ba kedúle"}]],
], ],
}, },
@ -657,7 +657,7 @@ export const kedulDyn: T.VerbConjugation = {
[[{p: "کېدلم", f: "kedúlum"}], [{p: "کېدلو", f: "kedúloo"}]], [[{p: "کېدلم", f: "kedúlum"}], [{p: "کېدلو", f: "kedúloo"}]],
[[{p: "کېدلې", f: "kedúle"}], [{p: "کېدلئ", f: "kedúleyy"}]], [[{p: "کېدلې", f: "kedúle"}], [{p: "کېدلئ", f: "kedúleyy"}]],
[[{p: "کېدلې", f: "kedúle"}], [{p: "کېدلئ", f: "kedúleyy"}]], [[{p: "کېدلې", f: "kedúle"}], [{p: "کېدلئ", f: "kedúleyy"}]],
[[{p: "کېدله", f: "kedúlu"}, {p: "کېدلو", f: "kedúlo"}], [{p: "کېدل", f: "kedúl"}]], [[{p: "کېدلو", f: "kedúlo"}], [{p: "کېدل", f: "kedúl"}]],
[[{p: "کېدله", f: "kedúla"}], [{p: "کېدلې", f: "kedúle"}]], [[{p: "کېدله", f: "kedúla"}], [{p: "کېدلې", f: "kedúle"}]],
], ],
}, },
@ -675,7 +675,7 @@ export const kedulDyn: T.VerbConjugation = {
[[{p: "به کېدلم", f: "ba kedúlum"}], [{p: "به کېدلو", f: "ba kedúloo"}]], [[{p: "به کېدلم", f: "ba kedúlum"}], [{p: "به کېدلو", f: "ba kedúloo"}]],
[[{p: "به کېدلې", f: "ba kedúle"}], [{p: "به کېدلئ", f: "ba kedúleyy"}]], [[{p: "به کېدلې", f: "ba kedúle"}], [{p: "به کېدلئ", f: "ba kedúleyy"}]],
[[{p: "به کېدلې", f: "ba kedúle"}], [{p: "به کېدلئ", f: "ba kedúleyy"}]], [[{p: "به کېدلې", f: "ba kedúle"}], [{p: "به کېدلئ", f: "ba kedúleyy"}]],
[[{p: "به کېدله", f: "ba kedúlu"}, {p: "به کېدلو", f: "ba kedúlo"}], [{p: "به کېدل", f: "ba kedúl"}]], [[{p: "به کېدلو", f: "ba kedúlo"}], [{p: "به کېدل", f: "ba kedúl"}]],
[[{p: "به کېدله", f: "ba kedúla"}], [{p: "به کېدلې", f: "ba kedúle"}]], [[{p: "به کېدله", f: "ba kedúla"}], [{p: "به کېدلې", f: "ba kedúle"}]],
], ],
}, },
@ -1210,7 +1210,7 @@ export const kawulStat: T.VerbConjugation = {
[[{p: "کړلم", f: "kRulum"}], [{p: "کړلو", f: "kRuloo"}]], [[{p: "کړلم", f: "kRulum"}], [{p: "کړلو", f: "kRuloo"}]],
[[{p: "کړلې", f: "kRule"}], [{p: "کړلئ", f: "kRuleyy"}]], [[{p: "کړلې", f: "kRule"}], [{p: "کړلئ", f: "kRuleyy"}]],
[[{p: "کړلې", f: "kRule"}], [{p: "کړلئ", f: "kRuleyy"}]], [[{p: "کړلې", f: "kRule"}], [{p: "کړلئ", f: "kRuleyy"}]],
[[{p: "کړله", f: "kRulu"}, {p: "کړلو", f: "kRulo"}], [{p: "کړل", f: "kRul"}, {p: "کړلو", f: "kRuloo"}]], [[{p: "کړلو", f: "kRulo"}], [{p: "کړل", f: "kRul"}, {p: "کړلو", f: "kRuloo"}]],
[[{p: "کړله", f: "kRula"}], [{p: "کړلې", f: "kRule"}]], [[{p: "کړله", f: "kRula"}], [{p: "کړلې", f: "kRule"}]],
], ],
}, },
@ -1236,7 +1236,7 @@ export const kawulStat: T.VerbConjugation = {
[[{p: "به کړلم", f: "ba kRulum"}], [{p: "به کړلو", f: "ba kRuloo"}]], [[{p: "به کړلم", f: "ba kRulum"}], [{p: "به کړلو", f: "ba kRuloo"}]],
[[{p: "به کړلې", f: "ba kRule"}], [{p: "به کړلئ", f: "ba kRuleyy"}]], [[{p: "به کړلې", f: "ba kRule"}], [{p: "به کړلئ", f: "ba kRuleyy"}]],
[[{p: "به کړلې", f: "ba kRule"}], [{p: "به کړلئ", f: "ba kRuleyy"}]], [[{p: "به کړلې", f: "ba kRule"}], [{p: "به کړلئ", f: "ba kRuleyy"}]],
[[{p: "به کړله", f: "ba kRulu"}, {p: "به کړلو", f: "ba kRulo"}], [{p: "به کړل", f: "ba kRul"}, {p: "به کړلو", f: "ba kRuloo"}]], [[{p: "به کړلو", f: "ba kRulo"}], [{p: "به کړل", f: "ba kRul"}, {p: "به کړلو", f: "ba kRuloo"}]],
[[{p: "به کړله", f: "ba kRula"}], [{p: "به کړلې", f: "ba kRule"}]], [[{p: "به کړله", f: "ba kRula"}], [{p: "به کړلې", f: "ba kRule"}]],
], ],
}, },
@ -1688,7 +1688,7 @@ export const kawulDyn: T.VerbConjugation = {
[[{p: "وکړلم", f: "óokRulum"}], [{p: "وکړلو", f: "óokRuloo"}]], [[{p: "وکړلم", f: "óokRulum"}], [{p: "وکړلو", f: "óokRuloo"}]],
[[{p: "وکړلې", f: "óokRule"}], [{p: "وکړلئ", f: "óokRuleyy"}]], [[{p: "وکړلې", f: "óokRule"}], [{p: "وکړلئ", f: "óokRuleyy"}]],
[[{p: "وکړلې", f: "óokRule"}], [{p: "وکړلئ", f: "óokRuleyy"}]], [[{p: "وکړلې", f: "óokRule"}], [{p: "وکړلئ", f: "óokRuleyy"}]],
[[{p: "وکړله", f: "óokRulu"}, {p: "وکړلو", f: "óokRulo"}], [{p: "وکړل", f: "óokRul"}, {p: "وکړلو", f: "óokRuloo"}]], [[{p: "وکړلو", f: "óokRulo"}], [{p: "وکړل", f: "óokRul"}, {p: "وکړلو", f: "óokRuloo"}]],
[[{p: "وکړله", f: "óokRula"}], [{p: "وکړلې", f: "óokRule"}]], [[{p: "وکړله", f: "óokRula"}], [{p: "وکړلې", f: "óokRule"}]],
], ],
}, },
@ -1714,7 +1714,7 @@ export const kawulDyn: T.VerbConjugation = {
[[{p: "به وکړلم", f: "ba óokRulum"}], [{p: "به وکړلو", f: "ba óokRuloo"}]], [[{p: "به وکړلم", f: "ba óokRulum"}], [{p: "به وکړلو", f: "ba óokRuloo"}]],
[[{p: "به وکړلې", f: "ba óokRule"}], [{p: "به وکړلئ", f: "ba óokRuleyy"}]], [[{p: "به وکړلې", f: "ba óokRule"}], [{p: "به وکړلئ", f: "ba óokRuleyy"}]],
[[{p: "به وکړلې", f: "ba óokRule"}], [{p: "به وکړلئ", f: "ba óokRuleyy"}]], [[{p: "به وکړلې", f: "ba óokRule"}], [{p: "به وکړلئ", f: "ba óokRuleyy"}]],
[[{p: "به وکړله", f: "ba óokRulu"}, {p: "به وکړلو", f: "ba óokRulo"}], [{p: "به وکړل", f: "ba óokRul"}, {p: "به وکړلو", f: "ba óokRuloo"}]], [[{p: "به وکړلو", f: "ba óokRulo"}], [{p: "به وکړل", f: "ba óokRul"}, {p: "به وکړلو", f: "ba óokRuloo"}]],
[[{p: "به وکړله", f: "ba óokRula"}], [{p: "به وکړلې", f: "ba óokRule"}]], [[{p: "به وکړله", f: "ba óokRula"}], [{p: "به وکړلې", f: "ba óokRule"}]],
], ],
}, },
@ -4705,7 +4705,7 @@ export const tlul: T.VerbConjugation = {
[[{p: "تللم", f: "tlulum"}], [{p: "تللو", f: "tluloo"}]], [[{p: "تللم", f: "tlulum"}], [{p: "تللو", f: "tluloo"}]],
[[{p: "تللې", f: "tlule"}], [{p: "تللئ", f: "tluleyy"}]], [[{p: "تللې", f: "tlule"}], [{p: "تللئ", f: "tluleyy"}]],
[[{p: "تللې", f: "tlule"}], [{p: "تللئ", f: "tluleyy"}]], [[{p: "تللې", f: "tlule"}], [{p: "تللئ", f: "tluleyy"}]],
[[{p: "تلله", f: "tlulu"}, {p: "تللو", f: "tlulo"}], [{p: "تلل", f: "tlul"}]], [[{p: "تللو", f: "tlulo"}], [{p: "تلل", f: "tlul"}]],
[[{p: "تلله", f: "tlula"}], [{p: "تللې", f: "tlule"}]], [[{p: "تلله", f: "tlula"}], [{p: "تللې", f: "tlule"}]],
], ],
}, },
@ -4723,7 +4723,7 @@ export const tlul: T.VerbConjugation = {
[[{p: "به تللم", f: "ba tlulum"}], [{p: "به تللو", f: "ba tluloo"}]], [[{p: "به تللم", f: "ba tlulum"}], [{p: "به تللو", f: "ba tluloo"}]],
[[{p: "به تللې", f: "ba tlule"}], [{p: "به تللئ", f: "ba tluleyy"}]], [[{p: "به تللې", f: "ba tlule"}], [{p: "به تللئ", f: "ba tluleyy"}]],
[[{p: "به تللې", f: "ba tlule"}], [{p: "به تللئ", f: "ba tluleyy"}]], [[{p: "به تللې", f: "ba tlule"}], [{p: "به تللئ", f: "ba tluleyy"}]],
[[{p: "به تلله", f: "ba tlulu"}, {p: "به تللو", f: "ba tlulo"}], [{p: "به تلل", f: "ba tlul"}]], [[{p: "به تللو", f: "ba tlulo"}], [{p: "به تلل", f: "ba tlul"}]],
[[{p: "به تلله", f: "ba tlula"}], [{p: "به تللې", f: "ba tlule"}]], [[{p: "به تلله", f: "ba tlula"}], [{p: "به تللې", f: "ba tlule"}]],
], ],
}, },
@ -5281,7 +5281,7 @@ export const warkawul: T.VerbConjugation = {
[[{p: "ورکړلم", f: "wărkRulum"}], [{p: "ورکړلو", f: "wărkRuloo"}]], [[{p: "ورکړلم", f: "wărkRulum"}], [{p: "ورکړلو", f: "wărkRuloo"}]],
[[{p: "ورکړلې", f: "wărkRule"}], [{p: "ورکړلئ", f: "wărkRuleyy"}]], [[{p: "ورکړلې", f: "wărkRule"}], [{p: "ورکړلئ", f: "wărkRuleyy"}]],
[[{p: "ورکړلې", f: "wărkRule"}], [{p: "ورکړلئ", f: "wărkRuleyy"}]], [[{p: "ورکړلې", f: "wărkRule"}], [{p: "ورکړلئ", f: "wărkRuleyy"}]],
[[{p: "ورکړله", f: "wărkRulu"}, {p: "ورکړلو", f: "wărkRulo"}], [{p: "ورکړل", f: "wărkRul"}, {p: "ورکړلو", f: "wărkRuloo"}]], [[{p: "ورکړلو", f: "wărkRulo"}], [{p: "ورکړل", f: "wărkRul"}, {p: "ورکړلو", f: "wărkRuloo"}]],
[[{p: "ورکړله", f: "wărkRula"}], [{p: "ورکړلې", f: "wărkRule"}]], [[{p: "ورکړله", f: "wărkRula"}], [{p: "ورکړلې", f: "wărkRule"}]],
], ],
}, },
@ -5307,7 +5307,7 @@ export const warkawul: T.VerbConjugation = {
[[{p: "به ورکړلم", f: "ba wărkRulum"}], [{p: "به ورکړلو", f: "ba wărkRuloo"}]], [[{p: "به ورکړلم", f: "ba wărkRulum"}], [{p: "به ورکړلو", f: "ba wărkRuloo"}]],
[[{p: "به ورکړلې", f: "ba wărkRule"}], [{p: "به ورکړلئ", f: "ba wărkRuleyy"}]], [[{p: "به ورکړلې", f: "ba wărkRule"}], [{p: "به ورکړلئ", f: "ba wărkRuleyy"}]],
[[{p: "به ورکړلې", f: "ba wărkRule"}], [{p: "به ورکړلئ", f: "ba wărkRuleyy"}]], [[{p: "به ورکړلې", f: "ba wărkRule"}], [{p: "به ورکړلئ", f: "ba wărkRuleyy"}]],
[[{p: "به ورکړله", f: "ba wărkRulu"}, {p: "به ورکړلو", f: "ba wărkRulo"}], [{p: "به ورکړل", f: "ba wărkRul"}, {p: "به ورکړلو", f: "ba wărkRuloo"}]], [[{p: "به ورکړلو", f: "ba wărkRulo"}], [{p: "به ورکړل", f: "ba wărkRul"}, {p: "به ورکړلو", f: "ba wărkRuloo"}]],
[[{p: "به ورکړله", f: "ba wărkRula"}], [{p: "به ورکړلې", f: "ba wărkRule"}]], [[{p: "به ورکړله", f: "ba wărkRula"}], [{p: "به ورکړلې", f: "ba wărkRule"}]],
], ],
}, },
@ -5969,7 +5969,7 @@ export const raakawul: T.VerbConjugation = {
[[{p: "راکړلم", f: "raakRulum"}], [{p: "راکړلو", f: "raakRuloo"}]], [[{p: "راکړلم", f: "raakRulum"}], [{p: "راکړلو", f: "raakRuloo"}]],
[[{p: "راکړلې", f: "raakRule"}], [{p: "راکړلئ", f: "raakRuleyy"}]], [[{p: "راکړلې", f: "raakRule"}], [{p: "راکړلئ", f: "raakRuleyy"}]],
[[{p: "راکړلې", f: "raakRule"}], [{p: "راکړلئ", f: "raakRuleyy"}]], [[{p: "راکړلې", f: "raakRule"}], [{p: "راکړلئ", f: "raakRuleyy"}]],
[[{p: "راکړله", f: "raakRulu"}, {p: "راکړلو", f: "raakRulo"}], [{p: "راکړل", f: "raakRul"}, {p: "راکړلو", f: "raakRuloo"}]], [[{p: "راکړلو", f: "raakRulo"}], [{p: "راکړل", f: "raakRul"}, {p: "راکړلو", f: "raakRuloo"}]],
[[{p: "راکړله", f: "raakRula"}], [{p: "راکړلې", f: "raakRule"}]], [[{p: "راکړله", f: "raakRula"}], [{p: "راکړلې", f: "raakRule"}]],
], ],
}, },
@ -5995,7 +5995,7 @@ export const raakawul: T.VerbConjugation = {
[[{p: "به راکړلم", f: "ba raakRulum"}], [{p: "به راکړلو", f: "ba raakRuloo"}]], [[{p: "به راکړلم", f: "ba raakRulum"}], [{p: "به راکړلو", f: "ba raakRuloo"}]],
[[{p: "به راکړلې", f: "ba raakRule"}], [{p: "به راکړلئ", f: "ba raakRuleyy"}]], [[{p: "به راکړلې", f: "ba raakRule"}], [{p: "به راکړلئ", f: "ba raakRuleyy"}]],
[[{p: "به راکړلې", f: "ba raakRule"}], [{p: "به راکړلئ", f: "ba raakRuleyy"}]], [[{p: "به راکړلې", f: "ba raakRule"}], [{p: "به راکړلئ", f: "ba raakRuleyy"}]],
[[{p: "به راکړله", f: "ba raakRulu"}, {p: "به راکړلو", f: "ba raakRulo"}], [{p: "به راکړل", f: "ba raakRul"}, {p: "به راکړلو", f: "ba raakRuloo"}]], [[{p: "به راکړلو", f: "ba raakRulo"}], [{p: "به راکړل", f: "ba raakRul"}, {p: "به راکړلو", f: "ba raakRuloo"}]],
[[{p: "به راکړله", f: "ba raakRula"}], [{p: "به راکړلې", f: "ba raakRule"}]], [[{p: "به راکړله", f: "ba raakRula"}], [{p: "به راکړلې", f: "ba raakRule"}]],
], ],
}, },
@ -6657,7 +6657,7 @@ export const darkawul: T.VerbConjugation = {
[[{p: "درکړلم", f: "dărkRulum"}], [{p: "درکړلو", f: "dărkRuloo"}]], [[{p: "درکړلم", f: "dărkRulum"}], [{p: "درکړلو", f: "dărkRuloo"}]],
[[{p: "درکړلې", f: "dărkRule"}], [{p: "درکړلئ", f: "dărkRuleyy"}]], [[{p: "درکړلې", f: "dărkRule"}], [{p: "درکړلئ", f: "dărkRuleyy"}]],
[[{p: "درکړلې", f: "dărkRule"}], [{p: "درکړلئ", f: "dărkRuleyy"}]], [[{p: "درکړلې", f: "dărkRule"}], [{p: "درکړلئ", f: "dărkRuleyy"}]],
[[{p: "درکړله", f: "dărkRulu"}, {p: "درکړلو", f: "dărkRulo"}], [{p: "درکړل", f: "dărkRul"}, {p: "درکړلو", f: "dărkRuloo"}]], [[{p: "درکړلو", f: "dărkRulo"}], [{p: "درکړل", f: "dărkRul"}, {p: "درکړلو", f: "dărkRuloo"}]],
[[{p: "درکړله", f: "dărkRula"}], [{p: "درکړلې", f: "dărkRule"}]], [[{p: "درکړله", f: "dărkRula"}], [{p: "درکړلې", f: "dărkRule"}]],
], ],
}, },
@ -6683,7 +6683,7 @@ export const darkawul: T.VerbConjugation = {
[[{p: "به درکړلم", f: "ba dărkRulum"}], [{p: "به درکړلو", f: "ba dărkRuloo"}]], [[{p: "به درکړلم", f: "ba dărkRulum"}], [{p: "به درکړلو", f: "ba dărkRuloo"}]],
[[{p: "به درکړلې", f: "ba dărkRule"}], [{p: "به درکړلئ", f: "ba dărkRuleyy"}]], [[{p: "به درکړلې", f: "ba dărkRule"}], [{p: "به درکړلئ", f: "ba dărkRuleyy"}]],
[[{p: "به درکړلې", f: "ba dărkRule"}], [{p: "به درکړلئ", f: "ba dărkRuleyy"}]], [[{p: "به درکړلې", f: "ba dărkRule"}], [{p: "به درکړلئ", f: "ba dărkRuleyy"}]],
[[{p: "به درکړله", f: "ba dărkRulu"}, {p: "به درکړلو", f: "ba dărkRulo"}], [{p: "به درکړل", f: "ba dărkRul"}, {p: "به درکړلو", f: "ba dărkRuloo"}]], [[{p: "به درکړلو", f: "ba dărkRulo"}], [{p: "به درکړل", f: "ba dărkRul"}, {p: "به درکړلو", f: "ba dărkRuloo"}]],
[[{p: "به درکړله", f: "ba dărkRula"}], [{p: "به درکړلې", f: "ba dărkRule"}]], [[{p: "به درکړله", f: "ba dărkRula"}], [{p: "به درکړلې", f: "ba dărkRule"}]],
], ],
}, },

View File

@ -119,8 +119,8 @@ export function getComplementFromBlocks(blocks: T.Block[][]): T.Rendered<T.Compl
} }
// maybe there's a complement in the verb block // maybe there's a complement in the verb block
const verb = getVerbFromBlocks(blocks); const verb = getVerbFromBlocks(blocks);
if (verb?.block.complement) { if (verb?.block.complementWelded) {
return verb.block.complement; return verb.block.complementWelded;
} }
return undefined; return undefined;
} }

View File

@ -11,7 +11,7 @@ import {
import { getEnglishFromRendered, getPashtoFromRendered } from "./np-tools"; import { getEnglishFromRendered, getPashtoFromRendered } from "./np-tools";
import { completeEPSelection, renderEP } from "./render-ep"; import { completeEPSelection, renderEP } from "./render-ep";
import { completeVPSelection } from "./vp-tools"; import { completeVPSelection } from "./vp-tools";
import { renderVP } from "./render-vp"; import { isStativeHelper, renderVP } from "./render-vp";
import { import {
getAPsFromBlocks, getAPsFromBlocks,
getComplementFromBlocks, getComplementFromBlocks,
@ -206,10 +206,6 @@ function getPsFromPiece(piece: T.Block | T.Kid, subjectPerson: T.Person): T.PsSt
if (piece.block.type === "perfectiveHead") { if (piece.block.type === "perfectiveHead") {
return [piece.block.ps]; return [piece.block.ps];
} }
if (piece.block.type === "verbComplement") {
// TODO: WHAAAAT
return [{ p: "____", f: "____"}]; //getPashtoFromRendered(piece.block.complement);
}
if (piece.block.type === "objectSelection") { if (piece.block.type === "objectSelection") {
if (typeof piece.block.selection !== "object") { if (typeof piece.block.selection !== "object") {
return [{ p: "", f: "" }]; return [{ p: "", f: "" }];
@ -219,16 +215,16 @@ function getPsFromPiece(piece: T.Block | T.Kid, subjectPerson: T.Person): T.PsSt
if (piece.block.type === "verb") { if (piece.block.type === "verb") {
// getLong is just for type safety - we will have split up the length options earlier in compileVPPs // getLong is just for type safety - we will have split up the length options earlier in compileVPPs
const verbPs = getLong(piece.block.block.ps); const verbPs = getLong(piece.block.block.ps);
if (piece.block.block.complement) { if (piece.block.block.complementWelded) {
return combineComplementWVerbPs(piece.block.block.complement, verbPs); return combineComplementWVerbPs(piece.block.block.complementWelded, verbPs);
} }
return verbPs; return verbPs;
} }
if (piece.block.type === "perfectParticipleBlock") { if (piece.block.type === "perfectParticipleBlock") {
// getLong is just for type safety - we will have split up the length options earlier in compileVPPs // getLong is just for type safety - we will have split up the length options earlier in compileVPPs
const verbPs = getLong(piece.block.ps); const verbPs = getLong(piece.block.ps);
if (piece.block.complement) { if (piece.block.complementWelded) {
return combineComplementWVerbPs(piece.block.complement, verbPs); return combineComplementWVerbPs(piece.block.complementWelded, verbPs);
} }
return verbPs; return verbPs;
} }
@ -310,8 +306,10 @@ function compileEnglishVP(VP: T.VPRendered): string[] | undefined {
return e return e
.replace("$SUBJ", subject) .replace("$SUBJ", subject)
.replace("$OBJ", object || "") .replace("$OBJ", object || "")
// TODO: check if this always works // add the complement in English if it's an external complement from a helper verb (kawul/kedul)
+ (complement ? ` ${complement}` : "") + ((complement && isStativeHelper(getVerbFromBlocks(VP.blocks).block.verb))
? ` ${complement}`
: "")
+ APs; + APs;
} }
const engSubj = getSubjectSelectionFromBlocks(VP.blocks).selection; const engSubj = getSubjectSelectionFromBlocks(VP.blocks).selection;

View File

@ -1,4 +1,6 @@
import * as T from "../../types"; import * as T from "../../types";
import { getEnglishWord } from "../get-english-word";
import { psStringFromEntry } from "../p-text-helpers";
import { renderAdverbSelection } from "./render-ep"; import { renderAdverbSelection } from "./render-ep";
import { renderSandwich } from "./render-sandwich"; import { renderSandwich } from "./render-sandwich";
@ -14,3 +16,20 @@ export function renderAPSelection({ selection }: T.APSelection): T.Rendered<T.AP
selection: renderAdverbSelection(selection), selection: renderAdverbSelection(selection),
}; };
} }
export function renderLocativeAdverbSelection({ entry }: T.LocativeAdverbSelection): T.Rendered<T.LocativeAdverbSelection> {
const e = getEnglishWord(entry);
if (!e || typeof e !== "string") {
throw new Error("error getting english for compliment");
}
return {
type: "loc. adv.",
entry: entry,
ps: [psStringFromEntry(entry)],
e,
inflected: false,
// TODO: don't use persons for these
person: T.Person.FirstSingMale,
role: "none",
};
}

View File

@ -1,9 +1,8 @@
import * as T from "../../types"; import * as T from "../../types";
import { renderNounSelection } from "./render-np"; import { renderNounSelection } from "./render-np";
import { getEnglishWord } from "../get-english-word";
import { psStringFromEntry } from "../p-text-helpers";
import { renderAdjectiveSelection } from "./render-adj"; import { renderAdjectiveSelection } from "./render-adj";
import { renderSandwich } from "./render-sandwich"; import { renderSandwich } from "./render-sandwich";
import { renderLocativeAdverbSelection } from "./render-ap";
export function renderComplementSelection(s: T.ComplementSelection | T.UnselectedComplementSelection, person: T.Person): T.Rendered<T.ComplementSelection | T.UnselectedComplementSelection> { export function renderComplementSelection(s: T.ComplementSelection | T.UnselectedComplementSelection, person: T.Person): T.Rendered<T.ComplementSelection | T.UnselectedComplementSelection> {
if (s.selection.type === "unselected") { if (s.selection.type === "unselected") {
@ -22,23 +21,10 @@ export function renderComplementSelection(s: T.ComplementSelection | T.Unselecte
selection: renderSandwich(s.selection), selection: renderSandwich(s.selection),
}; };
} }
const e = getEnglishWord(s.selection.entry);
if (!e || typeof e !== "string") {
throw new Error("error getting english for compliment");
}
if (s.selection.type === "loc. adv.") { if (s.selection.type === "loc. adv.") {
return { return {
type: "complement", type: "complement",
selection: { selection: renderLocativeAdverbSelection(s.selection),
type: "loc. adv.",
entry: s.selection.entry,
ps: [psStringFromEntry(s.selection.entry)],
e,
inflected: false,
// TODO: don't use persons for these
person,
role: "none",
},
}; };
} }
if (s.selection.type === "adjective") { if (s.selection.type === "adjective") {
@ -50,6 +36,6 @@ export function renderComplementSelection(s: T.ComplementSelection | T.Unselecte
// if (s.selection.type === "noun") { // if (s.selection.type === "noun") {
return { return {
type: "complement", type: "complement",
selection: renderNounSelection(s.selection, false, "none"), selection: renderNounSelection(s.selection, false, "none", "noArticles"),
}; };
} }

View File

@ -46,8 +46,8 @@ export function renderNPSelection(NP: T.NPSelection, inflected: boolean, inflect
throw new Error("unknown NP type"); throw new Error("unknown NP type");
}; };
export function renderNounSelection(n: T.NounSelection, inflected: boolean, role: "servant" | "king" | "none"): T.Rendered<T.NounSelection> { export function renderNounSelection(n: T.NounSelection, inflected: boolean, role: "servant" | "king" | "none", noArticles?: true | "noArticles"): T.Rendered<T.NounSelection> {
const english = getEnglishFromNoun(n.entry, n.number); const english = getEnglishFromNoun(n.entry, n.number, noArticles);
const pashto = ((): T.PsString[] => { const pashto = ((): T.PsString[] => {
const infs = inflectWord(n.entry); const infs = inflectWord(n.entry);
const ps = n.number === "singular" const ps = n.number === "singular"
@ -129,13 +129,14 @@ function getInf(infs: T.InflectorOutput, t: "plural" | "arabicPlural" | "inflect
return []; return [];
} }
function getEnglishFromNoun(entry: T.DictionaryEntry, number: T.NounNumber): string { function getEnglishFromNoun(entry: T.DictionaryEntry, number: T.NounNumber, noArticles?: true | "noArticles"): string {
const articles = { const articles = {
singular: "(a/the)", singular: "(a/the)",
plural: "(the)", plural: "(the)",
}; };
const article = articles[number]; const article = articles[number];
function addArticle(s: string) { function addArticle(s: string) {
if (noArticles) return s;
return `${article} ${s}`; return `${article} ${s}`;
} }
const e = getEnglishWord(entry); const e = getEnglishWord(entry);

View File

@ -18,8 +18,11 @@ import {
getTenseVerbForm, getTenseVerbForm,
} from "./vp-tools"; } from "./vp-tools";
import { import {
isAdjectiveEntry,
isImperativeTense, isImperativeTense,
isLocativeAdverbEntry,
isModalTense, isModalTense,
isNounEntry,
isPattern4Entry, isPattern4Entry,
isPerfectTense, isPerfectTense,
} from "../type-predicates"; } from "../type-predicates";
@ -30,8 +33,7 @@ import { findPerfectiveHead, getObjectSelection, getSubjectSelection, makeBlock,
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 { makeNounSelection } from "../../library";
// TODO: ISSUE GETTING SPLIT HEAD NOT MATCHING WITH FUTURE VERBS
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;
@ -421,7 +423,15 @@ function renderVerbSelection(vs: T.VerbSelectionComplete, person: T.Person, comp
: conjugations; : conjugations;
const { ps: { head, rest }, hasBa } = getPsVerbConjugation(conj, vs, person, complementPerson); const { ps: { head, rest }, hasBa } = getPsVerbConjugation(conj, vs, person, complementPerson);
const perfective = isPerfective(vs.tense); const perfective = isPerfective(vs.tense);
const stativeHelper = isStativeHelper(vs.verb) const stativeHelper = isStativeHelper(vs.verb);
const complement: T.ComplementSelection | T.UnselectedComplementSelection | undefined = externalComplement
? externalComplement
: vs.isCompound === "stative"
? createComplementRetroactively(vs.verb.complement, complementPerson)
: undefined;
const renderedComplement = complement
? renderComplementSelection(complement, complementPerson || T.Person.FirstSingMale)
: undefined;
const vrb: T.VerbRenderedBlock = { const vrb: T.VerbRenderedBlock = {
type: "verb", type: "verb",
block: { block: {
@ -429,21 +439,26 @@ function renderVerbSelection(vs: T.VerbSelectionComplete, person: T.Person, comp
ps: rest, ps: rest,
person, person,
hasBa, hasBa,
complement: (!perfective && stativeHelper && externalComplement) complementWelded: ((!perfective && renderedComplement) && (
? renderComplementSelection(externalComplement, complementPerson || T.Person.FirstSingMale) // it's a stative helper (kawul/kedul) with an external complement
(stativeHelper && externalComplement)
||
// it's a stative compound with a space
(vs.verb.entry.p.includes(" "))
))
? renderedComplement
: undefined, : undefined,
}, },
}; };
const verbBlocks = [ const verbBlocks = [
...(head ? ( ...(head ? (
(!!(vs.isCompound === "stative" && vrb.block.complement)) ? [{ (!!(vs.isCompound === "stative" && renderedComplement)) ? [
type: "verbComplement", renderedComplement,
complement: head, ] : [{
} as T.VerbComplementBlock] : [{
type: "perfectiveHead", type: "perfectiveHead",
ps: head, ps: head,
} as T.PerfectiveHeadBlock] } as T.PerfectiveHeadBlock]
) : [] as [T.VerbComplementBlock] | [T.PerfectiveHeadBlock] | []), ) : [] as [T.Rendered<T.ComplementSelection>] | [T.PerfectiveHeadBlock] | []),
...(externalComplement && perfective && stativeHelper) ...(externalComplement && perfective && stativeHelper)
? [renderComplementSelection(externalComplement, complementPerson || T.Person.FirstSingMale)] ? [renderComplementSelection(externalComplement, complementPerson || T.Person.FirstSingMale)]
: [], : [],
@ -456,7 +471,43 @@ function renderVerbSelection(vs: T.VerbSelectionComplete, person: T.Person, comp
}; };
} }
function isStativeHelper(v: T.VerbEntry): boolean { function createComplementRetroactively(complement: T.DictionaryEntry | undefined, person: T.Person | undefined): T.ComplementSelection {
// This is a bit of a hack to work with the current verb conjugation system.
if (!complement) {
throw new Error("error creating complement from head - no complement in verb entry");
}
if (isNounEntry(complement)) {
return {
type: "complement",
selection: makeNounSelection(complement, undefined, undefined),
};
}
if (isAdjectiveEntry(complement)) {
if (person === undefined) {
throw new Error("there needs to be a complement person for rendering an adjective complement");
}
return {
type: "complement",
selection: {
type: "adjective",
entry: complement,
sandwich: undefined,
},
};
}
if (isLocativeAdverbEntry(complement)) {
return {
type: "complement",
selection: {
type: "loc. adv.",
entry: complement,
},
};
}
throw new Error("unsupported complement type");
}
export function isStativeHelper(v: T.VerbEntry): boolean {
if (v.entry.p === "کول" && v.entry.e.includes("make")) return true; if (v.entry.p === "کول" && v.entry.e.includes("make")) return true;
if (v.entry.p === "کېدل" && v.entry.e.includes("become")) return true; if (v.entry.p === "کېدل" && v.entry.e.includes("become")) return true;
return false; return false;
@ -472,7 +523,7 @@ function splitUpIfModal(v: T.VerbRenderedBlock): [T.VerbRenderedBlock] | [T.Moda
type: "modalVerbBlock", type: "modalVerbBlock",
ps: vrb, ps: vrb,
verb: v, verb: v,
complement: v.block.complement, complementWelded: v.block.complementWelded,
}, },
{ {
type: "modalVerbKedulPart", type: "modalVerbKedulPart",
@ -491,7 +542,7 @@ function getPerfectStuff(v: T.SingleOrLengthOpts<T.PsString[]>, vrb: T.VerbRende
ps: p, ps: p,
person: vrb.block.person, person: vrb.block.person,
verb: vrb, verb: vrb,
complement: vrb.block.complement, complementWelded: vrb.block.complementWelded,
}, },
{ {
type: "perfectEquativeBlock", type: "perfectEquativeBlock",

View File

@ -895,16 +895,13 @@ export type EntryLookupPortal<X extends VerbEntry | DictionaryEntry> = {
} }
export type EquativeBlock = { type: "equative", equative: EquativeRendered }; export type EquativeBlock = { type: "equative", equative: EquativeRendered };
export type VerbComplementBlock = {
type: "verbComplement",
complement: PsString,
};
export type PerfectParticipleBlock = { export type PerfectParticipleBlock = {
type: "perfectParticipleBlock", type: "perfectParticipleBlock",
ps: SingleOrLengthOpts<PsString[]>, ps: SingleOrLengthOpts<PsString[]>,
verb: VerbRenderedBlock, verb: VerbRenderedBlock,
person: Person, person: Person,
complement: undefined | Rendered<ComplementSelection> | Rendered<UnselectedComplementSelection>, complementWelded: undefined | Rendered<ComplementSelection> | Rendered<UnselectedComplementSelection>,
}; };
export type PerfectEquativeBlock = { export type PerfectEquativeBlock = {
type: "perfectEquativeBlock", type: "perfectEquativeBlock",
@ -915,7 +912,7 @@ export type ModalVerbBlock = {
type: "modalVerbBlock", type: "modalVerbBlock",
ps: SingleOrLengthOpts<PsString[]>, ps: SingleOrLengthOpts<PsString[]>,
verb: VerbRenderedBlock, verb: VerbRenderedBlock,
complement: undefined | Rendered<ComplementSelection> | Rendered<UnselectedComplementSelection>, complementWelded: undefined | Rendered<ComplementSelection> | Rendered<UnselectedComplementSelection>,
}; };
export type ModalVerbKedulPart = { export type ModalVerbKedulPart = {
type: "modalVerbKedulPart", type: "modalVerbKedulPart",
@ -929,7 +926,7 @@ export type VerbRenderedBlock = {
hasBa: boolean, hasBa: boolean,
ps: SingleOrLengthOpts<PsString[]>, ps: SingleOrLengthOpts<PsString[]>,
person: Person, person: Person,
complement: undefined | Rendered<ComplementSelection> | Rendered<UnselectedComplementSelection>, complementWelded: undefined | Rendered<ComplementSelection> | Rendered<UnselectedComplementSelection>,
}, },
}; };
@ -948,7 +945,6 @@ export type Block = {
| { type: "negative", imperative: boolean } | { type: "negative", imperative: boolean }
| PerfectiveHeadBlock | PerfectiveHeadBlock
| VerbRenderedBlock | VerbRenderedBlock
| VerbComplementBlock
| EquativeBlock; | EquativeBlock;
} }