Skip to content

Commit

Permalink
fix: declension of words "obuv" and "žolv" repaired (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
ru-danko authored Jun 24, 2024
1 parent 25e9f63 commit 8d4ced1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
14 changes: 7 additions & 7 deletions src/noun/__tests__/__snapshots__/feminine.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -54142,7 +54142,7 @@ exports[`noun feminine 20836 1`] = `
exports[`noun feminine 20837 1`] = `
{
"acc": [
"žȯlȯv",
"žȯlv",
"žȯlvi",
],
"dat": [
Expand All @@ -54162,11 +54162,11 @@ exports[`noun feminine 20837 1`] = `
"žȯlvah",
],
"nom": [
"žȯlȯv",
"žȯlv",
"žȯlvi",
],
"voc": [
"žȯlȯv",
"žȯlv",
"žȯlvi",
],
}
Expand Down Expand Up @@ -57949,7 +57949,7 @@ exports[`noun feminine 22759 1`] = `
exports[`noun feminine 22760 1`] = `
{
"acc": [
"obuȯv",
"obuv",
"obuvi",
],
"dat": [
Expand All @@ -57961,19 +57961,19 @@ exports[`noun feminine 22760 1`] = `
"obuvij",
],
"ins": [
"obuȯvjų",
"obuvjų",
"obuvami",
],
"loc": [
"obuvi",
"obuvah",
],
"nom": [
"obuȯv",
"obuv",
"obuvi",
],
"voc": [
"obuȯv",
"obuv",
"obuvi",
],
}
Expand Down
11 changes: 7 additions & 4 deletions src/noun/declensionNoun.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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';
Expand Down Expand Up @@ -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ų';
Expand Down

0 comments on commit 8d4ced1

Please sign in to comment.