From 8d4ced1ddfebdc5c3b844bab9cb324b4e2743da1 Mon Sep 17 00:00:00 2001 From: Denis Shabalin <56205890+ru-danko@users.noreply.github.com> Date: Mon, 24 Jun 2024 17:45:10 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20declension=20of=20words=20"obuv"=20and?= =?UTF-8?q?=20"=C5=BEolv"=20repaired=20(#44)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../__tests__/__snapshots__/feminine.test.ts.snap | 14 +++++++------- src/noun/declensionNoun.ts | 11 +++++++---- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/noun/__tests__/__snapshots__/feminine.test.ts.snap b/src/noun/__tests__/__snapshots__/feminine.test.ts.snap index 3974fb7..444d101 100644 --- a/src/noun/__tests__/__snapshots__/feminine.test.ts.snap +++ b/src/noun/__tests__/__snapshots__/feminine.test.ts.snap @@ -54142,7 +54142,7 @@ exports[`noun feminine 20836 1`] = ` exports[`noun feminine 20837 1`] = ` { "acc": [ - "žȯlȯv", + "žȯlv", "žȯlvi", ], "dat": [ @@ -54162,11 +54162,11 @@ exports[`noun feminine 20837 1`] = ` "žȯlvah", ], "nom": [ - "žȯlȯv", + "žȯlv", "žȯlvi", ], "voc": [ - "žȯlȯv", + "žȯlv", "žȯlvi", ], } @@ -57949,7 +57949,7 @@ exports[`noun feminine 22759 1`] = ` exports[`noun feminine 22760 1`] = ` { "acc": [ - "obuȯv", + "obuv", "obuvi", ], "dat": [ @@ -57961,7 +57961,7 @@ exports[`noun feminine 22760 1`] = ` "obuvij", ], "ins": [ - "obuȯvjų", + "obuvjų", "obuvami", ], "loc": [ @@ -57969,11 +57969,11 @@ exports[`noun feminine 22760 1`] = ` "obuvah", ], "nom": [ - "obuȯv", + "obuv", "obuvi", ], "voc": [ - "obuȯv", + "obuv", "obuvi", ], } diff --git a/src/noun/declensionNoun.ts b/src/noun/declensionNoun.ts index d170f27..5bd646a 100644 --- a/src/noun/declensionNoun.ts +++ b/src/noun/declensionNoun.ts @@ -5,6 +5,7 @@ import { declensionAdjective } from '../adjective'; import { inferFluentVowel, markFluentVowel } from '../common'; import type { Noun } from '../partOfSpeech'; +import { VOWELS } from '../substitutions'; import { removeBrackets, replaceStringAt } from '../utils'; import { establishGender } from './establishGender'; @@ -284,9 +285,7 @@ function nominative_sg(noun: string, root: string, gender: string) { if (gender == 'f2') { result = root; } - if (gender == 'f3' && root.endsWith('v')) { - result = root.substring(0, root.length - 1) + 'ȯv'; - } else if (gender == 'f3') { + if (gender == 'f3') { result = noun; } else if (gender == 'm3' && root == 'dn') { result = 'den / denj'; @@ -362,7 +361,11 @@ function instrumental_sg(root: string, gender: string) { result = root + 'ojų'; } else if (gender == 'f2') { result = root + 'jų'; - } else if (gender == 'f3' && root.endsWith('v')) { + } else if ( + gender == 'f3' && + root.endsWith('v') && + !VOWELS.has(root.slice(-2, -1)) + ) { result = root.substring(0, root.length - 1) + 'ȯvjų'; } else if (gender == 'f3') { result = root + 'jų';