better blocks for complement
This commit is contained in:
parent
c7d8b49461
commit
2aec8e1dfb
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@lingdocs/pashto-inflector",
|
||||
"version": "3.4.4",
|
||||
"version": "3.4.5",
|
||||
"author": "lingdocs.com",
|
||||
"description": "A Pashto inflection and verb conjugation engine, inculding React components for displaying Pashto text, inflections, and conjugations",
|
||||
"homepage": "https://verbs.lingdocs.com",
|
||||
|
|
|
@ -41,9 +41,6 @@ function Block({ opts, block, king, script }: {
|
|||
if (block.block.type === "perfectiveHead") {
|
||||
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") {
|
||||
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>}
|
||||
<Border>
|
||||
<>
|
||||
{(v.type === "verb" || v.type === "perfectParticipleBlock") && v.complement && <span className="mx-2">
|
||||
<ComplementBlock opts={opts} comp={v.complement.selection} script={script} inside />
|
||||
{(v.type === "verb" || v.type === "perfectParticipleBlock") && v.complementWelded && <span className="mx-2">
|
||||
<ComplementBlock opts={opts} comp={v.complementWelded.selection} script={script} inside />
|
||||
</span>}
|
||||
{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>}
|
||||
<Border>
|
||||
<>
|
||||
{v.complement && <span className="mx-2">
|
||||
<ComplementBlock opts={opts} comp={v.complement.selection} script={script} inside />
|
||||
{v.complementWelded && <span className="mx-2">
|
||||
<ComplementBlock opts={opts} comp={v.complementWelded.selection} script={script} inside />
|
||||
</span>}
|
||||
{getLength(v.ps, length)[0][script]}
|
||||
</>
|
||||
|
@ -160,20 +157,6 @@ function PerfHeadBlock({ opts, ps, script }: {
|
|||
</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 }: {
|
||||
opts: T.TextOptions,
|
||||
aux: T.ModalVerbKedulPart,
|
||||
|
@ -271,7 +254,7 @@ function ComplementBlock({ opts, comp, script, inside }: {
|
|||
<Border>
|
||||
{adj.ps[0][script]}
|
||||
</Border>
|
||||
<div>Adj.</div>
|
||||
<div>Adj. <span className="text-muted small">({getEnglishParticipleInflection(adj.person, "short")})</span></div>
|
||||
<EnglishBelow>{adj.e}</EnglishBelow>
|
||||
</div>;
|
||||
}
|
||||
|
@ -295,9 +278,7 @@ function ComplementBlock({ opts, comp, script, inside }: {
|
|||
: comp.type === "loc. adv."
|
||||
? <LocAdvBlock opts={opts} adv={comp} />
|
||||
: comp.type === "noun"
|
||||
? <Border>
|
||||
NOT DONE YET
|
||||
</Border>
|
||||
? <CompNounBlock opts={opts} noun={comp} script={script} />
|
||||
: comp.type === "unselected"
|
||||
? <div>
|
||||
<Border>
|
||||
|
@ -359,6 +340,25 @@ function Sandwich({ opts, sandwich, script }: {
|
|||
</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 }: {
|
||||
opts: T.TextOptions,
|
||||
children: T.Rendered<T.NPSelection>,
|
||||
|
|
|
@ -134,7 +134,7 @@ const kawulStatOrDynImperfectivePassive: T.AspectContentPassive = {
|
|||
[[{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ú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"}]],
|
||||
],
|
||||
},
|
||||
|
@ -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ú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"}]],
|
||||
],
|
||||
},
|
||||
|
@ -387,7 +387,7 @@ export const kedulStat: T.VerbConjugation = {
|
|||
[[{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ú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"}]],
|
||||
],
|
||||
},
|
||||
|
@ -405,7 +405,7 @@ export const kedulStat: T.VerbConjugation = {
|
|||
[[{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ú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"}]],
|
||||
],
|
||||
},
|
||||
|
@ -657,7 +657,7 @@ export const kedulDyn: T.VerbConjugation = {
|
|||
[[{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ú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"}]],
|
||||
],
|
||||
},
|
||||
|
@ -675,7 +675,7 @@ export const kedulDyn: T.VerbConjugation = {
|
|||
[[{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ú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"}]],
|
||||
],
|
||||
},
|
||||
|
@ -1210,7 +1210,7 @@ export const kawulStat: T.VerbConjugation = {
|
|||
[[{p: "کړلم", f: "kRulum"}], [{p: "کړلو", f: "kRuloo"}]],
|
||||
[[{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"}]],
|
||||
],
|
||||
},
|
||||
|
@ -1236,7 +1236,7 @@ export const kawulStat: T.VerbConjugation = {
|
|||
[[{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 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"}]],
|
||||
],
|
||||
},
|
||||
|
@ -1688,7 +1688,7 @@ export const kawulDyn: T.VerbConjugation = {
|
|||
[[{p: "وکړلم", f: "óokRulum"}], [{p: "وکړلو", f: "óokRuloo"}]],
|
||||
[[{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"}]],
|
||||
],
|
||||
},
|
||||
|
@ -1714,7 +1714,7 @@ export const kawulDyn: T.VerbConjugation = {
|
|||
[[{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 ó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"}]],
|
||||
],
|
||||
},
|
||||
|
@ -4705,7 +4705,7 @@ export const tlul: T.VerbConjugation = {
|
|||
[[{p: "تللم", f: "tlulum"}], [{p: "تللو", f: "tluloo"}]],
|
||||
[[{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"}]],
|
||||
],
|
||||
},
|
||||
|
@ -4723,7 +4723,7 @@ export const tlul: T.VerbConjugation = {
|
|||
[[{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 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"}]],
|
||||
],
|
||||
},
|
||||
|
@ -5281,7 +5281,7 @@ export const warkawul: T.VerbConjugation = {
|
|||
[[{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ă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"}]],
|
||||
],
|
||||
},
|
||||
|
@ -5307,7 +5307,7 @@ export const warkawul: T.VerbConjugation = {
|
|||
[[{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ă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"}]],
|
||||
],
|
||||
},
|
||||
|
@ -5969,7 +5969,7 @@ export const raakawul: T.VerbConjugation = {
|
|||
[[{p: "راکړلم", f: "raakRulum"}], [{p: "راکړلو", f: "raakRuloo"}]],
|
||||
[[{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"}]],
|
||||
],
|
||||
},
|
||||
|
@ -5995,7 +5995,7 @@ export const raakawul: T.VerbConjugation = {
|
|||
[[{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 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"}]],
|
||||
],
|
||||
},
|
||||
|
@ -6657,7 +6657,7 @@ export const darkawul: T.VerbConjugation = {
|
|||
[[{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ă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"}]],
|
||||
],
|
||||
},
|
||||
|
@ -6683,7 +6683,7 @@ export const darkawul: T.VerbConjugation = {
|
|||
[[{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ă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"}]],
|
||||
],
|
||||
},
|
||||
|
|
|
@ -119,8 +119,8 @@ export function getComplementFromBlocks(blocks: T.Block[][]): T.Rendered<T.Compl
|
|||
}
|
||||
// maybe there's a complement in the verb block
|
||||
const verb = getVerbFromBlocks(blocks);
|
||||
if (verb?.block.complement) {
|
||||
return verb.block.complement;
|
||||
if (verb?.block.complementWelded) {
|
||||
return verb.block.complementWelded;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import {
|
|||
import { getEnglishFromRendered, getPashtoFromRendered } from "./np-tools";
|
||||
import { completeEPSelection, renderEP } from "./render-ep";
|
||||
import { completeVPSelection } from "./vp-tools";
|
||||
import { renderVP } from "./render-vp";
|
||||
import { isStativeHelper, renderVP } from "./render-vp";
|
||||
import {
|
||||
getAPsFromBlocks,
|
||||
getComplementFromBlocks,
|
||||
|
@ -206,10 +206,6 @@ function getPsFromPiece(piece: T.Block | T.Kid, subjectPerson: T.Person): T.PsSt
|
|||
if (piece.block.type === "perfectiveHead") {
|
||||
return [piece.block.ps];
|
||||
}
|
||||
if (piece.block.type === "verbComplement") {
|
||||
// TODO: WHAAAAT
|
||||
return [{ p: "____", f: "____"}]; //getPashtoFromRendered(piece.block.complement);
|
||||
}
|
||||
if (piece.block.type === "objectSelection") {
|
||||
if (typeof piece.block.selection !== "object") {
|
||||
return [{ p: "", f: "" }];
|
||||
|
@ -219,16 +215,16 @@ function getPsFromPiece(piece: T.Block | T.Kid, subjectPerson: T.Person): T.PsSt
|
|||
if (piece.block.type === "verb") {
|
||||
// getLong is just for type safety - we will have split up the length options earlier in compileVPPs
|
||||
const verbPs = getLong(piece.block.block.ps);
|
||||
if (piece.block.block.complement) {
|
||||
return combineComplementWVerbPs(piece.block.block.complement, verbPs);
|
||||
if (piece.block.block.complementWelded) {
|
||||
return combineComplementWVerbPs(piece.block.block.complementWelded, verbPs);
|
||||
}
|
||||
return verbPs;
|
||||
}
|
||||
if (piece.block.type === "perfectParticipleBlock") {
|
||||
// getLong is just for type safety - we will have split up the length options earlier in compileVPPs
|
||||
const verbPs = getLong(piece.block.ps);
|
||||
if (piece.block.complement) {
|
||||
return combineComplementWVerbPs(piece.block.complement, verbPs);
|
||||
if (piece.block.complementWelded) {
|
||||
return combineComplementWVerbPs(piece.block.complementWelded, verbPs);
|
||||
}
|
||||
return verbPs;
|
||||
}
|
||||
|
@ -310,8 +306,10 @@ function compileEnglishVP(VP: T.VPRendered): string[] | undefined {
|
|||
return e
|
||||
.replace("$SUBJ", subject)
|
||||
.replace("$OBJ", object || "")
|
||||
// TODO: check if this always works
|
||||
+ (complement ? ` ${complement}` : "")
|
||||
// add the complement in English if it's an external complement from a helper verb (kawul/kedul)
|
||||
+ ((complement && isStativeHelper(getVerbFromBlocks(VP.blocks).block.verb))
|
||||
? ` ${complement}`
|
||||
: "")
|
||||
+ APs;
|
||||
}
|
||||
const engSubj = getSubjectSelectionFromBlocks(VP.blocks).selection;
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
import * as T from "../../types";
|
||||
import { getEnglishWord } from "../get-english-word";
|
||||
import { psStringFromEntry } from "../p-text-helpers";
|
||||
import { renderAdverbSelection } from "./render-ep";
|
||||
import { renderSandwich } from "./render-sandwich";
|
||||
|
||||
|
@ -14,3 +16,20 @@ export function renderAPSelection({ selection }: T.APSelection): T.Rendered<T.AP
|
|||
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",
|
||||
};
|
||||
}
|
|
@ -1,9 +1,8 @@
|
|||
import * as T from "../../types";
|
||||
import { renderNounSelection } from "./render-np";
|
||||
import { getEnglishWord } from "../get-english-word";
|
||||
import { psStringFromEntry } from "../p-text-helpers";
|
||||
import { renderAdjectiveSelection } from "./render-adj";
|
||||
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> {
|
||||
if (s.selection.type === "unselected") {
|
||||
|
@ -22,23 +21,10 @@ export function renderComplementSelection(s: T.ComplementSelection | T.Unselecte
|
|||
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.") {
|
||||
return {
|
||||
type: "complement",
|
||||
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",
|
||||
},
|
||||
selection: renderLocativeAdverbSelection(s.selection),
|
||||
};
|
||||
}
|
||||
if (s.selection.type === "adjective") {
|
||||
|
@ -50,6 +36,6 @@ export function renderComplementSelection(s: T.ComplementSelection | T.Unselecte
|
|||
// if (s.selection.type === "noun") {
|
||||
return {
|
||||
type: "complement",
|
||||
selection: renderNounSelection(s.selection, false, "none"),
|
||||
selection: renderNounSelection(s.selection, false, "none", "noArticles"),
|
||||
};
|
||||
}
|
|
@ -46,8 +46,8 @@ export function renderNPSelection(NP: T.NPSelection, inflected: boolean, inflect
|
|||
throw new Error("unknown NP type");
|
||||
};
|
||||
|
||||
export function renderNounSelection(n: T.NounSelection, inflected: boolean, role: "servant" | "king" | "none"): T.Rendered<T.NounSelection> {
|
||||
const english = getEnglishFromNoun(n.entry, n.number);
|
||||
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, noArticles);
|
||||
const pashto = ((): T.PsString[] => {
|
||||
const infs = inflectWord(n.entry);
|
||||
const ps = n.number === "singular"
|
||||
|
@ -129,13 +129,14 @@ function getInf(infs: T.InflectorOutput, t: "plural" | "arabicPlural" | "inflect
|
|||
return [];
|
||||
}
|
||||
|
||||
function getEnglishFromNoun(entry: T.DictionaryEntry, number: T.NounNumber): string {
|
||||
function getEnglishFromNoun(entry: T.DictionaryEntry, number: T.NounNumber, noArticles?: true | "noArticles"): string {
|
||||
const articles = {
|
||||
singular: "(a/the)",
|
||||
plural: "(the)",
|
||||
};
|
||||
const article = articles[number];
|
||||
function addArticle(s: string) {
|
||||
if (noArticles) return s;
|
||||
return `${article} ${s}`;
|
||||
}
|
||||
const e = getEnglishWord(entry);
|
||||
|
|
|
@ -18,8 +18,11 @@ import {
|
|||
getTenseVerbForm,
|
||||
} from "./vp-tools";
|
||||
import {
|
||||
isAdjectiveEntry,
|
||||
isImperativeTense,
|
||||
isLocativeAdverbEntry,
|
||||
isModalTense,
|
||||
isNounEntry,
|
||||
isPattern4Entry,
|
||||
isPerfectTense,
|
||||
} from "../type-predicates";
|
||||
|
@ -30,8 +33,7 @@ import { findPerfectiveHead, getObjectSelection, getSubjectSelection, makeBlock,
|
|||
import { renderAPSelection } from "./render-ap";
|
||||
import { findPossesivesToShrink, orderKids, getMiniPronounPs } from "./render-common";
|
||||
import { renderComplementSelection } from "./render-complement";
|
||||
|
||||
// TODO: ISSUE GETTING SPLIT HEAD NOT MATCHING WITH FUTURE VERBS
|
||||
import { makeNounSelection } from "../../library";
|
||||
|
||||
export function renderVP(VP: T.VPSelectionComplete): T.VPRendered {
|
||||
const subject = getSubjectSelection(VP.blocks).selection;
|
||||
|
@ -421,7 +423,15 @@ function renderVerbSelection(vs: T.VerbSelectionComplete, person: T.Person, comp
|
|||
: conjugations;
|
||||
const { ps: { head, rest }, hasBa } = getPsVerbConjugation(conj, vs, person, complementPerson);
|
||||
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 = {
|
||||
type: "verb",
|
||||
block: {
|
||||
|
@ -429,21 +439,26 @@ function renderVerbSelection(vs: T.VerbSelectionComplete, person: T.Person, comp
|
|||
ps: rest,
|
||||
person,
|
||||
hasBa,
|
||||
complement: (!perfective && stativeHelper && externalComplement)
|
||||
? renderComplementSelection(externalComplement, complementPerson || T.Person.FirstSingMale)
|
||||
complementWelded: ((!perfective && renderedComplement) && (
|
||||
// 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,
|
||||
},
|
||||
};
|
||||
const verbBlocks = [
|
||||
...(head ? (
|
||||
(!!(vs.isCompound === "stative" && vrb.block.complement)) ? [{
|
||||
type: "verbComplement",
|
||||
complement: head,
|
||||
} as T.VerbComplementBlock] : [{
|
||||
(!!(vs.isCompound === "stative" && renderedComplement)) ? [
|
||||
renderedComplement,
|
||||
] : [{
|
||||
type: "perfectiveHead",
|
||||
ps: head,
|
||||
} as T.PerfectiveHeadBlock]
|
||||
) : [] as [T.VerbComplementBlock] | [T.PerfectiveHeadBlock] | []),
|
||||
) : [] as [T.Rendered<T.ComplementSelection>] | [T.PerfectiveHeadBlock] | []),
|
||||
...(externalComplement && perfective && stativeHelper)
|
||||
? [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("become")) return true;
|
||||
return false;
|
||||
|
@ -472,7 +523,7 @@ function splitUpIfModal(v: T.VerbRenderedBlock): [T.VerbRenderedBlock] | [T.Moda
|
|||
type: "modalVerbBlock",
|
||||
ps: vrb,
|
||||
verb: v,
|
||||
complement: v.block.complement,
|
||||
complementWelded: v.block.complementWelded,
|
||||
},
|
||||
{
|
||||
type: "modalVerbKedulPart",
|
||||
|
@ -491,7 +542,7 @@ function getPerfectStuff(v: T.SingleOrLengthOpts<T.PsString[]>, vrb: T.VerbRende
|
|||
ps: p,
|
||||
person: vrb.block.person,
|
||||
verb: vrb,
|
||||
complement: vrb.block.complement,
|
||||
complementWelded: vrb.block.complementWelded,
|
||||
},
|
||||
{
|
||||
type: "perfectEquativeBlock",
|
||||
|
|
12
src/types.ts
12
src/types.ts
|
@ -895,16 +895,13 @@ export type EntryLookupPortal<X extends VerbEntry | DictionaryEntry> = {
|
|||
}
|
||||
|
||||
export type EquativeBlock = { type: "equative", equative: EquativeRendered };
|
||||
export type VerbComplementBlock = {
|
||||
type: "verbComplement",
|
||||
complement: PsString,
|
||||
};
|
||||
|
||||
export type PerfectParticipleBlock = {
|
||||
type: "perfectParticipleBlock",
|
||||
ps: SingleOrLengthOpts<PsString[]>,
|
||||
verb: VerbRenderedBlock,
|
||||
person: Person,
|
||||
complement: undefined | Rendered<ComplementSelection> | Rendered<UnselectedComplementSelection>,
|
||||
complementWelded: undefined | Rendered<ComplementSelection> | Rendered<UnselectedComplementSelection>,
|
||||
};
|
||||
export type PerfectEquativeBlock = {
|
||||
type: "perfectEquativeBlock",
|
||||
|
@ -915,7 +912,7 @@ export type ModalVerbBlock = {
|
|||
type: "modalVerbBlock",
|
||||
ps: SingleOrLengthOpts<PsString[]>,
|
||||
verb: VerbRenderedBlock,
|
||||
complement: undefined | Rendered<ComplementSelection> | Rendered<UnselectedComplementSelection>,
|
||||
complementWelded: undefined | Rendered<ComplementSelection> | Rendered<UnselectedComplementSelection>,
|
||||
};
|
||||
export type ModalVerbKedulPart = {
|
||||
type: "modalVerbKedulPart",
|
||||
|
@ -929,7 +926,7 @@ export type VerbRenderedBlock = {
|
|||
hasBa: boolean,
|
||||
ps: SingleOrLengthOpts<PsString[]>,
|
||||
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 }
|
||||
| PerfectiveHeadBlock
|
||||
| VerbRenderedBlock
|
||||
| VerbComplementBlock
|
||||
| EquativeBlock;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue