From 4de6e718ff9cfcc5ca7669361d3edee4f1d93d63 Mon Sep 17 00:00:00 2001 From: Greg Shuflin Date: Sun, 12 Sep 2021 00:28:33 -0700 Subject: [PATCH] Fix up some declension issues --- src/saimiar_morphology.js | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/src/saimiar_morphology.js b/src/saimiar_morphology.js index 9582949..1ee9b1d 100644 --- a/src/saimiar_morphology.js +++ b/src/saimiar_morphology.js @@ -1,12 +1,13 @@ -const vowelLetters = ['a', 'e', 'ê', 'i', 'o', 'ô', 'u', 'y', 'ø']; - const rootEndingPair = (str) => { return { root: str.slice(0, -1), ending: str.slice(-1) }; }; function declineSaimiar(entry) { - const sai = entry.sai; + const split = entry.sai.split(" "); + const sai = split.at(-1); const morph = entry.morph_type; + + let declined; if (morph == '-V') { return vowelDeclension(sai); } else if (morph == '-a/i') { @@ -69,12 +70,26 @@ function consonantDeclension(sai) { }; } +const vowels = ['a', 'e', 'ê', 'i', 'o', 'ô', 'u', 'y']; + function initalDeclension(sai) { - const { root, ending } = rootEndingPair(sai); + const initial = sai.slice(0,1); + const root = sai.slice(1); + + const finalRootSound = root.slice(-1); + const finalVowel = vowels.includes(finalRootSound); + const instEnding = finalVowel ? "ŕø" : "ar"; + const relEnding = finalVowel ? "źi" : "ai"; + return { - "abs": `${root}${ending}`, - "erg": `${root}${ending}na`, - "adp": `${root}${ending}s`, + "abs": `${initial}${root}`, + "erg": `da${root}`, + "adp": `i${root}`, + "all": `so${root}`, + "loc": `xa${root}`, + "ell": `tlê${root}`, + "inst": `i${root}${instEnding}`, + "rel": `${initial}${root}${relEnding}`, }; }