From 7bb5f46bb97aaf395b8c22bf424d90eafdaa99e7 Mon Sep 17 00:00:00 2001 From: lingdocs <71590811+lingdocs@users.noreply.github.com> Date: Fri, 6 May 2022 15:54:15 -0500 Subject: [PATCH] up --- package.json | 2 +- src/lib/misc-helpers.ts | 7 +++++++ src/lib/phrase-building/compile.ts | 2 +- src/library.ts | 6 ++++++ 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 89afea0..e517d00 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@lingdocs/pashto-inflector", - "version": "2.4.5", + "version": "2.4.6", "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/lib/misc-helpers.ts b/src/lib/misc-helpers.ts index e5a5e9a..361adab 100644 --- a/src/lib/misc-helpers.ts +++ b/src/lib/misc-helpers.ts @@ -240,3 +240,10 @@ export function parseEc(ec: string): T.EnglishVerbConjugationEc { ? [items[0], items[1], items[2], items[3], items[4]] : makeRegularConjugations(items[0]); } + +export function chooseLength(x: T.SingleOrLengthOpts, length: "long" | "short"): N { + if ("long" in x) { + return x[length]; + } + return x; +} \ No newline at end of file diff --git a/src/lib/phrase-building/compile.ts b/src/lib/phrase-building/compile.ts index 1e5b676..400111e 100644 --- a/src/lib/phrase-building/compile.ts +++ b/src/lib/phrase-building/compile.ts @@ -257,7 +257,7 @@ function arrangeVerbWNegative(head: T.PsString | undefined, restRaw: T.PsString[ export function compileEP(EP: T.EPRendered): { ps: T.SingleOrLengthOpts, e?: string[] }; export function compileEP(EP: T.EPRendered, combineLengths: true, blankOut?: { equative: boolean }): { ps: T.PsString[], e?: string[] }; -export function compileEP(EP: T.EPRendered, combineLengths?: true, blankOut?: { equative: boolean }): { ps: T.SingleOrLengthOpts, e?: string[] } { +export function compileEP(EP: T.EPRendered, combineLengths?: boolean, blankOut?: { equative: boolean }): { ps: T.SingleOrLengthOpts, e?: string[] } { const { kids, NPs } = getEPSegmentsAndKids(EP); const equative = EP.equative.ps; const psResult = compileEPPs({ diff --git a/src/library.ts b/src/library.ts index 3ef01a7..61ea6a3 100644 --- a/src/library.ts +++ b/src/library.ts @@ -97,7 +97,11 @@ import { parseEc, personNumber, randFromArray, + chooseLength, } from "./lib/misc-helpers"; +import { + flattenLengths, +} from "./lib/phrase-building/segment"; import { simplifyPhonetics, } from "./lib/simplify-phonetics"; @@ -193,6 +197,8 @@ export { renderVP, compileEP, compileVP, + chooseLength, + flattenLengths, // protobuf helpers readDictionary, writeDictionary,