2019-07-23 02:54:10 -07:00
|
|
|
const rootEndingPair = (str) => {
|
2021-09-11 22:34:15 -07:00
|
|
|
return { root: str.slice(0, -1), ending: str.slice(-1) };
|
2019-07-23 02:54:10 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
function declineSaimiar(entry) {
|
2021-09-11 22:34:15 -07:00
|
|
|
const sai = entry.sai;
|
|
|
|
const morph = entry.morph_type;
|
|
|
|
if (morph == "-V") {
|
|
|
|
return vowelDeclension(sai);
|
|
|
|
} else if (morph == "-a/i") {
|
|
|
|
return aiDeclension(sai);
|
|
|
|
} else if (morph == "e-") {
|
|
|
|
return initalDeclension(sai);
|
|
|
|
} else if (morph == "-C") {
|
|
|
|
return consonantDeclension(sai);
|
|
|
|
} else {
|
|
|
|
console.warn(`Can't decline entry '${entry.sai}'`);
|
|
|
|
console.log(entry);
|
|
|
|
return null;
|
|
|
|
}
|
2019-07-23 02:54:10 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
function vowelDeclension(sai) {
|
2021-09-11 22:34:15 -07:00
|
|
|
const { root, ending } = rootEndingPair(sai);
|
|
|
|
const adpEnding = ending == "u" ? "ys" : `${ending}s`;
|
2021-09-11 20:14:59 -07:00
|
|
|
|
2021-09-11 22:34:15 -07:00
|
|
|
return {
|
|
|
|
"abs": `${root}${ending}`,
|
|
|
|
"erg": `${root}${ending}na`,
|
|
|
|
"adp": `${root}${adpEnding}`,
|
|
|
|
"all": `so${root}${adpEnding}`,
|
|
|
|
"loc": `${root}${ending}xa`,
|
|
|
|
"ell": `tlê${root}${adpEnding}`,
|
|
|
|
"inst": `${root}${ending}ŕa`,
|
|
|
|
"rel": `${root}${ending}źi`
|
|
|
|
};
|
2019-07-23 02:54:10 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
function aiDeclension(sai) {
|
2021-09-11 22:34:15 -07:00
|
|
|
const { root, ending } = rootEndingPair(sai);
|
|
|
|
return {
|
|
|
|
"abs": `${root}${ending}`,
|
|
|
|
"erg": `${root}iad`,
|
|
|
|
"adp": `${root}i`,
|
|
|
|
"all": `so${root}i`,
|
|
|
|
"loc": `${root}iath`,
|
|
|
|
"ell": `tlê${root}i`,
|
|
|
|
"inst": `${root}iar`,
|
|
|
|
"rel": `${root}iai`
|
|
|
|
};
|
2019-07-23 02:54:10 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
function consonantDeclension(sai) {
|
2021-09-11 22:34:15 -07:00
|
|
|
const split = rootEndingPair(sai);
|
|
|
|
const root = split.ending == "ø" ? split.root : sai;
|
|
|
|
const absFinal = split.ending == "ø" ? "ø" : "";
|
2021-09-11 20:14:59 -07:00
|
|
|
|
2021-09-11 22:34:15 -07:00
|
|
|
return {
|
|
|
|
"abs": `${root}${absFinal}`,
|
|
|
|
"erg": `${root}ad`,
|
|
|
|
"adp": `${root}e`,
|
|
|
|
"all": `so${root}i`,
|
|
|
|
"loc": `${root}ak`,
|
|
|
|
"ell": `tlê${root}i`,
|
|
|
|
"inst": `${root}ar`,
|
|
|
|
"rel": `${root}ai`
|
|
|
|
};
|
2019-07-23 02:54:10 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
function initalDeclension(sai) {
|
2021-09-11 22:34:15 -07:00
|
|
|
const { root, ending } = rootEndingPair(sai);
|
|
|
|
return {
|
|
|
|
"abs": `${root}${ending}`,
|
|
|
|
"erg": `${root}${ending}na`,
|
|
|
|
"adp": `${root}${ending}s`,
|
|
|
|
};
|
2019-07-23 02:54:10 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
export { declineSaimiar };
|