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", "name": "@lingdocs/pashto-inflector",
"version": "2.4.5", "version": "2.4.6",
"author": "lingdocs.com", "author": "lingdocs.com",
"description": "A Pashto inflection and verb conjugation engine, inculding React components for displaying Pashto text, inflections, and conjugations", "description": "A Pashto inflection and verb conjugation engine, inculding React components for displaying Pashto text, inflections, and conjugations",
"homepage": "https://verbs.lingdocs.com", "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]] ? [items[0], items[1], items[2], items[3], items[4]]
: makeRegularConjugations(items[0]); : 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): { 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.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 { kids, NPs } = getEPSegmentsAndKids(EP);
const equative = EP.equative.ps; const equative = EP.equative.ps;
const psResult = compileEPPs({ const psResult = compileEPPs({

View File

@ -97,7 +97,11 @@ import {
parseEc, parseEc,
personNumber, personNumber,
randFromArray, randFromArray,
chooseLength,
} from "./lib/misc-helpers"; } from "./lib/misc-helpers";
import {
flattenLengths,
} from "./lib/phrase-building/segment";
import { import {
simplifyPhonetics, simplifyPhonetics,
} from "./lib/simplify-phonetics"; } from "./lib/simplify-phonetics";
@ -193,6 +197,8 @@ export {
renderVP, renderVP,
compileEP, compileEP,
compileVP, compileVP,
chooseLength,
flattenLengths,
// protobuf helpers // protobuf helpers
readDictionary, readDictionary,
writeDictionary, writeDictionary,