all tenses in equative explorer 💪
This commit is contained in:
parent
9466bc5ff8
commit
2d17daf81f
|
@ -5,7 +5,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fortawesome/fontawesome-free": "^5.15.4",
|
"@fortawesome/fontawesome-free": "^5.15.4",
|
||||||
"@lingdocs/lingdocs-main": "^0.2.0",
|
"@lingdocs/lingdocs-main": "^0.2.0",
|
||||||
"@lingdocs/pashto-inflector": "^1.3.1",
|
"@lingdocs/pashto-inflector": "^1.3.2",
|
||||||
"@testing-library/jest-dom": "^5.11.4",
|
"@testing-library/jest-dom": "^5.11.4",
|
||||||
"@testing-library/react": "^11.1.0",
|
"@testing-library/react": "^11.1.0",
|
||||||
"@testing-library/user-event": "^12.1.10",
|
"@testing-library/user-event": "^12.1.10",
|
||||||
|
|
|
@ -9,15 +9,15 @@ import {
|
||||||
ParticipleInput,
|
ParticipleInput,
|
||||||
isParticipleInput,
|
isParticipleInput,
|
||||||
getEnglishParticiple,
|
getEnglishParticiple,
|
||||||
TenseInput,
|
|
||||||
} from "../../lib/equative-machine";
|
} from "../../lib/equative-machine";
|
||||||
|
|
||||||
export function sort<T extends (Adjective | Noun | ParticipleInput)>(arr: Readonly<T[]>): T[] {
|
export function sort<T extends (Adjective | Noun | ParticipleInput)>(arr: Readonly<T[]>): T[] {
|
||||||
return [...arr].sort((a, b) => a.p.localeCompare(b.p));
|
return [...arr].sort((a, b) => a.p.localeCompare(b.p));
|
||||||
}
|
}
|
||||||
|
|
||||||
export function makeBlockWPronouns(e: Adjective | UnisexNoun, tense: TenseInput, length?: "short" | "long"): T.SingleOrLengthOpts<T.VerbBlock> {
|
export function makeBlockWPronouns(e: Adjective | UnisexNoun, tense: EquativeTense, length?: "short" | "long"): T.SingleOrLengthOpts<T.VerbBlock> {
|
||||||
if (tense === "past" && !length) {
|
// if the output's gonna have long / short forms (if it's past or wouldBe) then recursive call to make the long and short versions
|
||||||
|
if (!length && "long" in assembleEquativeOutput(equativeMachine(0, e, tense))) {
|
||||||
return {
|
return {
|
||||||
short: makeBlockWPronouns(e, tense, "short") as T.VerbBlock,
|
short: makeBlockWPronouns(e, tense, "short") as T.VerbBlock,
|
||||||
long: makeBlockWPronouns(e, tense, "long") as T.VerbBlock,
|
long: makeBlockWPronouns(e, tense, "long") as T.VerbBlock,
|
||||||
|
|
|
@ -112,32 +112,34 @@ export function SubjectSelector({ state, dispatch }: {
|
||||||
{...zIndexProps}
|
{...zIndexProps}
|
||||||
/>
|
/>
|
||||||
<div className="d-flex flex-row justify-content-center mt-3">
|
<div className="d-flex flex-row justify-content-center mt-3">
|
||||||
{state.subjectType !== "participle" && <>
|
<div className="mr-2">
|
||||||
<div className="mr-2">
|
<ButtonSelect
|
||||||
<ButtonSelect
|
small
|
||||||
small
|
options={[
|
||||||
options={[
|
...(state.subjectType === "unisexNoun" || (state.subjectType === "participle") || (isMascNoun(state.subjectsSelected[state.subjectType])))
|
||||||
...(state.subjectType === "unisexNoun" || ("noun" && isMascNoun(state.subjectsSelected[state.subjectType])))
|
? [{ label: "Masc.", value: "masc" }] : [],
|
||||||
? [{ label: "Masc.", value: "masc" }] : [],
|
...(state.subjectType === "unisexNoun" || ((state.subjectType !== "participle") && isFemNoun(state.subjectsSelected[state.subjectType])))
|
||||||
...(state.subjectType === "unisexNoun" || ("noun" && isFemNoun(state.subjectsSelected[state.subjectType])))
|
? [{ label: "Fem.", value: "fem" }] : [],
|
||||||
? [{ label: "Fem.", value: "fem" }] : [],
|
]}
|
||||||
]}
|
value={state.subjectType === "noun"
|
||||||
value={state.subjectType === "noun" ? (isMascNoun(state.subjectsSelected[state.subjectType]) ? "masc" : "fem") : state.subjectsSelected.info.gender}
|
? (isMascNoun(state.subjectsSelected[state.subjectType]) ? "masc" : "fem")
|
||||||
handleChange={state.subjectType === "noun" ? p => null : (p) => dispatch({ type: "setSubjectGender", payload: p as T.Gender })}
|
: state.subjectType === "participle"
|
||||||
/>
|
? "masc"
|
||||||
</div>
|
: state.subjectsSelected.info.gender}
|
||||||
<div className="ml-2">
|
handleChange={state.subjectType === "noun" ? p => null : (p) => dispatch({ type: "setSubjectGender", payload: p as T.Gender })}
|
||||||
<ButtonSelect
|
/>
|
||||||
small
|
</div>
|
||||||
options={[
|
<div className="ml-2">
|
||||||
...!pluralNounSelected ? [{ label: "Singular", value: "singular" }] : [],
|
<ButtonSelect
|
||||||
{ label: "Plural", value: "plural" },
|
small
|
||||||
]}
|
options={[
|
||||||
value={(state.subjectsSelected.info.plural || pluralNounSelected) ? "plural" : "singular"}
|
...(!pluralNounSelected && state.subjectType !== "participle") ? [{ label: "Singular", value: "singular" }] : [],
|
||||||
handleChange={(p) => dispatch({ type: "setSubjectPlural", payload: p === "plural" ? true : false })}
|
{ label: "Plural", value: "plural" },
|
||||||
/>
|
]}
|
||||||
</div>
|
value={(state.subjectsSelected.info.plural || pluralNounSelected || state.subjectType === "participle") ? "plural" : "singular"}
|
||||||
</>}
|
handleChange={(p) => dispatch({ type: "setSubjectPlural", payload: p === "plural" ? true : false })}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
|
@ -208,9 +210,13 @@ export function TenseSelector({ state, dispatch }: {
|
||||||
state: ExplorerState,
|
state: ExplorerState,
|
||||||
dispatch: (action: ExplorerReducerAction) => void,
|
dispatch: (action: ExplorerReducerAction) => void,
|
||||||
}) {
|
}) {
|
||||||
const options = [
|
const options: { value: EquativeTense, label: string }[] = [
|
||||||
{ value: "present", label: "Present" },
|
{ value: "present", label: "Present" },
|
||||||
|
{ value: "subjunctive", label: "Habitual / Subjunctive" },
|
||||||
{ value: "past", label: "Past" },
|
{ value: "past", label: "Past" },
|
||||||
|
{ value: "future", label: "Future" },
|
||||||
|
{ value: "wouldBe", label: '"Would Be"' },
|
||||||
|
{ value: "pastSubjunctive", label: "Past Subjunctive" },
|
||||||
];
|
];
|
||||||
function onTenseSelect({ value }: any) {
|
function onTenseSelect({ value }: any) {
|
||||||
dispatch({ type: "setTense", payload: value });
|
dispatch({ type: "setTense", payload: value });
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import { Types as T } from "@lingdocs/pashto-inflector";
|
import { Types as T } from "@lingdocs/pashto-inflector";
|
||||||
import { ParticipleInput, TenseInput } from "../../lib/equative-machine";
|
import { ParticipleInput } from "../../lib/equative-machine";
|
||||||
|
|
||||||
export type PredicateType = keyof PredicatesSelected;
|
export type PredicateType = keyof PredicatesSelected;
|
||||||
export type SubjectType = "noun" | "pronouns" | "participle" | "unisexNoun";
|
export type SubjectType = "noun" | "pronouns" | "participle" | "unisexNoun";
|
||||||
|
|
||||||
export type ExplorerState = {
|
export type ExplorerState = {
|
||||||
tense: TenseInput,
|
tense: EquativeTense,
|
||||||
length: "short" | "long",
|
length: "short" | "long",
|
||||||
subjectType: SubjectType,
|
subjectType: SubjectType,
|
||||||
subjectsSelected: SubjectSelected,
|
subjectsSelected: SubjectSelected,
|
||||||
|
@ -39,7 +39,7 @@ export type ExplorerReducerAction = {
|
||||||
} | {
|
} | {
|
||||||
type: "setSubjectGender", payload: T.Gender,
|
type: "setSubjectGender", payload: T.Gender,
|
||||||
} | {
|
} | {
|
||||||
type: "setTense", payload: TenseInput,
|
type: "setTense", payload: EquativeTense,
|
||||||
} | {
|
} | {
|
||||||
type: "setLength", payload: "short" | "long",
|
type: "setLength", payload: "short" | "long",
|
||||||
};
|
};
|
|
@ -28,7 +28,7 @@ import EquativeFormChoice from "../../components/EquativeFormChoice";
|
||||||
import Formula from "../../components/formula/Formula";
|
import Formula from "../../components/formula/Formula";
|
||||||
import Link from "../../components/Link";
|
import Link from "../../components/Link";
|
||||||
|
|
||||||
## Future / Presumptive Equative
|
## Future Equative
|
||||||
|
|
||||||
This is used for:
|
This is used for:
|
||||||
|
|
||||||
|
@ -161,12 +161,13 @@ It is usually used in the short form.
|
||||||
},
|
},
|
||||||
])}</Examples>
|
])}</Examples>
|
||||||
|
|
||||||
## Affirmative Equative
|
## "Would be" Equative
|
||||||
|
|
||||||
This is used:
|
This is used:
|
||||||
|
|
||||||
1. To affirm or to make a strong assumption that something will have been something. ("I'll have been ...")
|
1. To talk about something being something repeatedly in the past
|
||||||
2. To say what would have happened if a hypothetical condition were true. ("If ..., I'd be ...")
|
2. To say something would have been something
|
||||||
|
1. To affirm or to make a strong assumption that something will have been something
|
||||||
|
|
||||||
Like the <Link to="#past-equative">past equative</Link> that it's based on, it's usually used with the short form.
|
Like the <Link to="#past-equative">past equative</Link> that it's based on, it's usually used with the short form.
|
||||||
|
|
||||||
|
@ -212,23 +213,23 @@ Like the <Link to="#past-equative">past equative</Link> that it's based on, it's
|
||||||
|
|
||||||
<Examples opts={opts}>{psmd([
|
<Examples opts={opts}>{psmd([
|
||||||
{
|
{
|
||||||
p: "ډوډۍ **به** تیاره **وه**.",
|
p: "زه به هر سهار هلته وم",
|
||||||
f: "DoDúy **ba** tayáara **wa**.",
|
f: "zu ba hăr saháar halta wum",
|
||||||
e: "The food **will have been** ready.",
|
e: "I would be there every morning",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
p: "ته **به** خبر **وې**",
|
p: "ته **به** خبر **وې**",
|
||||||
f: "tu **ba** khabúr **we**.",
|
f: "tu **ba** khabúr **we**.",
|
||||||
e: "Youwill have known.",
|
e: "You would have known.",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
p: "که خوب مې نه وای کړی، زه **به** ستړی **وم**.",
|
p: "که خوب مې نه وای کړی، زه **به** ستړی **وم**.",
|
||||||
f: "ku khob me nu waay kúRey, zu **ba** stúRey **wum**.",
|
f: "ku khob me nu waay kúRey, zu **ba** stúRey **wum**.",
|
||||||
e: "If I hadn't slept, I **would have been** tired.",
|
e: "If I hadn't slept, I **would be been** tired.",
|
||||||
},
|
},
|
||||||
])}</Examples>
|
])}</Examples>
|
||||||
|
|
||||||
## Conterfactual / Past Subjunctive / Wish Equative
|
## Past Subjunctive
|
||||||
|
|
||||||
This is used to talk about something being hypothetically something, or to wish that something were something. ("If I was ...", "If only I was ..."). It is also used for prayers and blessings in some dialects.
|
This is used to talk about something being hypothetically something, or to wish that something were something. ("If I was ...", "If only I was ..."). It is also used for prayers and blessings in some dialects.
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@ import {
|
||||||
PredicateInput,
|
PredicateInput,
|
||||||
ParticipleInput,
|
ParticipleInput,
|
||||||
assembleEquativeOutput,
|
assembleEquativeOutput,
|
||||||
TenseInput,
|
|
||||||
} from "./equative-machine";
|
} from "./equative-machine";
|
||||||
import {
|
import {
|
||||||
Types as T,
|
Types as T,
|
||||||
|
@ -46,7 +45,7 @@ const abilities: {
|
||||||
in: {
|
in: {
|
||||||
subject: SubjectInput,
|
subject: SubjectInput,
|
||||||
predicate: PredicateInput,
|
predicate: PredicateInput,
|
||||||
tense: TenseInput,
|
tense: EquativeTense,
|
||||||
},
|
},
|
||||||
out: EquativeMachineOutput,
|
out: EquativeMachineOutput,
|
||||||
}[],
|
}[],
|
||||||
|
@ -62,6 +61,7 @@ const abilities: {
|
||||||
tense: "present",
|
tense: "present",
|
||||||
},
|
},
|
||||||
out: {
|
out: {
|
||||||
|
ba: false,
|
||||||
subject: [{ p: "زه", f: "zu", e: "I (m.)" }],
|
subject: [{ p: "زه", f: "zu", e: "I (m.)" }],
|
||||||
predicate: [{ p: "ستړی", f: "stúRey", e: "tired" }],
|
predicate: [{ p: "ستړی", f: "stúRey", e: "tired" }],
|
||||||
equative: [{ p: "یم", f: "yum", e: "am" }],
|
equative: [{ p: "یم", f: "yum", e: "am" }],
|
||||||
|
@ -74,6 +74,7 @@ const abilities: {
|
||||||
tense: "present",
|
tense: "present",
|
||||||
},
|
},
|
||||||
out: {
|
out: {
|
||||||
|
ba: false,
|
||||||
subject: [{ p: "تاسو", f: "táaso", e: "You (f. pl.)" }, { p: "تاسې", f: "táase", e: "You (f. pl.)"}],
|
subject: [{ p: "تاسو", f: "táaso", e: "You (f. pl.)" }, { p: "تاسې", f: "táase", e: "You (f. pl.)"}],
|
||||||
predicate: [{ p: "ستړې", f: "stúRe", e: "tired" }],
|
predicate: [{ p: "ستړې", f: "stúRe", e: "tired" }],
|
||||||
equative: [{ p: "یئ", f: "yeyy", e: "are" }],
|
equative: [{ p: "یئ", f: "yeyy", e: "are" }],
|
||||||
|
@ -87,6 +88,7 @@ const abilities: {
|
||||||
tense: "present",
|
tense: "present",
|
||||||
},
|
},
|
||||||
out: {
|
out: {
|
||||||
|
ba: false,
|
||||||
subject: [{ p: "هغه", f: "haghá", e: "She/it (f.)" }],
|
subject: [{ p: "هغه", f: "haghá", e: "She/it (f.)" }],
|
||||||
predicate: [{ p: "خفه", f: "khufa", e: "sad" }],
|
predicate: [{ p: "خفه", f: "khufa", e: "sad" }],
|
||||||
equative: [{ p: "ده", f: "da", e: "is" }],
|
equative: [{ p: "ده", f: "da", e: "is" }],
|
||||||
|
@ -104,6 +106,7 @@ const abilities: {
|
||||||
tense: "present",
|
tense: "present",
|
||||||
},
|
},
|
||||||
out: {
|
out: {
|
||||||
|
ba: false,
|
||||||
subject: [{ p: "زه", f: "zu", e: "I (f.)" }],
|
subject: [{ p: "زه", f: "zu", e: "I (f.)" }],
|
||||||
predicate: [{ p: "افغانۍ", f: "afghaanúy", e: "(a/the) Afghan" }],
|
predicate: [{ p: "افغانۍ", f: "afghaanúy", e: "(a/the) Afghan" }],
|
||||||
equative: [{ p: "یم", f: "yum", e: "am" }],
|
equative: [{ p: "یم", f: "yum", e: "am" }],
|
||||||
|
@ -116,6 +119,7 @@ const abilities: {
|
||||||
tense: "present",
|
tense: "present",
|
||||||
},
|
},
|
||||||
out: {
|
out: {
|
||||||
|
ba: false,
|
||||||
subject: [{ p: "مونږ", f: "moonG", e: "We (f. pl.)" }, { p: "موږ", f: "mooG", e: "We (f. pl.)" }],
|
subject: [{ p: "مونږ", f: "moonG", e: "We (f. pl.)" }, { p: "موږ", f: "mooG", e: "We (f. pl.)" }],
|
||||||
predicate: [
|
predicate: [
|
||||||
{ p: "افغانیانې", f: "afghaaniyáane", e: "(the) Afghans" },
|
{ p: "افغانیانې", f: "afghaaniyáane", e: "(the) Afghans" },
|
||||||
|
@ -131,6 +135,7 @@ const abilities: {
|
||||||
tense: "present",
|
tense: "present",
|
||||||
},
|
},
|
||||||
out: {
|
out: {
|
||||||
|
ba: false,
|
||||||
subject: [{ p: "مونږ", f: "moonG", e: "We (f. pl.)" }, { p: "موږ", f: "mooG", e: "We (f. pl.)" }],
|
subject: [{ p: "مونږ", f: "moonG", e: "We (f. pl.)" }, { p: "موږ", f: "mooG", e: "We (f. pl.)" }],
|
||||||
predicate: [{ p: "انسانانې", f: "insaanáane", e: "(the) humans" }, { p: "انسانې", f: "insaane", e: "(the) humans" }],
|
predicate: [{ p: "انسانانې", f: "insaanáane", e: "(the) humans" }, { p: "انسانې", f: "insaane", e: "(the) humans" }],
|
||||||
equative: [{ p: "یو", f: "yoo", e: "are" }],
|
equative: [{ p: "یو", f: "yoo", e: "are" }],
|
||||||
|
@ -143,6 +148,7 @@ const abilities: {
|
||||||
tense: "present",
|
tense: "present",
|
||||||
},
|
},
|
||||||
out: {
|
out: {
|
||||||
|
ba: false,
|
||||||
subject: [{ p: "ته", f: "tu", e: "You (f.)" }],
|
subject: [{ p: "ته", f: "tu", e: "You (f.)" }],
|
||||||
predicate: [{ p: "انسانه", f: "insaana", e: "(a/the) human" }],
|
predicate: [{ p: "انسانه", f: "insaana", e: "(a/the) human" }],
|
||||||
equative: [{ p: "یې", f: "ye", e: "are" }],
|
equative: [{ p: "یې", f: "ye", e: "are" }],
|
||||||
|
@ -163,6 +169,7 @@ const abilities: {
|
||||||
tense: "present",
|
tense: "present",
|
||||||
},
|
},
|
||||||
out: {
|
out: {
|
||||||
|
ba: false,
|
||||||
subject: [{ p: "کتاب", f: "kitáab", e: "(A/The) book" }],
|
subject: [{ p: "کتاب", f: "kitáab", e: "(A/The) book" }],
|
||||||
predicate: [{ p: "زوړ", f: "zoR", e: "old" }],
|
predicate: [{ p: "زوړ", f: "zoR", e: "old" }],
|
||||||
equative: [{ p: "دی", f: "dey", e: "is" }],
|
equative: [{ p: "دی", f: "dey", e: "is" }],
|
||||||
|
@ -178,6 +185,7 @@ const abilities: {
|
||||||
tense: "present",
|
tense: "present",
|
||||||
},
|
},
|
||||||
out: {
|
out: {
|
||||||
|
ba: false,
|
||||||
subject: [{ p: "کتابونه", f: "kitaabóona", e: "(The) books" }],
|
subject: [{ p: "کتابونه", f: "kitaabóona", e: "(The) books" }],
|
||||||
predicate: [{ p: "زاړه", f: "zaaRu", e: "old" }],
|
predicate: [{ p: "زاړه", f: "zaaRu", e: "old" }],
|
||||||
equative: [{ p: "دي", f: "dee", e: "are" }],
|
equative: [{ p: "دي", f: "dee", e: "are" }],
|
||||||
|
@ -193,6 +201,7 @@ const abilities: {
|
||||||
tense: "present",
|
tense: "present",
|
||||||
},
|
},
|
||||||
out: {
|
out: {
|
||||||
|
ba: false,
|
||||||
subject: [{ p: "ښځه", f: "xúdza", e: "(A/The) woman" }],
|
subject: [{ p: "ښځه", f: "xúdza", e: "(A/The) woman" }],
|
||||||
predicate: [{ p: "زړه", f: "zaRa", e: "old" }],
|
predicate: [{ p: "زړه", f: "zaRa", e: "old" }],
|
||||||
equative: [{ p: "ده", f: "da", e: "is" }],
|
equative: [{ p: "ده", f: "da", e: "is" }],
|
||||||
|
@ -208,6 +217,7 @@ const abilities: {
|
||||||
tense: "present",
|
tense: "present",
|
||||||
},
|
},
|
||||||
out: {
|
out: {
|
||||||
|
ba: false,
|
||||||
subject: [{ p: "ښځې", f: "xúdze", e: "(The) women" }],
|
subject: [{ p: "ښځې", f: "xúdze", e: "(The) women" }],
|
||||||
predicate: [{ p: "زړې", f: "zaRe", e: "old" }],
|
predicate: [{ p: "زړې", f: "zaRe", e: "old" }],
|
||||||
equative: [{ p: "دي", f: "dee", e: "are" }],
|
equative: [{ p: "دي", f: "dee", e: "are" }],
|
||||||
|
@ -224,6 +234,7 @@ const abilities: {
|
||||||
tense: "present",
|
tense: "present",
|
||||||
},
|
},
|
||||||
out: {
|
out: {
|
||||||
|
ba: false,
|
||||||
subject: [{ p: "ښځې", f: "xúdze", e: "(The) women" }],
|
subject: [{ p: "ښځې", f: "xúdze", e: "(The) women" }],
|
||||||
predicate: [{ p: "خفه", f: "khufa", e: "sad" }],
|
predicate: [{ p: "خفه", f: "khufa", e: "sad" }],
|
||||||
equative: [{ p: "دي", f: "dee", e: "are" }],
|
equative: [{ p: "دي", f: "dee", e: "are" }],
|
||||||
|
@ -244,6 +255,7 @@ const abilities: {
|
||||||
tense: "present",
|
tense: "present",
|
||||||
},
|
},
|
||||||
out: {
|
out: {
|
||||||
|
ba: false,
|
||||||
subject: [{ p: "شودې", f: "shoodé", e: "(The) milk" }],
|
subject: [{ p: "شودې", f: "shoodé", e: "(The) milk" }],
|
||||||
predicate: [{ p: "ښې", f: "xe", e: "good" }],
|
predicate: [{ p: "ښې", f: "xe", e: "good" }],
|
||||||
equative: [{ p: "دي", f: "dee", e: "is" }],
|
equative: [{ p: "دي", f: "dee", e: "is" }],
|
||||||
|
@ -259,6 +271,7 @@ const abilities: {
|
||||||
tense: "present",
|
tense: "present",
|
||||||
},
|
},
|
||||||
out: {
|
out: {
|
||||||
|
ba: false,
|
||||||
subject: [{ p: "غنم", f: "ghanúm", e: "(The) wheat" }],
|
subject: [{ p: "غنم", f: "ghanúm", e: "(The) wheat" }],
|
||||||
predicate: [{ p: "زاړه", f: "zaaRu", e: "old" }],
|
predicate: [{ p: "زاړه", f: "zaaRu", e: "old" }],
|
||||||
equative: [{ p: "دي", f: "dee", e: "is" }],
|
equative: [{ p: "دي", f: "dee", e: "is" }],
|
||||||
|
@ -276,6 +289,7 @@ const abilities: {
|
||||||
tense: "present",
|
tense: "present",
|
||||||
},
|
},
|
||||||
out: {
|
out: {
|
||||||
|
ba: false,
|
||||||
subject: [{ p: "خوړل", f: "khoRul", e: "eating" }],
|
subject: [{ p: "خوړل", f: "khoRul", e: "eating" }],
|
||||||
predicate: [{ p: "ښه", f: "xu", e: "good" }],
|
predicate: [{ p: "ښه", f: "xu", e: "good" }],
|
||||||
equative: [{ p: "دي", f: "dee", e: "is" }],
|
equative: [{ p: "دي", f: "dee", e: "is" }],
|
||||||
|
@ -288,6 +302,7 @@ const abilities: {
|
||||||
tense: "present",
|
tense: "present",
|
||||||
},
|
},
|
||||||
out: {
|
out: {
|
||||||
|
ba: false,
|
||||||
subject: [{ p: "اخیستل", f: "akheestul", e: "taking" }],
|
subject: [{ p: "اخیستل", f: "akheestul", e: "taking" }],
|
||||||
predicate: [{ p: "زاړه", f: "zaaRu", e: "old" }],
|
predicate: [{ p: "زاړه", f: "zaaRu", e: "old" }],
|
||||||
equative: [{ p: "دي", f: "dee", e: "is" }],
|
equative: [{ p: "دي", f: "dee", e: "is" }],
|
||||||
|
@ -300,6 +315,7 @@ const abilities: {
|
||||||
tense: "present",
|
tense: "present",
|
||||||
},
|
},
|
||||||
out: {
|
out: {
|
||||||
|
ba: false,
|
||||||
subject: [{ p: "جګېدل", f: "jugedul", e: "getting up" }],
|
subject: [{ p: "جګېدل", f: "jugedul", e: "getting up" }],
|
||||||
predicate: [{ p: "سخت", f: "sakht", e: "hard" }],
|
predicate: [{ p: "سخت", f: "sakht", e: "hard" }],
|
||||||
equative: [{ p: "دي", f: "dee", e: "is" }],
|
equative: [{ p: "دي", f: "dee", e: "is" }],
|
||||||
|
@ -317,6 +333,7 @@ const abilities: {
|
||||||
tense: "present",
|
tense: "present",
|
||||||
},
|
},
|
||||||
out: {
|
out: {
|
||||||
|
ba: false,
|
||||||
subject: [{ p: "ته", f: "tu", e: "You (m.)" }],
|
subject: [{ p: "ته", f: "tu", e: "You (m.)" }],
|
||||||
predicate: [{ p: "لیکل", f: "leekul", e: "writing" }],
|
predicate: [{ p: "لیکل", f: "leekul", e: "writing" }],
|
||||||
equative: [{ p: "دي", f: "dee", e: "are" }],
|
equative: [{ p: "دي", f: "dee", e: "are" }],
|
||||||
|
@ -340,6 +357,7 @@ const abilities: {
|
||||||
tense: "present",
|
tense: "present",
|
||||||
},
|
},
|
||||||
out: {
|
out: {
|
||||||
|
ba: false,
|
||||||
subject: [{ p: "خوشحالي", f: "khosh`haalee", e: "(A/The) happiness" }],
|
subject: [{ p: "خوشحالي", f: "khosh`haalee", e: "(A/The) happiness" }],
|
||||||
predicate: [{ p: "خوراک", f: "khoráak", e: "(a/the) food" }],
|
predicate: [{ p: "خوراک", f: "khoráak", e: "(a/the) food" }],
|
||||||
equative: [{ p: "دی", f: "dey", e: "is" }],
|
equative: [{ p: "دی", f: "dey", e: "is" }],
|
||||||
|
@ -360,6 +378,7 @@ const abilities: {
|
||||||
tense: "present",
|
tense: "present",
|
||||||
},
|
},
|
||||||
out: {
|
out: {
|
||||||
|
ba: false,
|
||||||
subject: [{ p: "وروروالی", f: "wrorwaaley", e: "(A/The) brotherhood" }],
|
subject: [{ p: "وروروالی", f: "wrorwaaley", e: "(A/The) brotherhood" }],
|
||||||
predicate: [{ p: "زغمل", f: "zghamul", e: "enduring" }],
|
predicate: [{ p: "زغمل", f: "zghamul", e: "enduring" }],
|
||||||
equative: [{ p: "دي", f: "dee", e: "is" }],
|
equative: [{ p: "دي", f: "dee", e: "is" }],
|
||||||
|
@ -380,6 +399,7 @@ const abilities: {
|
||||||
tense: "present",
|
tense: "present",
|
||||||
},
|
},
|
||||||
out: {
|
out: {
|
||||||
|
ba: false,
|
||||||
subject: [{ p: "لیکل", f: "leekul", e: "writing" }],
|
subject: [{ p: "لیکل", f: "leekul", e: "writing" }],
|
||||||
predicate: [{ p: "خوشحالي", f: "khosh`haalee", e: "(a/the) happiness" }],
|
predicate: [{ p: "خوشحالي", f: "khosh`haalee", e: "(a/the) happiness" }],
|
||||||
equative: [{ p: "ده", f: "da", e: "is" }],
|
equative: [{ p: "ده", f: "da", e: "is" }],
|
||||||
|
@ -397,6 +417,7 @@ const abilities: {
|
||||||
tense: "present",
|
tense: "present",
|
||||||
},
|
},
|
||||||
out: {
|
out: {
|
||||||
|
ba: false,
|
||||||
subject: [{ p: "لیکل", f: "leekul", e: "writing" }],
|
subject: [{ p: "لیکل", f: "leekul", e: "writing" }],
|
||||||
predicate: [{ p: "پوهېدل", f: "pohedul", e: "understanding" }],
|
predicate: [{ p: "پوهېدل", f: "pohedul", e: "understanding" }],
|
||||||
equative: [{ p: "دي", f: "dee", e: "is" }],
|
equative: [{ p: "دي", f: "dee", e: "is" }],
|
||||||
|
@ -421,6 +442,7 @@ const abilities: {
|
||||||
tense: "present",
|
tense: "present",
|
||||||
},
|
},
|
||||||
out: {
|
out: {
|
||||||
|
ba: false,
|
||||||
subject: [{ p: "کتابونه", f: "kitaabóona", e: "(The) books" }],
|
subject: [{ p: "کتابونه", f: "kitaabóona", e: "(The) books" }],
|
||||||
predicate: [{ p: "نرسه", f: "narsa", e: "(a/the) nurse" }],
|
predicate: [{ p: "نرسه", f: "narsa", e: "(a/the) nurse" }],
|
||||||
equative: [{ p: "ده", f: "da", e: "are" }],
|
equative: [{ p: "ده", f: "da", e: "are" }],
|
||||||
|
@ -442,6 +464,7 @@ const abilities: {
|
||||||
tense: "present",
|
tense: "present",
|
||||||
},
|
},
|
||||||
out: {
|
out: {
|
||||||
|
ba: false,
|
||||||
subject: [
|
subject: [
|
||||||
{ p: "نرسانې", f: "narsáane", e: "(The) nurses" },
|
{ p: "نرسانې", f: "narsáane", e: "(The) nurses" },
|
||||||
{ p: "نرسې", f: "narse", e: "(The) nurses" },
|
{ p: "نرسې", f: "narse", e: "(The) nurses" },
|
||||||
|
@ -469,6 +492,7 @@ const abilities: {
|
||||||
tense: "present",
|
tense: "present",
|
||||||
},
|
},
|
||||||
out: {
|
out: {
|
||||||
|
ba: false,
|
||||||
subject: [{ p: "نرسه", f: "narsa", e: "(A/The) nurse" }],
|
subject: [{ p: "نرسه", f: "narsa", e: "(A/The) nurse" }],
|
||||||
predicate: [{ p: "کتابونه", f: "kitaabóona", e: "(the) books" }],
|
predicate: [{ p: "کتابونه", f: "kitaabóona", e: "(the) books" }],
|
||||||
equative: [{ p: "دي", f: "dee", e: "is" }],
|
equative: [{ p: "دي", f: "dee", e: "is" }],
|
||||||
|
@ -490,6 +514,7 @@ const abilities: {
|
||||||
tense: "present",
|
tense: "present",
|
||||||
},
|
},
|
||||||
out: {
|
out: {
|
||||||
|
ba: false,
|
||||||
subject: [{ p: "نرسه", f: "narsa", e: "(A/The) nurse" }],
|
subject: [{ p: "نرسه", f: "narsa", e: "(A/The) nurse" }],
|
||||||
predicate: [{ p: "غږېدل", f: "ghuGedul", e: "speaking" }],
|
predicate: [{ p: "غږېدل", f: "ghuGedul", e: "speaking" }],
|
||||||
equative: [{ p: "دي", f: "dee", e: "is" }],
|
equative: [{ p: "دي", f: "dee", e: "is" }],
|
||||||
|
@ -511,6 +536,7 @@ const abilities: {
|
||||||
tense: "present",
|
tense: "present",
|
||||||
},
|
},
|
||||||
out: {
|
out: {
|
||||||
|
ba: false,
|
||||||
subject: [{ p: "لیکل", f: "leekul", e: "writing" }],
|
subject: [{ p: "لیکل", f: "leekul", e: "writing" }],
|
||||||
predicate: [{ p: "نرسه", f: "narsa", e: "(a/the) nurse" }],
|
predicate: [{ p: "نرسه", f: "narsa", e: "(a/the) nurse" }],
|
||||||
equative: [{ p: "ده", f: "da", e: "is" }],
|
equative: [{ p: "ده", f: "da", e: "is" }],
|
||||||
|
@ -531,6 +557,7 @@ const abilities: {
|
||||||
tense: "past",
|
tense: "past",
|
||||||
},
|
},
|
||||||
out: {
|
out: {
|
||||||
|
ba: false,
|
||||||
subject: [{ p: "کتاب", f: "kitáab", e: "(A/The) book" }],
|
subject: [{ p: "کتاب", f: "kitáab", e: "(A/The) book" }],
|
||||||
predicate: [{ p: "زوړ", f: "zoR", e: "old" }],
|
predicate: [{ p: "زوړ", f: "zoR", e: "old" }],
|
||||||
equative: {
|
equative: {
|
||||||
|
@ -541,6 +568,96 @@ const abilities: {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: '"Would be" tense',
|
||||||
|
tests: [
|
||||||
|
{
|
||||||
|
in: {
|
||||||
|
subject: {
|
||||||
|
entry: { "ts":1527812817,"i":9921,"p":"کتاب","f":"kitáab","g":"kitaab","e":"book","c":"n. m." } as SingularEntry<Noun>,
|
||||||
|
plural: false,
|
||||||
|
},
|
||||||
|
predicate: {"ts":1527815451,"i":7193,"p":"زوړ","f":"zoR","g":"zoR","e":"old","c":"adj. irreg.","infap":"زاړه","infaf":"zaaRu","infbp":"زړ","infbf":"zaR"} as Adjective,
|
||||||
|
tense: "wouldBe",
|
||||||
|
},
|
||||||
|
out: {
|
||||||
|
ba: true,
|
||||||
|
subject: [{ p: "کتاب", f: "kitáab", e: "(A/The) book" }],
|
||||||
|
predicate: [{ p: "زوړ", f: "zoR", e: "old" }],
|
||||||
|
equative: {
|
||||||
|
short: [{ p: "و", f: "wo", e: "would be" }],
|
||||||
|
long: [{ p: "ولو", f: "wulo", e: "would be" }],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Subjunctive tense",
|
||||||
|
tests: [
|
||||||
|
{
|
||||||
|
in: {
|
||||||
|
subject: {
|
||||||
|
entry: { "ts":1527812817,"i":9921,"p":"کتاب","f":"kitáab","g":"kitaab","e":"book","c":"n. m." } as SingularEntry<Noun>,
|
||||||
|
plural: false,
|
||||||
|
},
|
||||||
|
predicate: {"ts":1527815451,"i":7193,"p":"زوړ","f":"zoR","g":"zoR","e":"old","c":"adj. irreg.","infap":"زاړه","infaf":"zaaRu","infbp":"زړ","infbf":"zaR"} as Adjective,
|
||||||
|
tense: "subjunctive",
|
||||||
|
},
|
||||||
|
out: {
|
||||||
|
ba: false,
|
||||||
|
subject: [{ p: "کتاب", f: "kitáab", e: "(A/The) book" }],
|
||||||
|
predicate: [{ p: "زوړ", f: "zoR", e: "old" }],
|
||||||
|
equative: [{ p: "وي", f: "wee", e: "is" }],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Future tense",
|
||||||
|
tests: [
|
||||||
|
{
|
||||||
|
in: {
|
||||||
|
subject: {
|
||||||
|
entry: { "ts":1527812817,"i":9921,"p":"کتاب","f":"kitáab","g":"kitaab","e":"book","c":"n. m." } as SingularEntry<Noun>,
|
||||||
|
plural: false,
|
||||||
|
},
|
||||||
|
predicate: {"ts":1527815451,"i":7193,"p":"زوړ","f":"zoR","g":"zoR","e":"old","c":"adj. irreg.","infap":"زاړه","infaf":"zaaRu","infbp":"زړ","infbf":"zaR"} as Adjective,
|
||||||
|
tense: "future",
|
||||||
|
},
|
||||||
|
out: {
|
||||||
|
ba: true,
|
||||||
|
subject: [{ p: "کتاب", f: "kitáab", e: "(A/The) book" }],
|
||||||
|
predicate: [{ p: "زوړ", f: "zoR", e: "old" }],
|
||||||
|
equative: [{ p: "وي", f: "wee", e: "will be" }],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Past Subjunctive Tense",
|
||||||
|
tests: [
|
||||||
|
{
|
||||||
|
in: {
|
||||||
|
subject: {
|
||||||
|
entry: { "ts":1527812817,"i":9921,"p":"کتاب","f":"kitáab","g":"kitaab","e":"book","c":"n. m." } as SingularEntry<Noun>,
|
||||||
|
plural: false,
|
||||||
|
},
|
||||||
|
predicate: {"ts":1527815451,"i":7193,"p":"زوړ","f":"zoR","g":"zoR","e":"old","c":"adj. irreg.","infap":"زاړه","infaf":"zaaRu","infbp":"زړ","infbf":"zaR"} as Adjective,
|
||||||
|
tense: "pastSubjunctive",
|
||||||
|
},
|
||||||
|
out: {
|
||||||
|
ba: false,
|
||||||
|
subject: [{ p: "کتاب", f: "kitáab", e: "(A/The) book" }],
|
||||||
|
predicate: [{ p: "زوړ", f: "zoR", e: "old" }],
|
||||||
|
equative: [
|
||||||
|
{ p: "وای", f: "waay", e: "were" },
|
||||||
|
{ p: "وی", f: "wey", e: "were" },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
describe("equativeMachine", () => {
|
describe("equativeMachine", () => {
|
||||||
|
@ -558,6 +675,7 @@ test("assembleEquativeOutput", () => {
|
||||||
subject: [{ p: "کتابونه", f: "kitaabóona", e: "(The) books" }],
|
subject: [{ p: "کتابونه", f: "kitaabóona", e: "(The) books" }],
|
||||||
predicate: [{ p: "زاړه", f: "zaaRu", e: "old" }],
|
predicate: [{ p: "زاړه", f: "zaaRu", e: "old" }],
|
||||||
equative: [{ p: "دي", f: "dee", e: "are" }],
|
equative: [{ p: "دي", f: "dee", e: "are" }],
|
||||||
|
ba: false,
|
||||||
})).toEqual([{ p: "کتابونه زاړه دي", f: "kitaabóona zaaRu dee", e: "(The) books are old" }]);
|
})).toEqual([{ p: "کتابونه زاړه دي", f: "kitaabóona zaaRu dee", e: "(The) books are old" }]);
|
||||||
expect(assembleEquativeOutput({
|
expect(assembleEquativeOutput({
|
||||||
subject: [{ p: "مونږ", f: "moonG", e: "We (f. pl.)" }, { p: "موږ", f: "mooG", e: "We (f. pl.)" }],
|
subject: [{ p: "مونږ", f: "moonG", e: "We (f. pl.)" }, { p: "موږ", f: "mooG", e: "We (f. pl.)" }],
|
||||||
|
@ -566,6 +684,7 @@ test("assembleEquativeOutput", () => {
|
||||||
{ p: "افغانۍ", f: "afghaanúy", e: "(the) Afghans" },
|
{ p: "افغانۍ", f: "afghaanúy", e: "(the) Afghans" },
|
||||||
],
|
],
|
||||||
equative: [{ p: "یو", f: "yoo", e: "are" }],
|
equative: [{ p: "یو", f: "yoo", e: "are" }],
|
||||||
|
ba: false,
|
||||||
})).toEqual([
|
})).toEqual([
|
||||||
{ p: "مونږ افغانیانې یو", f: "moonG afghaaniyáane yoo", e: "We (f. pl.) are (the) Afghans" },
|
{ p: "مونږ افغانیانې یو", f: "moonG afghaaniyáane yoo", e: "We (f. pl.) are (the) Afghans" },
|
||||||
{ p: "مونږ افغانۍ یو", f: "moonG afghaanúy yoo", e: "We (f. pl.) are (the) Afghans" },
|
{ p: "مونږ افغانۍ یو", f: "moonG afghaanúy yoo", e: "We (f. pl.) are (the) Afghans" },
|
||||||
|
@ -579,8 +698,21 @@ test("assembleEquativeOutput", () => {
|
||||||
short: [{ p: "و", f: "wo", e: "was" }],
|
short: [{ p: "و", f: "wo", e: "was" }],
|
||||||
long: [{ p: "ولو", f: "wulo", e: "was" }],
|
long: [{ p: "ولو", f: "wulo", e: "was" }],
|
||||||
},
|
},
|
||||||
|
ba: false,
|
||||||
})).toEqual({
|
})).toEqual({
|
||||||
short: [{ p: "کتاب زوړ و", f: "kitáab zoR wo", e: "(A/The) book was old" }],
|
short: [{ p: "کتاب زوړ و", f: "kitáab zoR wo", e: "(A/The) book was old" }],
|
||||||
long: [{ p: "کتاب زوړ ولو", f: "kitáab zoR wulo", e: "(A/The) book was old" }],
|
long: [{ p: "کتاب زوړ ولو", f: "kitáab zoR wulo", e: "(A/The) book was old" }],
|
||||||
});
|
});
|
||||||
|
expect(assembleEquativeOutput({
|
||||||
|
subject: [{ p: "کتاب", f: "kitáab", e: "(A/The) book" }],
|
||||||
|
predicate: [{ p: "زوړ", f: "zoR", e: "old" }],
|
||||||
|
equative: {
|
||||||
|
short: [{ p: "و", f: "wo", e: "would be" }],
|
||||||
|
long: [{ p: "ولو", f: "wulo", e: "would be" }],
|
||||||
|
},
|
||||||
|
ba: true,
|
||||||
|
})).toEqual({
|
||||||
|
short: [{ p: "کتاب به زوړ و", f: "kitáab ba zoR wo", e: "(A/The) book would be old" }],
|
||||||
|
long: [{ p: "کتاب به زوړ ولو", f: "kitáab ba zoR wulo", e: "(A/The) book would be old" }],
|
||||||
|
});
|
||||||
});
|
});
|
|
@ -21,6 +21,7 @@ export type EquativeMachineOutput = {
|
||||||
subject: T.PsString[],
|
subject: T.PsString[],
|
||||||
predicate: T.PsString[],
|
predicate: T.PsString[],
|
||||||
equative: T.SingleOrLengthOpts<T.ArrayOneOrMore<T.PsString>>,
|
equative: T.SingleOrLengthOpts<T.ArrayOneOrMore<T.PsString>>,
|
||||||
|
ba: boolean,
|
||||||
};
|
};
|
||||||
|
|
||||||
export type NounInput = {
|
export type NounInput = {
|
||||||
|
@ -38,9 +39,8 @@ export type PersonInput = T.Person;
|
||||||
export type EntityInput = SubjectInput | PredicateInput;
|
export type EntityInput = SubjectInput | PredicateInput;
|
||||||
export type SubjectInput = PersonInput | NounInput | ParticipleInput | SpecifiedUnisexNounInput;
|
export type SubjectInput = PersonInput | NounInput | ParticipleInput | SpecifiedUnisexNounInput;
|
||||||
export type PredicateInput = PersonInput | NounInput | Adjective | SpecifiedUnisexNounInput | UnisexNoun | ParticipleInput;
|
export type PredicateInput = PersonInput | NounInput | Adjective | SpecifiedUnisexNounInput | UnisexNoun | ParticipleInput;
|
||||||
export type TenseInput = "present" | "past";
|
|
||||||
|
|
||||||
export function equativeMachine(sub: SubjectInput, pred: PredicateInput, tense: TenseInput = "present"): EquativeMachineOutput {
|
export function equativeMachine(sub: SubjectInput, pred: PredicateInput, tense: EquativeTense): EquativeMachineOutput {
|
||||||
// - english equative always agrees with subject
|
// - english equative always agrees with subject
|
||||||
// - pashto equative agrees with predicate, unless it's an adjective, in which case the
|
// - pashto equative agrees with predicate, unless it's an adjective, in which case the
|
||||||
// agreement reverts to the subject
|
// agreement reverts to the subject
|
||||||
|
@ -49,10 +49,12 @@ export function equativeMachine(sub: SubjectInput, pred: PredicateInput, tense:
|
||||||
const subject = makeEntity(sub);
|
const subject = makeEntity(sub);
|
||||||
const predicate = makeEntity(pred, subjPerson);
|
const predicate = makeEntity(pred, subjPerson);
|
||||||
const equative = makeEquative(subjPerson, predPerson, sub, tense);
|
const equative = makeEquative(subjPerson, predPerson, sub, tense);
|
||||||
|
const ba = determineBa(tense);
|
||||||
return {
|
return {
|
||||||
subject,
|
subject,
|
||||||
predicate,
|
predicate,
|
||||||
equative,
|
equative,
|
||||||
|
ba,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,10 +69,11 @@ export function assembleEquativeOutput(o: EquativeMachineOutput): T.SingleOrLeng
|
||||||
// soooo cool how this works 🤓
|
// soooo cool how this works 🤓
|
||||||
const equatives = o.equative;
|
const equatives = o.equative;
|
||||||
const predicates = o.predicate;
|
const predicates = o.predicate;
|
||||||
|
const ba = o.ba ? { p: " به", f: " ba" } : "";
|
||||||
const ps = o.subject.flatMap(subj => (
|
const ps = o.subject.flatMap(subj => (
|
||||||
predicates.flatMap(pred => (
|
predicates.flatMap(pred => (
|
||||||
equatives.map(eq => (
|
equatives.map(eq => (
|
||||||
concatPsString(subj, " ", pred, " ", eq))
|
concatPsString(subj, ba, " ", pred, " ", eq))
|
||||||
)
|
)
|
||||||
))
|
))
|
||||||
));
|
));
|
||||||
|
@ -80,6 +83,10 @@ export function assembleEquativeOutput(o: EquativeMachineOutput): T.SingleOrLeng
|
||||||
|
|
||||||
// LEVEL 2 FUNCTIONS
|
// LEVEL 2 FUNCTIONS
|
||||||
|
|
||||||
|
function determineBa(tense: EquativeTense): boolean {
|
||||||
|
return (tense === "future" || tense === "wouldBe");
|
||||||
|
}
|
||||||
|
|
||||||
function getInputPerson(e: SubjectInput, part: "subject"): T.Person;
|
function getInputPerson(e: SubjectInput, part: "subject"): T.Person;
|
||||||
function getInputPerson(e: PredicateInput, part: "predicate"): T.Person | undefined;
|
function getInputPerson(e: PredicateInput, part: "predicate"): T.Person | undefined;
|
||||||
function getInputPerson(e: EntityInput, part: "subject" | "predicate"): T.Person | undefined {
|
function getInputPerson(e: EntityInput, part: "subject" | "predicate"): T.Person | undefined {
|
||||||
|
@ -121,7 +128,14 @@ function makeEntity(e: EntityInput, subjPerson?: T.Person): T.PsString[] {
|
||||||
throw new Error(`invalid entity in ${subjPerson ? "predicate" : "subject"}`);
|
throw new Error(`invalid entity in ${subjPerson ? "predicate" : "subject"}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
function makeEquative(subj: T.Person, pred: T.Person, subjectInput: SubjectInput, tense: TenseInput): T.SentenceForm {
|
function makeEquative(subj: T.Person, pred: T.Person, subjectInput: SubjectInput, tense: EquativeTense): T.SentenceForm {
|
||||||
|
function getEngEq(row: number, col: number): string {
|
||||||
|
const t = grammarUnits.englishEquative[tense === "subjunctive" ? "present" : tense];
|
||||||
|
return typeof t === "string"
|
||||||
|
? t
|
||||||
|
: t[row][col];
|
||||||
|
}
|
||||||
|
|
||||||
const isPluralNoun = isNounInput(subjectInput) && isPluralEntry(subjectInput.entry);
|
const isPluralNoun = isNounInput(subjectInput) && isPluralEntry(subjectInput.entry);
|
||||||
// The subject's person information, for the English equative
|
// The subject's person information, for the English equative
|
||||||
const [eeRow, eeCol] = getVerbBlockPosFromPerson(
|
const [eeRow, eeCol] = getVerbBlockPosFromPerson(
|
||||||
|
@ -129,10 +143,15 @@ function makeEquative(subj: T.Person, pred: T.Person, subjectInput: SubjectInput
|
||||||
? T.Person.ThirdSingMale
|
? T.Person.ThirdSingMale
|
||||||
: subj
|
: subj
|
||||||
);
|
);
|
||||||
|
const baseTense = (tense === "future")
|
||||||
|
? "subjunctive"
|
||||||
|
: tense === "wouldBe"
|
||||||
|
? "past"
|
||||||
|
: tense;
|
||||||
return addEnglish(
|
return addEnglish(
|
||||||
grammarUnits.englishEquative[tense][eeRow][eeCol],
|
getEngEq(eeRow, eeCol),
|
||||||
// pashto agrees with predicate (if possible)
|
// pashto agrees with predicate (if possible)
|
||||||
getPersonFromVerbForm(grammarUnits.equativeEndings[tense], pred),
|
getPersonFromVerbForm(grammarUnits.equativeEndings[baseTense], pred),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,4 +56,6 @@ type Words = {
|
||||||
nouns: Noun[],
|
nouns: Noun[],
|
||||||
adjectives: Adjective[],
|
adjectives: Adjective[],
|
||||||
verbs: Verb[],
|
verbs: Verb[],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type EquativeTense = "present" | "subjunctive" | "past" | "future" | "wouldBe" | "pastSubjunctive";
|
|
@ -1684,10 +1684,10 @@
|
||||||
pbf "^3.2.1"
|
pbf "^3.2.1"
|
||||||
rambda "^6.7.0"
|
rambda "^6.7.0"
|
||||||
|
|
||||||
"@lingdocs/pashto-inflector@^1.3.1":
|
"@lingdocs/pashto-inflector@^1.3.2":
|
||||||
version "1.3.1"
|
version "1.3.2"
|
||||||
resolved "https://npm.lingdocs.com/@lingdocs%2fpashto-inflector/-/pashto-inflector-1.3.1.tgz#09aca1e52507361d6efd5a87b7b7135704dc03a3"
|
resolved "https://npm.lingdocs.com/@lingdocs%2fpashto-inflector/-/pashto-inflector-1.3.2.tgz#a5501d9a56c8590eee052a88ffdbe38a07594f29"
|
||||||
integrity sha512-y8KKqvBau64zWrDP3Z7F4Zl9dxHXcB9WUyp1YRhL6jW1uqx4e92jF962p72oRkhlXGVLOXFuPFWmQqWHBVhvqw==
|
integrity sha512-crZlvjLssb+Q6kh6sAHlg4A4BerJnurSFUMz0fyYl3PlULsZyVHGvKepHYhP5AXyWt34zGiTzHTWapzIWsWtiQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
classnames "^2.2.6"
|
classnames "^2.2.6"
|
||||||
pbf "^3.2.1"
|
pbf "^3.2.1"
|
||||||
|
|
Loading…
Reference in New Issue