From aa9e2bdb2f474ec5c1a92bcb7c8d71edba597ade Mon Sep 17 00:00:00 2001 From: lingdocs <71590811+lingdocs@users.noreply.github.com> Date: Thu, 31 Mar 2022 18:09:17 +0500 Subject: [PATCH] not fully checked get modals going for passive - is this ok? doesn't change according to aspect and also don't have this for dynamic compounds for some reason --- package.json | 2 +- src/components/ConjugationViewer.tsx | 1 + src/lib/verb-conjugation.ts | 23 ++++++++++++++++++++++- src/types.ts | 1 + 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 340b20b..4d52398 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@lingdocs/pashto-inflector", - "version": "1.6.3", + "version": "1.6.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", diff --git a/src/components/ConjugationViewer.tsx b/src/components/ConjugationViewer.tsx index 503d18b..911760b 100644 --- a/src/components/ConjugationViewer.tsx +++ b/src/components/ConjugationViewer.tsx @@ -197,6 +197,7 @@ function ConjugationViewer({ entry, complement, textOptions, showOnly, highlight return undefined; } })(); + console.log(conjugation); if (conjugation === undefined) { // don't show the conjugation viewer if the verb can't be conjugated return null; diff --git a/src/lib/verb-conjugation.ts b/src/lib/verb-conjugation.ts index 560e665..49ba169 100644 --- a/src/lib/verb-conjugation.ts +++ b/src/lib/verb-conjugation.ts @@ -179,12 +179,14 @@ function conjugateDynamicCompound(info: T.DynamicCompoundVerbInfo): T.VerbConjug const future = addToForm([baParticle, " "], nonImperative); const past = addToForm([complement, " "], passive[aspect].past); const habitualPast = addToForm([baParticle, " "], past); + const modal = makePassiveModalSection([complement, " "], stativeAux.intransitive.imperfective.modal); return { nonImperative, future, past, habitualPast, - }; + modal, + } } return { info, @@ -450,11 +452,15 @@ function makePassiveContent(info: T.NonComboVerbInfo): { stativeAux.intransitive[aspect].past, ); const habitualPast = addToForm([baParticle, " "], past); + const modal = makePassiveModalSection([ + noPersInfs(info.root.imperfective).long, " ", + ], stativeAux.intransitive.imperfective.modal); return { nonImperative, future, past, habitualPast, + modal, }; } const root = noPersInfs(info.root[aspect]).long; @@ -463,11 +469,14 @@ function makePassiveContent(info: T.NonComboVerbInfo): { const future = addToForm([baParticle, " "], nonImperative); const past = addToForm([root, " "], aux.past); const habitualPast = addToForm([baParticle, " "], past); + const auxModal = aux.modal; + const modal = makePassiveModalSection([noPersInfs(info.root.imperfective).long, " "], auxModal); return { nonImperative, // ROOT LONG + kedulStat[aspect].nonImperative future, // به ba + ROOT LONG + this.nonImperative past, // ROOT LONG + kedulStat[aspect].past habitualPast, + modal, }; } const simpleVerbParticiple = { @@ -488,6 +497,16 @@ function makePassiveContent(info: T.NonComboVerbInfo): { }; } +function makePassiveModalSection(base: Array<" " | T.SingleOrLengthOpts | T.SingleOrLengthOpts | T.SingleOrLengthOpts[] | T.SingleOrLengthOpts | T.OptionalPersonInflections | T.VerbBlock>, auxModal: T.ModalContent): T.ModalContent { + return { + nonImperative: addToForm(base, auxModal.nonImperative), + future: addToForm(base, auxModal.future), + past: addToForm(base, auxModal.past), + habitualPast: addToForm(base, auxModal.habitualPast), + hypotheticalPast: addToForm(base, auxModal.hypotheticalPast), + }; +} + function makePassivePerfectContent(info: T.StativeCompoundVerbInfo): T.PerfectContent { const pPart = stativeAux.intransitive.participle.past; // will always be transitive @@ -569,6 +588,8 @@ function enforceObject(conj: T.VerbConjugation, person: T.Person): T.VerbConjuga future: allOnePersonVerbForm(as.future, person), past: allOnePersonVerbForm(as.past, person), habitualPast: allOnePersonInflection(as.past, person), + // TODO: check if this is ok + modal: as.modal, }); return { ...conj, diff --git a/src/types.ts b/src/types.ts index 515548d..bef2807 100644 --- a/src/types.ts +++ b/src/types.ts @@ -317,6 +317,7 @@ export type AspectContentPassive = { future: VerbForm; // ba + this.nonImperative past: VerbForm; // ROOT LONG + kedulStat[ASPECT].past habitualPast: VerbForm; + modal: ModalContent, } export type ParticipleForm = SingleOrLengthOpts | SingleOrLengthOpts;