Fix up some declension issues

This commit is contained in:
Greg Shuflin 2021-09-12 00:28:33 -07:00
parent 188abe2b93
commit 4de6e718ff

View File

@ -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}`,
};
}