From 4a0cd55830ac384bd3b6ede7fb65cd4d42d9f6ac Mon Sep 17 00:00:00 2001 From: lingdocs <71590811+lingdocs@users.noreply.github.com> Date: Mon, 5 Jul 2021 18:39:20 +0300 Subject: [PATCH] bug --- package.json | 2 +- src/lib/misc-helpers.test.ts | 1 + src/lib/misc-helpers.ts | 5 ++++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 6cad6fd..58dbc33 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@lingdocs/pashto-inflector", - "version": "0.5.7", + "version": "0.5.8", "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.test.ts b/src/lib/misc-helpers.test.ts index 8581214..5ec04d1 100644 --- a/src/lib/misc-helpers.test.ts +++ b/src/lib/misc-helpers.test.ts @@ -14,6 +14,7 @@ test("parseEc should work", () => { expect(parseEc("walk")).toEqual(["walk", "walks", "walking", "walked", "walked"]); expect(parseEc("scare")).toEqual(["scare", "scares", "scaring", "scared", "scared"]); expect(parseEc("study")).toEqual(["study","studies","studying","studied","studied"]); + expect(parseEc("play")).toEqual(["play","plays","playing","played","played"]); expect(parseEc("sew,sews,sewing,sewed,sown")).toEqual(["sew", "sews", "sewing", "sewed", "sown"]); expect(parseEc(" sew, sews,sewing ,sewed, sown")).toEqual(["sew", "sews", "sewing", "sewed", "sown"]); }); \ No newline at end of file diff --git a/src/lib/misc-helpers.ts b/src/lib/misc-helpers.ts index 1003507..b432757 100644 --- a/src/lib/misc-helpers.ts +++ b/src/lib/misc-helpers.ts @@ -215,8 +215,11 @@ export function isNounAdjOrVerb(entry: T.DictionaryEntry): "nounAdj" | "verb" | * @returns */ export function parseEc(ec: string): T.EnglishVerbConjugationEc { + function isVowel(s: string): boolean { + return ["a", "e", "i", "o", "u"].includes(s); + } function makeRegularConjugations(s: string): T.EnglishVerbConjugationEc { - if (s.slice(-1) === "y") { + if ((s.slice(-1) === "y") && !isVowel(s.slice(-2)[0])) { const b = s.slice(0, -1); return [`${s}`, `${b}ies`, `${s}ing`, `${b}ied`, `${b}ied`]; }