From 81086aafc8e052edee9dab08a1de776a0f0148da Mon Sep 17 00:00:00 2001 From: adueck Date: Sat, 4 Jan 2025 21:11:20 -0500 Subject: [PATCH] fixed kRaay shee thing --- src/lib/src/new-verb-engine/render-verb.ts | 1 - .../new-verb-engine/roots-and-stems.test.ts | 21 ++++++++++++++- .../src/new-verb-engine/roots-and-stems.ts | 3 ++- src/lib/src/new-verb-engine/rs-helpers.ts | 26 ++++++++++++++++--- 4 files changed, 44 insertions(+), 7 deletions(-) diff --git a/src/lib/src/new-verb-engine/render-verb.ts b/src/lib/src/new-verb-engine/render-verb.ts index d08f983..cd35f0e 100644 --- a/src/lib/src/new-verb-engine/render-verb.ts +++ b/src/lib/src/new-verb-engine/render-verb.ts @@ -150,7 +150,6 @@ export function renderVerb({ const transitive = object !== undefined; const king = transitive && isPast ? object : subject; const base = isPast ? "root" : "stem"; - // #1 get the appropriate root / stem const [vHead, rest] = getRootStem({ verb, diff --git a/src/lib/src/new-verb-engine/roots-and-stems.test.ts b/src/lib/src/new-verb-engine/roots-and-stems.test.ts index e518659..a48b225 100644 --- a/src/lib/src/new-verb-engine/roots-and-stems.test.ts +++ b/src/lib/src/new-verb-engine/roots-and-stems.test.ts @@ -2251,8 +2251,27 @@ describe("passive roots and stems", () => { type: "welded", left: { type: "VB", - ps: [{ p: "کړل", f: "kRul" }], + ps: [ + { p: "کړل", f: "kRul" }, + { + f: "kRulay", + p: "کړلی", + }, + { + f: "kRulaay", + p: "کړلای", + }, + { + f: "kRay", + p: "کړی", + }, + { + f: "kRaay", + p: "کړای", + }, + ], }, + right: { type: "VB", ps: { diff --git a/src/lib/src/new-verb-engine/roots-and-stems.ts b/src/lib/src/new-verb-engine/roots-and-stems.ts index 72b6715..22c2130 100644 --- a/src/lib/src/new-verb-engine/roots-and-stems.ts +++ b/src/lib/src/new-verb-engine/roots-and-stems.ts @@ -30,6 +30,7 @@ import { makeComplement, vTransitivity, isKedul, + addOptionalTailsToPassive, } from "./rs-helpers"; import { inflectPattern3 } from "./new-inflectors"; import { fmapSingleOrLengthOpts } from "../fp-ps"; @@ -458,7 +459,7 @@ function getPassiveRs( genderNumber: T.GenderNumber ): [[] | [T.VHead], [T.VB]] { const [vHead, [basicRoot]] = getRoot(verb, genderNumber, aspect); - const longRoot = getLongVB(basicRoot); + const longRoot = addOptionalTailsToPassive(getLongVB(basicRoot), aspect); const kedulVba = getRootStem({ verb: statVerb.intransitive, aspect, diff --git a/src/lib/src/new-verb-engine/rs-helpers.ts b/src/lib/src/new-verb-engine/rs-helpers.ts index d6d433b..fd26fd6 100644 --- a/src/lib/src/new-verb-engine/rs-helpers.ts +++ b/src/lib/src/new-verb-engine/rs-helpers.ts @@ -209,15 +209,16 @@ export function tlulPerfectiveStem(person: { ]; } +export const abilityEnding: T.PsString[] = [ + { p: "ی", f: "ay" }, + { p: "ای", f: "aay" }, +]; + export function addAbilityEnding( vb: T.VB, verb: T.VerbEntry, aspect: T.Aspect ): T.VBP { - const abilityEnding: T.PsString[] = [ - { p: "ی", f: "ay" }, - { p: "ای", f: "aay" }, - ]; if (vb.type === "welded") { return { ...vb, @@ -301,6 +302,23 @@ export function possiblePPartLengths(vba: T.VBNoLenghts): T.VB { return vba; } +export function addOptionalTailsToPassive( + vb: T.VBNoLenghts, + aspect: T.Aspect +): T.VBNoLenghts { + if (aspect !== "perfective" || vb.type !== "VB" || vb.ps[0].p !== "کړل") { + return vb; + } + return { + ...vb, + ps: [ + ...vb.ps, + ...verbEndingConcat(vb.ps, abilityEnding), + ...verbEndingConcat([{ p: "کړ", f: "kR" }], abilityEnding), + ], + }; +} + export function getLongVB(vb: T.VB): T.VBNoLenghts { if (vb.type === "welded") { return {