bug with english in passive tense

This commit is contained in:
lingdocs 2021-07-05 14:39:52 +03:00
parent d3647ee0d5
commit b6d2098028
4 changed files with 34 additions and 23 deletions

View File

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

@ -84,6 +84,14 @@ export default function addPronouns({ s, subject, object, info, displayForm, int
} : {},
}
}
function makeEnglish(englishBuilder: T.EnglishBuilder, englishConjugation: T.EnglishVerbConjugation): string[] {
const noObject = (intransitive || info.transitivity === "grammatically transitive");
const addRest = (s: string) => (
`${s}${noObject ? "" : ` ${engObj(object)}`}${englishConjugation.ep ? ` ${englishConjugation.ep}` : ""}`
);
return englishBuilder(subject, englishConjugation.ec, negative)
.map(addRest);
}
const firstOrSecondObjectPresent = [0,1,2,3,6,7,8,9].includes(object) && !displayForm.past;
const nearPronounPossible = (p: T.Person) => [4, 5, 10, 11].includes(p);
const noPronouns =
@ -126,11 +134,7 @@ export default function addPronouns({ s, subject, object, info, displayForm, int
mini: miniPronoun,
};
const english = (displayForm.englishBuilder && englishConjugation)
? displayForm.englishBuilder(subject, englishConjugation.ec, negative).map(baseS => (
(intransitive || info.transitivity === "grammatically transitive")
? baseS
: `${baseS} ${engObj(object)}${englishConjugation.ep ? ` ${englishConjugation.ep}` : ""}`
))
? makeEnglish(displayForm.englishBuilder, englishConjugation)
: undefined;
function attachPronounsToVariation(ps: T.PsString, prns: Pronouns): T.ArrayOneOrMore<T.PsString> {

View File

@ -326,7 +326,7 @@ const formsOfConjugation = (conj: T.VerbConjugation): T.DisplayFormItem[] => [
aspect: "imperfective",
form: conj.imperfective.imperative,
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
`${v[0]}`,
`${n ? "Don't " : ""}${v[0]}`,
]),
formula: "Imperfective Stem + Imperative Ending",
explanation: "Commanding someone/people to do something repeatedly, or in general",
@ -592,7 +592,7 @@ const formsOfConjugation = (conj: T.VerbConjugation): T.DisplayFormItem[] => [
sentence: true,
passive: true,
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
`that ${engSubj(s, true)} will have been ${v[4]}`,
`that ${engSubj(s, true)} will${n ? " not" : ""} have been ${v[4]}`,
]),
formula: "Infinitive + کېدل (to be) past participle inflected + Subjunctive/Habitual Equative",
},
@ -604,7 +604,7 @@ const formsOfConjugation = (conj: T.VerbConjugation): T.DisplayFormItem[] => [
sentence: true,
passive: true,
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
`${engSubj(s)} will have been ${v[4]}`,
`${engSubj(s)} will${n ? " not" : ""} have been ${v[4]}`,
]),
formula: "به - ba + Infinitive + کېدل (to be) 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 (Passive voice) ('I will have been ____ed')",
@ -617,7 +617,7 @@ const formsOfConjugation = (conj: T.VerbConjugation): T.DisplayFormItem[] => [
sentence: true,
passive: true,
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
`${engSubj(s)} will have been ${v[4]}`,
`${engSubj(s)} will${n ? " not" : ""} have been ${v[4]}`,
]),
explanation: "Affirming that an event will have taken place (Passive voice) ('I will have been ____ed')",
formula: "به - ba + Infinitive + کېدل (to be) past participle inflected + Past Equative"

View File

@ -397,13 +397,14 @@ export type EnglishVerbConjugation = {
};
export type DisplayFormItem = DisplayForm | DisplayFormSubgroup | DisplayFormForSentence;
export type EnglishBuilder = (subject: Person, ec: EnglishVerbConjugationEc, neg: boolean) => string[];
export type DisplayForm = {
label: string,
aspect?: Aspect,
form: VerbForm | ImperativeForm | ParticipleForm | SentenceForm,
advanced?: boolean,
englishBuilder?: (subject: Person, ec: EnglishVerbConjugationEc, neg: boolean) => string[],
englishBuilder?: EnglishBuilder,
formula: React.ReactNode,
explanation: React.ReactNode,
sentence?: boolean,
@ -411,20 +412,26 @@ export type DisplayForm = {
past?: boolean,
reorderWithNegative?: boolean,
}
export type DisplayFormForSentence = {
label: string,
aspect?: Aspect,
export type DisplayFormForSentence = Omit<DisplayForm, "form"> & {
form: VerbForm,
advanced?: boolean,
englishBuilder?: (subject: Person, ec: EnglishVerbConjugationEc, neg: boolean) => string[],
formula: React.ReactNode,
secondPronounNeeded?: boolean,
explanation: React.ReactNode,
sentence?: boolean,
passive?: boolean,
past?: boolean,
reorderWithNegative?: boolean,
}
}
// {
// label: string,
// aspect?: Aspect,
// form: VerbForm,
// advanced?: boolean,
// englishBuilder?: EnglishBuilder,
// formula: React.ReactNode,
// secondPronounNeeded?: boolean,
// explanation: React.ReactNode,
// sentence?: boolean,
// passive?: boolean,
// past?: boolean,
// reorderWithNegative?: boolean,
// }
export type DisplayFormSubgroup = {
label: string,