From 1f8011eb26a4a705e46e021db72fac717ec730d5 Mon Sep 17 00:00:00 2001 From: Bill D Date: Wed, 10 Mar 2021 20:51:40 +0400 Subject: [PATCH] more --- package.json | 2 +- src/lib/misc-helpers.ts | 13 +++++++++++++ src/library.ts | 8 ++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 674b92c..17297fc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@lingdocs/pashto-inflector", - "version": "0.1.8", + "version": "0.1.9", "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 25c39b4..6a455fb 100644 --- a/src/lib/misc-helpers.ts +++ b/src/lib/misc-helpers.ts @@ -193,6 +193,19 @@ export function isSentenceForm(f: any): boolean { return Array.isArray(f) && "p" in f[0]; } +export function isNounAdjOrVerb(entry: T.DictionaryEntry): "nounAdj" | "verb" | false { + if (!entry.c) { + return false; + } + if (entry.c.includes("adj.") || entry.c.includes("n. m.") || entry.c.includes("n. f.")) { + return "nounAdj"; + } + if (entry.c.slice(0, 3) === "v. ") { + return "verb"; + } + return false; +} + // not being used // export function isImperativeBlock(f: any): boolean { // function isPersonLine(g: any): boolean { diff --git a/src/library.ts b/src/library.ts index 0e80144..c6c8094 100644 --- a/src/library.ts +++ b/src/library.ts @@ -50,6 +50,12 @@ import { readDictionaryInfo, writeDictionaryInfo, } from "./lib/protobuf"; +import { + pashtoConsonants, +} from "./lib/pashto-consonants"; +import { + isNounAdjOrVerb, +} from "./lib/misc-helpers"; import defaultTextOptions from "./lib/default-text-options"; import * as grammarUnits from "./lib/grammar-units"; import * as Types from "./types"; @@ -67,6 +73,7 @@ export { convertAfToPkSpelling, convertPkToAfSpelling, validateEntry, + isNounAdjOrVerb, // protobuf helpers readDictionary, writeDictionary, @@ -86,6 +93,7 @@ export { ButtonSelect, // OTHER grammarUnits, + pashtoConsonants, defaultTextOptions, dictionaryEntryTextFields, dictionaryEntryNumberFields,