This commit is contained in:
lingdocs 2022-05-06 15:54:15 -05:00
parent 65c94c8810
commit 7bb5f46bb9
4 changed files with 15 additions and 2 deletions

View File

@ -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",

View File

@ -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<N>(x: T.SingleOrLengthOpts<N>, length: "long" | "short"): N {
if ("long" in x) {
return x[length];
}
return x;
}

View File

@ -257,7 +257,7 @@ function arrangeVerbWNegative(head: T.PsString | undefined, restRaw: T.PsString[
export function compileEP(EP: T.EPRendered): { ps: T.SingleOrLengthOpts<T.PsString[]>, 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<T.PsString[]>, e?: string[] } {
export function compileEP(EP: T.EPRendered, combineLengths?: boolean, blankOut?: { equative: boolean }): { ps: T.SingleOrLengthOpts<T.PsString[]>, e?: string[] } {
const { kids, NPs } = getEPSegmentsAndKids(EP);
const equative = EP.equative.ps;
const psResult = compileEPPs({

View File

@ -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,