This commit is contained in:
parent
8ad69a0a0c
commit
41ffa90e5a
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@lingdocs/pashto-inflector",
|
"name": "@lingdocs/pashto-inflector",
|
||||||
"version": "2.4.3",
|
"version": "2.4.4",
|
||||||
"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",
|
||||||
|
|
|
@ -70,7 +70,7 @@ function NPNounPicker(props: {
|
||||||
if (!entry) {
|
if (!entry) {
|
||||||
return props.onChange(undefined);
|
return props.onChange(undefined);
|
||||||
}
|
}
|
||||||
props.onChange(makeNounSelection(entry));
|
props.onChange(makeNounSelection(entry, props.noun));
|
||||||
}
|
}
|
||||||
// function handleFilterClose() {
|
// function handleFilterClose() {
|
||||||
// setPatternFilter(undefined);
|
// setPatternFilter(undefined);
|
||||||
|
|
|
@ -96,7 +96,7 @@ export function makeSelectOption(
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function makeNounSelection(entry: T.NounEntry, dynamicComplement?: true): T.NounSelection {
|
export function makeNounSelection(entry: T.NounEntry, old: T.NounSelection | undefined, dynamicComplement?: true): T.NounSelection {
|
||||||
const number = isPluralNounEntry(entry) ? "plural" : "singular";
|
const number = isPluralNounEntry(entry) ? "plural" : "singular";
|
||||||
return {
|
return {
|
||||||
type: "noun",
|
type: "noun",
|
||||||
|
@ -105,8 +105,8 @@ export function makeNounSelection(entry: T.NounEntry, dynamicComplement?: true):
|
||||||
genderCanChange: isUnisexNounEntry(entry),
|
genderCanChange: isUnisexNounEntry(entry),
|
||||||
number,
|
number,
|
||||||
numberCanChange: number === "singular",
|
numberCanChange: number === "singular",
|
||||||
adjectives: [],
|
adjectives: (!dynamicComplement && old) ? old.adjectives : [],
|
||||||
possesor: undefined,
|
possesor: !dynamicComplement ? old?.possesor : undefined,
|
||||||
dynamicComplement,
|
dynamicComplement,
|
||||||
};
|
};
|
||||||
}
|
}
|
|
@ -66,14 +66,14 @@ function VPExplorer(props: {
|
||||||
setAlert(undefined);
|
setAlert(undefined);
|
||||||
}, 1500);
|
}, 1500);
|
||||||
}
|
}
|
||||||
// useEffect(() => {
|
useEffect(() => {
|
||||||
// const newVps = makeVPSelectionState(props.verb, vps);
|
const newVps = makeVPSelectionState(props.verb, vps);
|
||||||
// adjustVps({
|
adjustVps({
|
||||||
// type: "load vps",
|
type: "load vps",
|
||||||
// payload: newVps,
|
payload: newVps,
|
||||||
// });
|
});
|
||||||
// // eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
// }, [props.verb]);
|
}, [props.verb]);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const VPSFromUrl = getVPSFromUrl();
|
const VPSFromUrl = getVPSFromUrl();
|
||||||
console.log({ VPSFromUrl });
|
console.log({ VPSFromUrl });
|
||||||
|
@ -123,7 +123,7 @@ function VPExplorer(props: {
|
||||||
setShowShareClipped(true);
|
setShowShareClipped(true);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
setShowShareClipped(false);
|
setShowShareClipped(false);
|
||||||
}, 1000);
|
}, 1250);
|
||||||
}
|
}
|
||||||
const VPS = completeVPSelection(vps);
|
const VPS = completeVPSelection(vps);
|
||||||
const phraseIsComplete = !!VPS;
|
const phraseIsComplete = !!VPS;
|
||||||
|
@ -180,7 +180,7 @@ function VPExplorer(props: {
|
||||||
<span className="clickable" onClick={() => setShowingExplanation({ role: "servant", item: "subject" })}>{roleIcon.servant}</span>
|
<span className="clickable" onClick={() => setShowingExplanation({ role: "servant", item: "subject" })}>{roleIcon.servant}</span>
|
||||||
{` `}
|
{` `}
|
||||||
{(rendered && rendered.whatsAdjustable !== "king") &&
|
{(rendered && rendered.whatsAdjustable !== "king") &&
|
||||||
<span onClick={toggleServantShrink} className="ml-3 clickable">
|
<span onClick={toggleServantShrink} className="mx-2 clickable">
|
||||||
{!servantIsShrunk ? "🪄" : "👶"}
|
{!servantIsShrunk ? "🪄" : "👶"}
|
||||||
</span>
|
</span>
|
||||||
}
|
}
|
||||||
|
@ -211,7 +211,7 @@ function VPExplorer(props: {
|
||||||
<span className="clickable" onClick={() => setShowingExplanation({ role: "servant", item: "object" })}>{roleIcon.servant}</span>
|
<span className="clickable" onClick={() => setShowingExplanation({ role: "servant", item: "object" })}>{roleIcon.servant}</span>
|
||||||
{` `}
|
{` `}
|
||||||
{(rendered && rendered.whatsAdjustable !== "king") &&
|
{(rendered && rendered.whatsAdjustable !== "king") &&
|
||||||
<span onClick={toggleServantShrink} className="ml-3 clickable">
|
<span onClick={toggleServantShrink} className="mx-2 clickable">
|
||||||
{!servantIsShrunk ? "🪄" : "👶"}
|
{!servantIsShrunk ? "🪄" : "👶"}
|
||||||
</span>
|
</span>
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ export function makeVPSelectionState(
|
||||||
): T.VPSelectionState {
|
): T.VPSelectionState {
|
||||||
const info = getVerbInfo(verb.entry, verb.complement);
|
const info = getVerbInfo(verb.entry, verb.complement);
|
||||||
const subject = (os?.verb.voice === "passive" && info.type === "dynamic compound")
|
const subject = (os?.verb.voice === "passive" && info.type === "dynamic compound")
|
||||||
? makeNounSelection(info.objComplement.entry as T.NounEntry, true)
|
? makeNounSelection(info.objComplement.entry as T.NounEntry, undefined, true)
|
||||||
: (os?.subject || undefined);
|
: (os?.subject || undefined);
|
||||||
function getTransObjFromos() {
|
function getTransObjFromos() {
|
||||||
if (
|
if (
|
||||||
|
@ -28,7 +28,7 @@ export function makeVPSelectionState(
|
||||||
const object = (transitivity === "grammatically transitive")
|
const object = (transitivity === "grammatically transitive")
|
||||||
? T.Person.ThirdPlurMale
|
? T.Person.ThirdPlurMale
|
||||||
: (info.type === "dynamic compound" && os?.verb.voice !== "passive")
|
: (info.type === "dynamic compound" && os?.verb.voice !== "passive")
|
||||||
? makeNounSelection(info.objComplement.entry as T.NounEntry, true)
|
? makeNounSelection(info.objComplement.entry as T.NounEntry, undefined, true)
|
||||||
: (transitivity === "transitive" && os?.verb.voice !== "passive")
|
: (transitivity === "transitive" && os?.verb.voice !== "passive")
|
||||||
? getTransObjFromos()
|
? getTransObjFromos()
|
||||||
: "none";
|
: "none";
|
||||||
|
@ -79,7 +79,7 @@ export function changeStatDyn(v: T.VerbSelection, s: "dynamic" | "stative"): T.V
|
||||||
...v,
|
...v,
|
||||||
isCompound: s,
|
isCompound: s,
|
||||||
object: s === "dynamic"
|
object: s === "dynamic"
|
||||||
? makeNounSelection(info.dynamic.objComplement.entry as T.NounEntry, true)
|
? makeNounSelection(info.dynamic.objComplement.entry as T.NounEntry, undefined, true)
|
||||||
: undefined,
|
: undefined,
|
||||||
dynAuxVerb: s === "dynamic"
|
dynAuxVerb: s === "dynamic"
|
||||||
? { entry: info.dynamic.auxVerb } as T.VerbEntry
|
? { entry: info.dynamic.auxVerb } as T.VerbEntry
|
||||||
|
|
|
@ -26,6 +26,11 @@ import { completeEPSelection, renderEP } from "./render-ep";
|
||||||
import { completeVPSelection } from "./vp-tools";
|
import { completeVPSelection } from "./vp-tools";
|
||||||
import { renderVP } from "./render-vp";
|
import { renderVP } from "./render-vp";
|
||||||
|
|
||||||
|
const blank: T.PsString = {
|
||||||
|
p: "_______",
|
||||||
|
f: "_______",
|
||||||
|
};
|
||||||
|
|
||||||
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 [] };
|
||||||
|
@ -251,14 +256,14 @@ function arrangeVerbWNegative(head: T.PsString | undefined, restRaw: T.PsString[
|
||||||
|
|
||||||
|
|
||||||
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): { ps: 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): { ps: T.SingleOrLengthOpts<T.PsString[]>, e?: string[] } {
|
export function compileEP(EP: T.EPRendered, combineLengths?: true, blankOut?: { equative: boolean }): { ps: T.SingleOrLengthOpts<T.PsString[]>, e?: string[] } {
|
||||||
const { kids, NPs } = getEPSegmentsAndKids(EP);
|
const { kids, NPs } = getEPSegmentsAndKids(EP);
|
||||||
const equative = EP.equative.ps;
|
const equative = EP.equative.ps;
|
||||||
const psResult = compileEPPs({
|
const psResult = compileEPPs({
|
||||||
NPs,
|
NPs,
|
||||||
kids,
|
kids,
|
||||||
equative,
|
equative: blankOut?.equative ? [blank] : equative,
|
||||||
negative: EP.equative.negative,
|
negative: EP.equative.negative,
|
||||||
});
|
});
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -140,7 +140,7 @@ export function isPattern5Entry<T extends (T.NounEntry | T.AdjectiveEntry)>(e: T
|
||||||
return (
|
return (
|
||||||
!!(e.infap && e.infaf && e.infbp && e.infbf)
|
!!(e.infap && e.infaf && e.infbp && e.infbf)
|
||||||
&&
|
&&
|
||||||
e.infap.includes("ا")
|
e.infap.slice(-1) === "ه" && e.infap.charAt(e.infap.length - 3) === "ا"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -112,6 +112,9 @@ import {
|
||||||
splitUpSyllables,
|
splitUpSyllables,
|
||||||
countSyllables,
|
countSyllables,
|
||||||
} from "./lib/accent-helpers";
|
} from "./lib/accent-helpers";
|
||||||
|
import {
|
||||||
|
makeNounSelection,
|
||||||
|
} from "./components/np-picker/picker-tools";
|
||||||
import NPPicker from "./components/np-picker/NPPicker";
|
import NPPicker from "./components/np-picker/NPPicker";
|
||||||
import EPExplorer from "./components/ep-explorer/EPExplorer";
|
import EPExplorer from "./components/ep-explorer/EPExplorer";
|
||||||
import shuffleArray from "./lib/shuffle-array";
|
import shuffleArray from "./lib/shuffle-array";
|
||||||
|
@ -173,6 +176,7 @@ export {
|
||||||
randomSubjObj,
|
randomSubjObj,
|
||||||
shuffleArray,
|
shuffleArray,
|
||||||
personNumber,
|
personNumber,
|
||||||
|
makeNounSelection,
|
||||||
// protobuf helpers
|
// protobuf helpers
|
||||||
readDictionary,
|
readDictionary,
|
||||||
writeDictionary,
|
writeDictionary,
|
||||||
|
|
Loading…
Reference in New Issue