From ddcc8011ccfe05b190399f28b01be3de7a2d4dde Mon Sep 17 00:00:00 2001 From: lingdocs <71590811+lingdocs@users.noreply.github.com> Date: Sat, 9 Oct 2021 09:47:46 -0400 Subject: [PATCH] also inflect numbers --- package.json | 2 +- src/lib/pashto-inflector.test.ts | 18 ++++++++++++++++++ src/lib/pashto-inflector.ts | 2 +- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index c914b48..9f8f061 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@lingdocs/pashto-inflector", - "version": "1.1.5", + "version": "1.1.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/pashto-inflector.test.ts b/src/lib/pashto-inflector.test.ts index 8a96621..b5240b0 100644 --- a/src/lib/pashto-inflector.test.ts +++ b/src/lib/pashto-inflector.test.ts @@ -202,6 +202,24 @@ const adjectives: Array<{ }, }, }, + // numbers should inflect just like adjectives + { + in: {"ts":1588688995113,"i":8176,"p":"شپږ","f":"shpuG","g":"shpug","e":"six","c":"num."}, + out: { + inflections: { + masc: [ + [{ p: "شپږ", f: "shpuG" }], + [{ p: "شپږ", f: "shpuG" }], + [{ p: "شپږو", f: "shpuGo" }], + ], + fem: [ + [{ p: "شپږه", f: "shpuGa" }], + [{ p: "شپږې", f: "shpuGe" }], + [{ p: "شپږو", f: "shpuGo" }], + ], + }, + }, + }, // without accents { in: {"ts":1527812796,"i":8574,"p":"ښه","f":"xu","g":"xu","e":"good","c":"adj."}, diff --git a/src/lib/pashto-inflector.ts b/src/lib/pashto-inflector.ts index 429ac96..bc5e44d 100644 --- a/src/lib/pashto-inflector.ts +++ b/src/lib/pashto-inflector.ts @@ -51,7 +51,7 @@ export function inflectWord(word: T.DictionaryEntry): T.InflectorOutput { if (w.c && w.c.includes("pl.")) { return handlePluralNoun(w); } - if (w.c && (w.c.includes("adj.") || w.c.includes("unisex"))) { + if (w.c && (w.c.includes("adj.") || w.c.includes("unisex") || w.c.includes("num"))) { return handleUnisexWord(w); } if (w.c && (w.c.includes("n. m."))) {