beta of both versions of aay tail included

This commit is contained in:
lingdocs 2021-07-24 14:43:35 +03:00
parent 7a8edbc4ce
commit beb24bc820
5 changed files with 683 additions and 809 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@lingdocs/pashto-inflector",
"version": "0.8.4",
"version": "0.8.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",

View File

@ -33,7 +33,6 @@ const VerbChoiceWarning = () => (
const stateLocalStorageName = "explorerState6";
type Difficulty = "beginner" | "advanced";
// remember to increment the stateLocalStorageName whenever changing
// the State type
type State = {
@ -45,7 +44,6 @@ type State = {
transitivitySelected: "transitive" | "grammatically transitive";
compoundComplementVersionSelected: "sing" | "plur";
showingStemsAndRoots: boolean;
difficulty: Difficulty;
formsOpened: string[];
showingFormInfo: boolean;
}
@ -56,9 +54,6 @@ type Action = {
} | {
type: "set forms opened",
payload: string,
} | {
type: "set difficulty",
payload: Difficulty,
} | {
type: "set compound complement version",
payload: "sing" | "plur",
@ -119,8 +114,6 @@ function reducer(state: State, action: Action): State {
...state,
formsOpened: applyFormOpen(action.payload, state.formsOpened),
};
case "set difficulty":
return { ...state, difficulty: action.payload };
case "set compound complement version":
return { ...state, compoundComplementVersionSelected: action.payload };
case "toggle showingStemsAndRoots":
@ -166,7 +159,6 @@ const initialState: State = {
transitivitySelected: "transitive",
mode: "chart",
compoundComplementVersionSelected: "plur",
difficulty: "beginner",
showingStemsAndRoots: false,
showingFormInfo: false,
formsOpened: [],
@ -223,9 +215,6 @@ function ConjugationViewer({ entry, complement, textOptions, showOnly, highlight
ep: entry.ep,
} : undefined;
const filterDifficulty = (f: T.DisplayForm): boolean => (
state.difficulty === "advanced" || !!showOnly || !f.advanced
);
const limitTo = !showOnly
? undefined
: Array.isArray(showOnly)
@ -234,7 +223,6 @@ function ConjugationViewer({ entry, complement, textOptions, showOnly, highlight
const forms = getForms({
conj: verbConj,
filterFunc: [
filterDifficulty,
...limitTo ? [(f: T.DisplayForm): boolean => limitTo.includes(f.label)
] : [],
],
@ -317,16 +305,6 @@ function ConjugationViewer({ entry, complement, textOptions, showOnly, highlight
/>
</div>}
{!limitTo && <>
<div className="mb-3">
<ButtonSelect
options={[
{ label: "👶 Beginner", value: "beginner" },
{ label: "🤓 Advanced", value: "advanced" },
]}
value={state.difficulty}
handleChange={(p) => dispatch({ type: "set difficulty", payload: p as Difficulty })}
/>
</div>
<div className="form-group form-check">
<input
type="checkbox"

View File

@ -193,6 +193,22 @@ const formsOfConjugation = (conj: T.VerbConjugation): T.DisplayFormItem[] => [
englishBuilder: futureEngBuilder,
explanation: "Saying something will happen as a one-time event - May also used when there is some doubt",
},
...conj.imperfective.imperative ?
[{
label: "Imperfective Imperative",
aspect: "imperfective",
form: conj.imperfective.imperative,
formula: "Imperfective Stem + Imperative Ending",
explanation: "Commanding someone/people to do something repeatedly, or in general",
} as T.DisplayForm] : [],
...conj.perfective.imperative ?
[{
label: "Perfective Imperative",
aspect: "perfective",
form: conj.perfective.imperative,
formula: "Perfective Stem + Imperative Ending",
explanation: "Commanding someone/people to do something one time",
} as T.DisplayForm] : [],
{
label: "Continuous Past",
aspect: "imperfective",
@ -222,6 +238,98 @@ const formsOfConjugation = (conj: T.VerbConjugation): T.DisplayFormItem[] => [
explanation: "Saying something happened ('I ____ed')",
past: true,
},
{
label: "Perfect",
subgroup: "perfect",
sentence: true,
content: [
{
label: "Half Perfect",
form: conj.perfect.halfPerfect,
past: true,
sentence: true,
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
`${engSubj(s)} ${engHave(s)}${n ? " not" : ""} ${v[4]}`,
]),
formula: "Past participle inflected",
secondPronounNeeded: true,
explanation: "The base of all perfect forms. Used on it's own as a sort of weaker form of the present perfect.",
},
{
label: "Past Perfect",
form: conj.perfect.past,
past: true,
sentence: true,
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
`${engSubj(s)} had${n ? " not" : ""} ${v[4]}`,
]),
formula: "Past participle inflected + Past Equative",
explanation: "Talking about events that had happened in the past, or had affected a past situation ('I had ____ed')",
reorderWithNegative: true,
},
{
label: "Present Perfect",
form: conj.perfect.present,
past: true,
sentence: true,
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
`${engSubj(s)} ${engHave(s)}${n ? " not" : ""} ${v[4]}`,
]),
formula: "Past participle inflected + Present Equative",
explanation: "Talking about that something happened in the past and it affects the present ('I have _____ed')",
reorderWithNegative: true,
},
{
label: "Subjunctive/Habitual Perfect",
form: conj.perfect.subjunctive,
past: true,
sentence: true,
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
`that ${engSubj(s, true)} will have${n ? " not" : ""} ${v[4]}`,
]),
formula: "Past participle inflected + Subjunctive/Habitual Equative",
explanation: "Talking about something that will have happened habitually, or expressing hope, desire, or judgement about an action having happened",
reorderWithNegative: true,
},
{
label: "Future/Presumptive Perfect",
form: conj.perfect.future,
advanced: true,
past: true,
sentence: true,
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
`${engSubj(s)} will${n ? " not" : ""} have ${v[4]}`,
]),
formula: "به - ba + Past participle Inflected + Future Equative",
explanation: "Talking about something that will have happened in the future, or guessing that the event will have occured presently ('I will have ____ed')",
reorderWithNegative: true,
},
{
label: "Affirmational Perfect",
form: conj.perfect.affirmational,
advanced: true,
past: true,
sentence: true,
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
`${engSubj(s)} will${n ? " not" : ""} have ${v[4]}`,
]),
explanation: "Affirming that an event will have taken place ('I will have ____ed')",
formula: "به - ba + Past Participle Inflected + Past Equative",
reorderWithNegative: true,
},
{
label: "Conterfactual/Past Subjunctive Perfect",
form: conj.perfect.pastSubjunctiveHypothetical,
advanced: true,
past: true,
sentence: true,
secondPronounNeeded: true,
explanation: "Talking about an event that would have hypothetically taken place (but didn't), or that should have taken place but didn't",
formula: "به - ba + Past Participle Inflected + Past Subjunctive / Hypothetical Equative",
reorderWithNegative: true,
},
],
},
{
label: "Modal (ability/possibility)",
subgroup: "modal",
@ -332,114 +440,6 @@ const formsOfConjugation = (conj: T.VerbConjugation): T.DisplayFormItem[] => [
},
],
},
...conj.imperfective.imperative ?
[{
label: "Imperfective Imperative",
aspect: "imperfective",
form: conj.imperfective.imperative,
formula: "Imperfective Stem + Imperative Ending",
explanation: "Commanding someone/people to do something repeatedly, or in general",
} as T.DisplayForm] : [],
...conj.perfective.imperative ?
[{
label: "Perfective Imperative",
aspect: "perfective",
form: conj.perfective.imperative,
formula: "Perfective Stem + Imperative Ending",
explanation: "Commanding someone/people to do something one time",
} as T.DisplayForm] : [],
{
label: "Perfect",
subgroup: "perfect",
sentence: true,
content: [
{
label: "Half Perfect",
form: conj.perfect.halfPerfect,
past: true,
sentence: true,
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
`${engSubj(s)} ${engHave(s)}${n ? " not" : ""} ${v[4]}`,
]),
formula: "Past participle inflected",
secondPronounNeeded: true,
explanation: "The base of all perfect forms. Used on it's own as a sort of weaker form of the present perfect.",
},
{
label: "Past Perfect",
form: conj.perfect.past,
past: true,
sentence: true,
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
`${engSubj(s)} had${n ? " not" : ""} ${v[4]}`,
]),
formula: "Past participle inflected + Past Equative",
explanation: "Talking about events that had happened in the past, or had affected a past situation ('I had ____ed')",
reorderWithNegative: true,
},
{
label: "Present Perfect",
form: conj.perfect.present,
past: true,
sentence: true,
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
`${engSubj(s)} ${engHave(s)}${n ? " not" : ""} ${v[4]}`,
]),
formula: "Past participle inflected + Present Equative",
explanation: "Talking about that something happened in the past and it affects the present ('I have _____ed')",
reorderWithNegative: true,
},
{
label: "Subjunctive/Habitual Perfect",
form: conj.perfect.subjunctive,
past: true,
sentence: true,
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
`that ${engSubj(s, true)} will have${n ? " not" : ""} ${v[4]}`,
]),
formula: "Past participle inflected + Subjunctive/Habitual Equative",
explanation: "Talking about something that will have happened habitually, or expressing hope, desire, or judgement about an action having happened",
reorderWithNegative: true,
},
{
label: "Future/Presumptive Perfect",
form: conj.perfect.future,
advanced: true,
past: true,
sentence: true,
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
`${engSubj(s)} will${n ? " not" : ""} have ${v[4]}`,
]),
formula: "به - ba + Past participle Inflected + Future Equative",
explanation: "Talking about something that will have happened in the future, or guessing that the event will have occured presently ('I will have ____ed')",
reorderWithNegative: true,
},
{
label: "Affirmational Perfect",
form: conj.perfect.affirmational,
advanced: true,
past: true,
sentence: true,
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
`${engSubj(s)} will${n ? " not" : ""} have ${v[4]}`,
]),
explanation: "Affirming that an event will have taken place ('I will have ____ed')",
formula: "به - ba + Past Participle Inflected + Past Equative",
reorderWithNegative: true,
},
{
label: "Conterfactual/Past Subjunctive Perfect",
form: conj.perfect.pastSubjunctiveHypothetical,
advanced: true,
past: true,
sentence: true,
secondPronounNeeded: true,
explanation: "Talking about an event that would have hypothetically taken place (but didn't), or that should have taken place but didn't",
formula: "به - ba + Past Participle Inflected + Past Subjunctive / Hypothetical Equative",
reorderWithNegative: true,
},
],
},
{
label: "Hypothetical/Wish",
advanced: true,

File diff suppressed because it is too large Load Diff

View File

@ -118,7 +118,7 @@ function conjugateDynamicCompound(info: T.DynamicCompoundVerbInfo): T.VerbConjug
? info.objComplement.plural
: psStringFromEntry(info.objComplement.entry);
const makeAspectContent = (aspect: T.Aspect): T.AspectContent => {
const makeModalContent = (): T.ModalContent => {
const makeDynamicModalContent = (): T.ModalContent => {
const nonImperative = addToForm([complement, " "], auxConj[aspect].modal.nonImperative);
const future = addToForm([baParticle, " "], nonImperative);
const past = addToForm([complement, " "], auxConj[aspect].modal.past);
@ -137,7 +137,7 @@ function conjugateDynamicCompound(info: T.DynamicCompoundVerbInfo): T.VerbConjug
? addToForm([complement, " "], ac.imperative)
: null;
const past = addToForm([complement, " "], auxConj[aspect].past);
const modal = makeModalContent();
const modal = makeDynamicModalContent();
return {
nonImperative,
future,
@ -228,10 +228,10 @@ function makeJoinedModalContent(info: T.NonComboVerbInfo, aspectIn: T.Aspect): T
const aspect: T.Aspect = noPerfectiveModal(info) ? "imperfective" : aspectIn;
const aux = stativeAux.intransitive.perfective;
const rAndT = info.yulEnding
? concatPsString(noPersInfs(info.root[aspect]).long, aayTail[1])
: concatPsString(noPersInfs(info.root[aspect]), aayTail[1]);
? [concatPsString(noPersInfs(info.root[aspect]).long, aayTail[1]), concatPsString(noPersInfs(info.root[aspect]).long, aayTail[0])]
: [concatPsString(noPersInfs(info.root[aspect]), aayTail[1]), concatPsString(noPersInfs(info.root[aspect]), aayTail[0])]
const rootAndTail = aspect === "imperfective"
? accentImperfectiveModalRootAndTail(info, rAndT)
? rAndT.map((x: T.PsString | T.LengthOptions<T.PsString>) => accentImperfectiveModalRootAndTail(info, x))
: rAndT;
const nonImperative = addToForm([rootAndTail, " "], aux.nonImperative);
@ -241,7 +241,31 @@ function makeJoinedModalContent(info: T.NonComboVerbInfo, aspectIn: T.Aspect): T
// @ts-ignore
aux.past.short,
);
const hypotheticalPast = addToForm([rootAndTail, " ", { p: "شو", f: "shw" }, aayTail], emptyVerbBlock);
function mhp(rt: T.PsString[]): T.VerbBlock {
const form = [
concatPsString(rt[0], " ", { p: "سو", f: "shw" }, aayTail[0]),
concatPsString(rt[0], " ", { p: "سو", f: "shw" }, aayTail[1]),
concatPsString(rt[1], " ", { p: "سو", f: "shw" }, aayTail[0]),
] as T.ArrayOneOrMore<T.PsString>;
return [
[form, form],
[form, form],
[form, form],
[form, form],
[form, form],
[form, form],
];
}
const hypotheticalPast = "short" in rootAndTail[0]
? {
short: mhp(rootAndTail.map((rt) => "short" in rt ? rt.short : rt)),
long: mhp(rootAndTail.map((rt) => "short" in rt ? rt.long : rt)),
} : mhp(rootAndTail.map((rt) => "short" in rt ? rt.long : rt));
// const hypotheticalPast = [
// [concatPsString(rootAndTail[0], " ", { p: "سو", f: "shw" }, aayTail[0])]
// ]
// const hypotheticalPast = addToForm([rootAndTail, " ", { p: "شو", f: "shw" }, aayTail[0]], emptyVerbBlock);
return {
nonImperative, // ROOT + aayTail + kedulStat subjunctive
future, // به - ba + modal nonImperative
@ -324,12 +348,26 @@ function makeHypotheticalContent(info: T.NonComboVerbInfo): T.VerbForm {
),
];
};
const hyp = {
short: makeHypothetical(info.root.imperfective, "short"),
long: makeHypothetical(info.root.imperfective, "long"),
const short = makeHypothetical(info.root.imperfective, "short") as T.ArrayOneOrMore<T.PsString>;
const long = makeHypothetical(info.root.imperfective, "long") as T.ArrayOneOrMore<T.PsString>;
return {
short: [
[short, short],
[short, short],
[short, short],
[short, short],
[short, short],
[short, short],
],
long: [
[long, long],
[long, long],
[long, long],
[long, long],
[long, long],
[long, long],
],
};
// TODO: ADD TO FORM IS NOT ADDING THE SECOND VARIATION PASSED IN!
return addToForm([hyp], emptyVerbBlock);
}
function makeParticipleContent(info: T.NonComboVerbInfo): T.ParticipleContent {