From 90fec81da9397f71164c8cba0608801fce347b6b Mon Sep 17 00:00:00 2001 From: lingdocs <71590811+lingdocs@users.noreply.github.com> Date: Tue, 29 Mar 2022 14:53:32 +0500 Subject: [PATCH] added in habitual past tenses --- package.json | 2 +- src/components/VerbPicker.tsx | 6 ++++++ src/lib/phrase-building/render-vp.ts | 18 ++++++++++++++++-- src/types/gen-g.d.ts | 9 ++++++++- yarn.lock | 8 ++++---- 5 files changed, 35 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index d24f2a8..819f62d 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "dependencies": { "@fortawesome/fontawesome-free": "^5.15.4", "@lingdocs/lingdocs-main": "^0.2.0", - "@lingdocs/pashto-inflector": "^1.5.7", + "@lingdocs/pashto-inflector": "^1.5.9", "@testing-library/jest-dom": "^5.11.4", "@testing-library/react": "^11.1.0", "@testing-library/user-event": "^12.1.10", diff --git a/src/components/VerbPicker.tsx b/src/components/VerbPicker.tsx index f69efac..ff1c8b6 100644 --- a/src/components/VerbPicker.tsx +++ b/src/components/VerbPicker.tsx @@ -29,6 +29,12 @@ const tenseOptions: { label: string, value: VerbTense }[] = [{ }, { label: "continuous past", value: "imperfectivePast", +}, { + label: "habitual simp. past.", + value: "habitualPerfectivePast", +}, { + label: "habitual cont. past.", + value: "habitualImperfectivePast", }]; // type Filters = { diff --git a/src/lib/phrase-building/render-vp.ts b/src/lib/phrase-building/render-vp.ts index 62a1eae..940a424 100644 --- a/src/lib/phrase-building/render-vp.ts +++ b/src/lib/phrase-building/render-vp.ts @@ -201,6 +201,14 @@ function renderEnglishVPBase({ subjectPerson, object, vs }: { : (n ? ` did not ${ec[0]}` : ` ${ec[3]}`) }` ]), + habitualPerfectivePast: (s: T.Person, ec: T.EnglishVerbConjugationEc, n: boolean) => ([ + `$SUBJ would${n ? " not" : ""} ${isToBe(ec) ? "be" : ec[0]}`, + `$SUBJ used to${n ? " not" : ""} ${isToBe(ec) ? "be" : ec[0]}`, + ]), + habitualImperfectivePast: (s: T.Person, ec: T.EnglishVerbConjugationEc, n: boolean) => ([ + `$SUBJ would${n ? " not" : ""} ${isToBe(ec) ? "be" : ec[0]}`, + `$SUBJ used to${n ? " not" : ""} ${isToBe(ec) ? "be" : ec[0]}`, + ]), }; const base = builders[tense](subjectPerson, ec, vs.negative); return base.map(b => `${b}${typeof object === "object" ? " $OBJ" : ""}${ep ? ` ${ep}` : ""}`); @@ -324,6 +332,12 @@ function getTenseVerbForm(conj: T.VerbConjugation, tense: VerbTense): T.VerbForm if (tense === "perfectivePast") { return conj.perfective.past; } + if (tense === "habitualImperfectivePast") { + return conj.imperfective.habitualPast; + } + if (tense === "habitualPerfectivePast") { + return conj.perfective.habitualPast; + } throw new Error("unknown tense"); } @@ -395,10 +409,10 @@ function isFirstOrSecondPersPronoun(o: "none" | NPSelection | T.Person.ThirdPlur } function isPerfective(t: VerbTense): boolean { - if (t === "present" || t === "imperfectiveFuture" || t === "imperfectivePast") { + if (t === "present" || t === "imperfectiveFuture" || t === "imperfectivePast" || t === "habitualImperfectivePast") { return false; } - if (t === "perfectiveFuture" || t === "subjunctive" || t === "perfectivePast") { + if (t === "perfectiveFuture" || t === "subjunctive" || t === "perfectivePast" || t === "habitualPerfectivePast") { return true; } throw new Error("tense not implemented yet"); diff --git a/src/types/gen-g.d.ts b/src/types/gen-g.d.ts index e8a7946..7370872 100644 --- a/src/types/gen-g.d.ts +++ b/src/types/gen-g.d.ts @@ -26,7 +26,14 @@ type VPRendered = { englishBase?: string[], } -type VerbTense = "present" | "subjunctive" | "perfectiveFuture" | "imperfectiveFuture" | "perfectivePast" | "imperfectivePast"; +type VerbTense = "present" + | "subjunctive" + | "perfectiveFuture" + | "imperfectiveFuture" + | "perfectivePast" + | "imperfectivePast" + | "habitualPerfectivePast" + | "habitualImperfectivePast"; type VerbSelection = { type: "verb", diff --git a/yarn.lock b/yarn.lock index cde0aa6..9ae4394 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1684,10 +1684,10 @@ pbf "^3.2.1" rambda "^6.7.0" -"@lingdocs/pashto-inflector@^1.5.7": - version "1.5.7" - resolved "https://npm.lingdocs.com/@lingdocs%2fpashto-inflector/-/pashto-inflector-1.5.7.tgz#bf13805208ed6d62eee6f11e809baef7c603a124" - integrity sha512-4SS8Qgab2RkDAup4ODxA3J5R0nHHgUj/9grVO0zozq36lFwuvARhsSNp9kPPTAb++1kih7yKyW7HG5NGYavSlw== +"@lingdocs/pashto-inflector@^1.5.9": + version "1.5.9" + resolved "https://npm.lingdocs.com/@lingdocs%2fpashto-inflector/-/pashto-inflector-1.5.9.tgz#a5d13b71b39f989aab97fc86aff8e586404a5cde" + integrity sha512-ApWnlTwutQbgbXzh7kCwUJ3nVUISgd8C4O0pkIMIZwkXX8/3ItBEm4+9tHuvuIqBW3qrIDa7+iUNk957Lr39mw== dependencies: classnames "^2.2.6" pbf "^3.2.1"