From 7db00e2ac29fc441ba79b79bcc8e3a052d5e6c78 Mon Sep 17 00:00:00 2001 From: lingdocs <71590811+lingdocs@users.noreply.github.com> Date: Sat, 7 May 2022 00:52:56 -0500 Subject: [PATCH] more --- package.json | 2 +- src/lib/misc-helpers.ts | 1 + src/lib/phrase-building/np-tools.ts | 3 ++- src/library.ts | 6 ++++++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index e517d00..597db94 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@lingdocs/pashto-inflector", - "version": "2.4.6", + "version": "2.4.7", "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 361adab..80b863c 100644 --- a/src/lib/misc-helpers.ts +++ b/src/lib/misc-helpers.ts @@ -164,6 +164,7 @@ export function randFromArray(arr: M[]): M { export const isFirstPerson = (p: T.Person) => [0, 1, 6, 7].includes(p); export const isSecondPerson = (p: T.Person) => [2, 3, 8, 9].includes(p); +export const isThirdPerson = (p: T.Person) => [4, 5, 10, 11].includes(p); export function incrementPerson(p: T.Person): T.Person { return (p + 1) % 12; diff --git a/src/lib/phrase-building/np-tools.ts b/src/lib/phrase-building/np-tools.ts index 1b31c48..1f86de1 100644 --- a/src/lib/phrase-building/np-tools.ts +++ b/src/lib/phrase-building/np-tools.ts @@ -95,7 +95,8 @@ function addArticlesAndAdjs(np: T.Rendered): string | undefined if (!curr.e) throw new Error("no english for adjective"); return accum + curr.e + " "; }, ""); - return `${articles}${adjs}${word}`; + const genderTag = np.genderCanChange ? (np.gender === "fem" ? " (f.)" : " (m.)") : ""; + return `${articles}${adjs}${word}${genderTag}`; } catch (e) { return undefined; } diff --git a/src/library.ts b/src/library.ts index 61ea6a3..1235012 100644 --- a/src/library.ts +++ b/src/library.ts @@ -98,6 +98,9 @@ import { personNumber, randFromArray, chooseLength, + isFirstPerson, + isSecondPerson, + isThirdPerson, } from "./lib/misc-helpers"; import { flattenLengths, @@ -199,6 +202,9 @@ export { compileVP, chooseLength, flattenLengths, + isFirstPerson, + isSecondPerson, + isThirdPerson, // protobuf helpers readDictionary, writeDictionary,