From c042f66fc8a26102bbae4a2ac354c553339889f7 Mon Sep 17 00:00:00 2001 From: lingdocs <71590811+lingdocs@users.noreply.github.com> Date: Tue, 14 Sep 2021 19:04:45 +0400 Subject: [PATCH] inflector with plural noun inflection!! --- package.json | 2 +- src/components/InflectionsTable.tsx | 27 ++++++---- src/lib/diacritics.ts | 4 +- src/lib/p-text-helpers.ts | 16 ++++-- src/lib/pashto-inflector.ts | 8 ++- src/lib/verb-conjugation.ts | 4 +- src/lib/verb-info.ts | 77 ++++++++++++++--------------- src/library.ts | 4 +- 8 files changed, 80 insertions(+), 62 deletions(-) diff --git a/package.json b/package.json index 81e027e..770ec9b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@lingdocs/pashto-inflector", - "version": "0.9.6", + "version": "1.0.0", "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/components/InflectionsTable.tsx b/src/components/InflectionsTable.tsx index 264eee1..bb34829 100644 --- a/src/components/InflectionsTable.tsx +++ b/src/components/InflectionsTable.tsx @@ -11,11 +11,14 @@ import Pashto from "./Pashto"; import { Modal } from "react-bootstrap"; import TableCell from "./TableCell"; import * as T from "../types"; +import { isPluralInflections } from "../lib/p-text-helpers"; -const explanation = (inf: T.Inflections, textOptions: T.TextOptions) => { - // @ts-ignore - const w = inf["masc" in inf ? "masc" : "fem"][0][0]; - return <> +const explanation = (inf: T.Inflections | T.PluralInflections, textOptions: T.TextOptions) => { + const isPluralInfs = isPluralInflections(inf); + const w = "masc" in inf + ? inf.masc[0][0] + : inf.fem[0][0]; + return !isPluralInfs ? <>

In Pashto, nouns, pronouns, and adjectives get inflected when they are either: