Files
neuron/dist/morphology-la.c
will.anderson 48ecd83421 fix: restore elb build — import paths, morphology deps, C master declarations header
- Fix wrong ELP import paths in soul.el, elp-input.el, studio.el
  (../foundation/elp/src → ../foundation/el/elp/src)
- Add missing import "morphology.el" to all 29 language morphology modules
- Recompile all affected dist/*.c with correct cross-module declarations
- Add dist/elp-c-decls.h: C-level master forward declarations for ELP package
  (enables elb --force-include to resolve undeclared cross-module calls)
2026-05-08 19:43:57 -05:00

1151 lines
29 KiB
C
Generated

#include <stdint.h>
#include <stdlib.h>
#include "el_runtime.h"
el_val_t str_ends(el_val_t s, el_val_t suf);
el_val_t str_last_char(el_val_t s);
el_val_t str_last2(el_val_t s);
el_val_t str_last3(el_val_t s);
el_val_t str_drop_last(el_val_t s, el_val_t n);
el_val_t is_vowel(el_val_t c);
el_val_t morph_apply_suffix(el_val_t base, el_val_t suffix);
el_val_t en_irregular_plural(el_val_t word);
el_val_t en_irregular_singular(el_val_t word);
el_val_t en_irregular_verb(el_val_t base);
el_val_t en_verb_3sg(el_val_t base);
el_val_t en_should_double_final(el_val_t base);
el_val_t en_verb_past(el_val_t base);
el_val_t en_verb_gerund(el_val_t base);
el_val_t en_pluralize_regular(el_val_t singular);
el_val_t en_verb_form(el_val_t base, el_val_t tense, el_val_t person, el_val_t number);
el_val_t agree_determiner(el_val_t det, el_val_t noun);
el_val_t morph_pluralize(el_val_t noun, el_val_t profile);
el_val_t morph_map_canonical(el_val_t verb, el_val_t code);
el_val_t morph_conjugate(el_val_t verb, el_val_t tense, el_val_t person, el_val_t number, el_val_t profile);
el_val_t morph_inflect(el_val_t word, el_val_t features, el_val_t profile);
el_val_t pluralize(el_val_t singular);
el_val_t singularize(el_val_t plural);
el_val_t verb_form(el_val_t base, el_val_t tense, el_val_t person, el_val_t number);
el_val_t irregular_plural(el_val_t word);
el_val_t irregular_singular(el_val_t word);
el_val_t la_str_ends(el_val_t s, el_val_t suf);
el_val_t la_str_drop_last(el_val_t s, el_val_t n);
el_val_t la_str_last_char(el_val_t s);
el_val_t la_str_last2(el_val_t s);
el_val_t la_str_last3(el_val_t s);
el_val_t la_slot(el_val_t person, el_val_t number);
el_val_t la_verb_class(el_val_t verb);
el_val_t la_stem(el_val_t verb, el_val_t vclass);
el_val_t la_perfect_stem(el_val_t verb, el_val_t vclass);
el_val_t la_perfect_ending(el_val_t slot);
el_val_t la_present_ending(el_val_t vclass, el_val_t slot);
el_val_t la_present_form(el_val_t stem, el_val_t vclass, el_val_t slot);
el_val_t la_future_ending_12(el_val_t slot);
el_val_t la_future_ending_34(el_val_t slot);
el_val_t la_future_form(el_val_t stem, el_val_t vclass, el_val_t slot);
el_val_t la_esse_present(el_val_t slot);
el_val_t la_esse_past(el_val_t slot);
el_val_t la_esse_future(el_val_t slot);
el_val_t la_ire_present(el_val_t slot);
el_val_t la_ire_past(el_val_t slot);
el_val_t la_ire_future(el_val_t slot);
el_val_t la_velle_present(el_val_t slot);
el_val_t la_velle_past(el_val_t slot);
el_val_t la_velle_future(el_val_t slot);
el_val_t la_posse_present(el_val_t slot);
el_val_t la_posse_past(el_val_t slot);
el_val_t la_posse_future(el_val_t slot);
el_val_t la_irregular_perfect_stem(el_val_t verb);
el_val_t la_map_canonical(el_val_t verb);
el_val_t la_conjugate(el_val_t verb, el_val_t tense, el_val_t person, el_val_t number);
el_val_t la_declension(el_val_t noun);
el_val_t la_decline_1(el_val_t stem, el_val_t gram_case, el_val_t number);
el_val_t la_decline_2m(el_val_t stem, el_val_t gram_case, el_val_t number);
el_val_t la_decline_2n(el_val_t stem, el_val_t gram_case, el_val_t number);
el_val_t la_decline_3(el_val_t noun, el_val_t gram_case, el_val_t number);
el_val_t la_decline_4(el_val_t stem, el_val_t gram_case, el_val_t number);
el_val_t la_decline_5(el_val_t stem, el_val_t gram_case, el_val_t number);
el_val_t la_decline_2er(el_val_t noun, el_val_t gram_case, el_val_t number);
el_val_t la_decline(el_val_t noun, el_val_t gram_case, el_val_t number);
el_val_t la_noun_phrase(el_val_t noun, el_val_t gram_case, el_val_t number, el_val_t definite);
el_val_t la_str_ends(el_val_t s, el_val_t suf) {
return str_ends_with(s, suf);
return 0;
}
el_val_t la_str_drop_last(el_val_t s, el_val_t n) {
el_val_t len = str_len(s);
if (n >= len) {
return EL_STR("");
}
return str_slice(s, 0, (len - n));
return 0;
}
el_val_t la_str_last_char(el_val_t s) {
el_val_t n = str_len(s);
if (n == 0) {
return EL_STR("");
}
return str_slice(s, (n - 1), n);
return 0;
}
el_val_t la_str_last2(el_val_t s) {
el_val_t n = str_len(s);
if (n < 2) {
return s;
}
return str_slice(s, (n - 2), n);
return 0;
}
el_val_t la_str_last3(el_val_t s) {
el_val_t n = str_len(s);
if (n < 3) {
return s;
}
return str_slice(s, (n - 3), n);
return 0;
}
el_val_t la_slot(el_val_t person, el_val_t number) {
if (str_eq(person, EL_STR("first"))) {
if (str_eq(number, EL_STR("singular"))) {
return 0;
}
return 3;
}
if (str_eq(person, EL_STR("second"))) {
if (str_eq(number, EL_STR("singular"))) {
return 1;
}
return 4;
}
if (str_eq(number, EL_STR("singular"))) {
return 2;
}
return 5;
return 0;
}
el_val_t la_verb_class(el_val_t verb) {
if (la_str_ends(verb, EL_STR("are"))) {
return EL_STR("1");
}
if (la_str_ends(verb, EL_STR("ire"))) {
return EL_STR("4");
}
if (la_str_ends(verb, EL_STR("ere"))) {
el_val_t stem = la_str_drop_last(verb, 3);
el_val_t slen = str_len(stem);
if (slen == 0) {
return EL_STR("3");
}
el_val_t last = str_slice(stem, (slen - 1), slen);
if (str_eq(last, EL_STR("a"))) {
return EL_STR("2");
}
if (str_eq(last, EL_STR("e"))) {
return EL_STR("2");
}
if (str_eq(last, EL_STR("i"))) {
return EL_STR("2");
}
if (str_eq(last, EL_STR("o"))) {
return EL_STR("2");
}
if (str_eq(last, EL_STR("u"))) {
return EL_STR("2");
}
return EL_STR("3");
}
return EL_STR("3");
return 0;
}
el_val_t la_stem(el_val_t verb, el_val_t vclass) {
if (str_eq(vclass, EL_STR("1"))) {
return la_str_drop_last(verb, 3);
}
if (str_eq(vclass, EL_STR("2"))) {
return la_str_drop_last(verb, 2);
}
if (str_eq(vclass, EL_STR("3"))) {
return la_str_drop_last(verb, 3);
}
if (str_eq(vclass, EL_STR("4"))) {
return la_str_drop_last(verb, 2);
}
return la_str_drop_last(verb, 3);
return 0;
}
el_val_t la_perfect_stem(el_val_t verb, el_val_t vclass) {
if (str_eq(vclass, EL_STR("1"))) {
el_val_t pstem = la_str_drop_last(verb, 3);
return el_str_concat(pstem, EL_STR("av"));
}
if (str_eq(vclass, EL_STR("2"))) {
el_val_t pstem = la_str_drop_last(verb, 3);
return el_str_concat(pstem, EL_STR("u"));
}
if (str_eq(vclass, EL_STR("3"))) {
el_val_t pstem = la_str_drop_last(verb, 3);
return pstem;
}
if (str_eq(vclass, EL_STR("4"))) {
el_val_t pstem = la_str_drop_last(verb, 2);
return el_str_concat(pstem, EL_STR("v"));
}
return la_str_drop_last(verb, 3);
return 0;
}
el_val_t la_perfect_ending(el_val_t slot) {
if (slot == 0) {
return EL_STR("i");
}
if (slot == 1) {
return EL_STR("isti");
}
if (slot == 2) {
return EL_STR("it");
}
if (slot == 3) {
return EL_STR("imus");
}
if (slot == 4) {
return EL_STR("istis");
}
return EL_STR("erunt");
return 0;
}
el_val_t la_present_ending(el_val_t vclass, el_val_t slot) {
if (str_eq(vclass, EL_STR("1"))) {
if (slot == 0) {
return EL_STR("o");
}
if (slot == 1) {
return EL_STR("as");
}
if (slot == 2) {
return EL_STR("at");
}
if (slot == 3) {
return EL_STR("amus");
}
if (slot == 4) {
return EL_STR("atis");
}
return EL_STR("ant");
}
if (str_eq(vclass, EL_STR("2"))) {
if (slot == 0) {
return EL_STR("o");
}
if (slot == 1) {
return EL_STR("s");
}
if (slot == 2) {
return EL_STR("t");
}
if (slot == 3) {
return EL_STR("mus");
}
if (slot == 4) {
return EL_STR("tis");
}
return EL_STR("nt");
}
if (str_eq(vclass, EL_STR("3"))) {
if (slot == 0) {
return EL_STR("o");
}
if (slot == 1) {
return EL_STR("is");
}
if (slot == 2) {
return EL_STR("it");
}
if (slot == 3) {
return EL_STR("imus");
}
if (slot == 4) {
return EL_STR("itis");
}
return EL_STR("unt");
}
if (slot == 0) {
return EL_STR("o");
}
if (slot == 1) {
return EL_STR("s");
}
if (slot == 2) {
return EL_STR("t");
}
if (slot == 3) {
return EL_STR("mus");
}
if (slot == 4) {
return EL_STR("tis");
}
return EL_STR("unt");
return 0;
}
el_val_t la_present_form(el_val_t stem, el_val_t vclass, el_val_t slot) {
if (str_eq(vclass, EL_STR("1"))) {
if (slot == 0) {
return el_str_concat(la_str_drop_last(stem, 1), EL_STR("o"));
}
return el_str_concat(stem, la_present_ending(vclass, slot));
}
if (str_eq(vclass, EL_STR("2"))) {
return el_str_concat(stem, la_present_ending(vclass, slot));
}
if (str_eq(vclass, EL_STR("3"))) {
if (slot == 0) {
return el_str_concat(stem, EL_STR("o"));
}
return el_str_concat(stem, la_present_ending(vclass, slot));
}
if (slot == 0) {
return el_str_concat(stem, EL_STR("o"));
}
if (slot == 5) {
return el_str_concat(stem, EL_STR("unt"));
}
return el_str_concat(stem, la_present_ending(vclass, slot));
return 0;
}
el_val_t la_future_ending_12(el_val_t slot) {
if (slot == 0) {
return EL_STR("bo");
}
if (slot == 1) {
return EL_STR("bis");
}
if (slot == 2) {
return EL_STR("bit");
}
if (slot == 3) {
return EL_STR("bimus");
}
if (slot == 4) {
return EL_STR("bitis");
}
return EL_STR("bunt");
return 0;
}
el_val_t la_future_ending_34(el_val_t slot) {
if (slot == 0) {
return EL_STR("am");
}
if (slot == 1) {
return EL_STR("es");
}
if (slot == 2) {
return EL_STR("et");
}
if (slot == 3) {
return EL_STR("emus");
}
if (slot == 4) {
return EL_STR("etis");
}
return EL_STR("ent");
return 0;
}
el_val_t la_future_form(el_val_t stem, el_val_t vclass, el_val_t slot) {
if (str_eq(vclass, EL_STR("1"))) {
return el_str_concat(stem, la_future_ending_12(slot));
}
if (str_eq(vclass, EL_STR("2"))) {
return el_str_concat(stem, la_future_ending_12(slot));
}
if (str_eq(vclass, EL_STR("3"))) {
return el_str_concat(stem, la_future_ending_34(slot));
}
return el_str_concat(stem, la_future_ending_34(slot));
return 0;
}
el_val_t la_esse_present(el_val_t slot) {
if (slot == 0) {
return EL_STR("sum");
}
if (slot == 1) {
return EL_STR("es");
}
if (slot == 2) {
return EL_STR("est");
}
if (slot == 3) {
return EL_STR("sumus");
}
if (slot == 4) {
return EL_STR("estis");
}
return EL_STR("sunt");
return 0;
}
el_val_t la_esse_past(el_val_t slot) {
if (slot == 0) {
return EL_STR("fui");
}
if (slot == 1) {
return EL_STR("fuisti");
}
if (slot == 2) {
return EL_STR("fuit");
}
if (slot == 3) {
return EL_STR("fuimus");
}
if (slot == 4) {
return EL_STR("fuistis");
}
return EL_STR("fuerunt");
return 0;
}
el_val_t la_esse_future(el_val_t slot) {
if (slot == 0) {
return EL_STR("ero");
}
if (slot == 1) {
return EL_STR("eris");
}
if (slot == 2) {
return EL_STR("erit");
}
if (slot == 3) {
return EL_STR("erimus");
}
if (slot == 4) {
return EL_STR("eritis");
}
return EL_STR("erunt");
return 0;
}
el_val_t la_ire_present(el_val_t slot) {
if (slot == 0) {
return EL_STR("eo");
}
if (slot == 1) {
return EL_STR("is");
}
if (slot == 2) {
return EL_STR("it");
}
if (slot == 3) {
return EL_STR("imus");
}
if (slot == 4) {
return EL_STR("itis");
}
return EL_STR("eunt");
return 0;
}
el_val_t la_ire_past(el_val_t slot) {
if (slot == 0) {
return EL_STR("ii");
}
if (slot == 1) {
return EL_STR("isti");
}
if (slot == 2) {
return EL_STR("iit");
}
if (slot == 3) {
return EL_STR("iimus");
}
if (slot == 4) {
return EL_STR("istis");
}
return EL_STR("ierunt");
return 0;
}
el_val_t la_ire_future(el_val_t slot) {
if (slot == 0) {
return EL_STR("ibo");
}
if (slot == 1) {
return EL_STR("ibis");
}
if (slot == 2) {
return EL_STR("ibit");
}
if (slot == 3) {
return EL_STR("ibimus");
}
if (slot == 4) {
return EL_STR("ibitis");
}
return EL_STR("ibunt");
return 0;
}
el_val_t la_velle_present(el_val_t slot) {
if (slot == 0) {
return EL_STR("volo");
}
if (slot == 1) {
return EL_STR("vis");
}
if (slot == 2) {
return EL_STR("vult");
}
if (slot == 3) {
return EL_STR("volumus");
}
if (slot == 4) {
return EL_STR("vultis");
}
return EL_STR("volunt");
return 0;
}
el_val_t la_velle_past(el_val_t slot) {
if (slot == 0) {
return EL_STR("volui");
}
if (slot == 1) {
return EL_STR("voluisti");
}
if (slot == 2) {
return EL_STR("voluit");
}
if (slot == 3) {
return EL_STR("voluimus");
}
if (slot == 4) {
return EL_STR("voluistis");
}
return EL_STR("voluerunt");
return 0;
}
el_val_t la_velle_future(el_val_t slot) {
if (slot == 0) {
return EL_STR("volam");
}
if (slot == 1) {
return EL_STR("voles");
}
if (slot == 2) {
return EL_STR("volet");
}
if (slot == 3) {
return EL_STR("volemus");
}
if (slot == 4) {
return EL_STR("voletis");
}
return EL_STR("volent");
return 0;
}
el_val_t la_posse_present(el_val_t slot) {
if (slot == 0) {
return EL_STR("possum");
}
if (slot == 1) {
return EL_STR("potes");
}
if (slot == 2) {
return EL_STR("potest");
}
if (slot == 3) {
return EL_STR("possumus");
}
if (slot == 4) {
return EL_STR("potestis");
}
return EL_STR("possunt");
return 0;
}
el_val_t la_posse_past(el_val_t slot) {
if (slot == 0) {
return EL_STR("potui");
}
if (slot == 1) {
return EL_STR("potuisti");
}
if (slot == 2) {
return EL_STR("potuit");
}
if (slot == 3) {
return EL_STR("potuimus");
}
if (slot == 4) {
return EL_STR("potuistis");
}
return EL_STR("potuerunt");
return 0;
}
el_val_t la_posse_future(el_val_t slot) {
if (slot == 0) {
return EL_STR("potero");
}
if (slot == 1) {
return EL_STR("poteris");
}
if (slot == 2) {
return EL_STR("poterit");
}
if (slot == 3) {
return EL_STR("poterimus");
}
if (slot == 4) {
return EL_STR("poteritis");
}
return EL_STR("poterunt");
return 0;
}
el_val_t la_irregular_perfect_stem(el_val_t verb) {
if (str_eq(verb, EL_STR("edere"))) {
return EL_STR("ed");
}
if (str_eq(verb, EL_STR("dicere"))) {
return EL_STR("dix");
}
if (str_eq(verb, EL_STR("ducere"))) {
return EL_STR("dux");
}
if (str_eq(verb, EL_STR("facere"))) {
return EL_STR("fec");
}
if (str_eq(verb, EL_STR("capere"))) {
return EL_STR("cep");
}
if (str_eq(verb, EL_STR("venire"))) {
return EL_STR("ven");
}
if (str_eq(verb, EL_STR("videre"))) {
return EL_STR("vid");
}
if (str_eq(verb, EL_STR("bibere"))) {
return EL_STR("bib");
}
if (str_eq(verb, EL_STR("currere"))) {
return EL_STR("cucurr");
}
if (str_eq(verb, EL_STR("legere"))) {
return EL_STR("leg");
}
if (str_eq(verb, EL_STR("scribere"))) {
return EL_STR("scrips");
}
if (str_eq(verb, EL_STR("vivere"))) {
return EL_STR("vix");
}
if (str_eq(verb, EL_STR("cadere"))) {
return EL_STR("cecid");
}
if (str_eq(verb, EL_STR("ponere"))) {
return EL_STR("posu");
}
if (str_eq(verb, EL_STR("querere"))) {
return EL_STR("quaesiv");
}
return EL_STR("");
return 0;
}
el_val_t la_map_canonical(el_val_t verb) {
if (str_eq(verb, EL_STR("be"))) {
return EL_STR("esse");
}
if (str_eq(verb, EL_STR("go"))) {
return EL_STR("ire");
}
if (str_eq(verb, EL_STR("want"))) {
return EL_STR("velle");
}
if (str_eq(verb, EL_STR("can"))) {
return EL_STR("posse");
}
if (str_eq(verb, EL_STR("eat"))) {
return EL_STR("edere");
}
if (str_eq(verb, EL_STR("say"))) {
return EL_STR("dicere");
}
if (str_eq(verb, EL_STR("see"))) {
return EL_STR("videre");
}
if (str_eq(verb, EL_STR("make"))) {
return EL_STR("facere");
}
if (str_eq(verb, EL_STR("come"))) {
return EL_STR("venire");
}
if (str_eq(verb, EL_STR("read"))) {
return EL_STR("legere");
}
if (str_eq(verb, EL_STR("write"))) {
return EL_STR("scribere");
}
if (str_eq(verb, EL_STR("run"))) {
return EL_STR("currere");
}
if (str_eq(verb, EL_STR("live"))) {
return EL_STR("vivere");
}
if (str_eq(verb, EL_STR("love"))) {
return EL_STR("amare");
}
return verb;
return 0;
}
el_val_t la_conjugate(el_val_t verb, el_val_t tense, el_val_t person, el_val_t number) {
el_val_t v = la_map_canonical(verb);
el_val_t slot = la_slot(person, number);
if (str_eq(v, EL_STR("esse"))) {
if (str_eq(tense, EL_STR("present"))) {
return la_esse_present(slot);
}
if (str_eq(tense, EL_STR("past"))) {
return la_esse_past(slot);
}
if (str_eq(tense, EL_STR("future"))) {
return la_esse_future(slot);
}
return v;
}
if (str_eq(v, EL_STR("ire"))) {
if (str_eq(tense, EL_STR("present"))) {
return la_ire_present(slot);
}
if (str_eq(tense, EL_STR("past"))) {
return la_ire_past(slot);
}
if (str_eq(tense, EL_STR("future"))) {
return la_ire_future(slot);
}
return v;
}
if (str_eq(v, EL_STR("velle"))) {
if (str_eq(tense, EL_STR("present"))) {
return la_velle_present(slot);
}
if (str_eq(tense, EL_STR("past"))) {
return la_velle_past(slot);
}
if (str_eq(tense, EL_STR("future"))) {
return la_velle_future(slot);
}
return v;
}
if (str_eq(v, EL_STR("posse"))) {
if (str_eq(tense, EL_STR("present"))) {
return la_posse_present(slot);
}
if (str_eq(tense, EL_STR("past"))) {
return la_posse_past(slot);
}
if (str_eq(tense, EL_STR("future"))) {
return la_posse_future(slot);
}
return v;
}
el_val_t vclass = la_verb_class(v);
el_val_t stem = la_stem(v, vclass);
if (str_eq(tense, EL_STR("present"))) {
return la_present_form(stem, vclass, slot);
}
if (str_eq(tense, EL_STR("past"))) {
el_val_t irreg_perf = la_irregular_perfect_stem(v);
if (!str_eq(irreg_perf, EL_STR(""))) {
return el_str_concat(irreg_perf, la_perfect_ending(slot));
}
el_val_t perf_stem = la_perfect_stem(v, vclass);
return el_str_concat(perf_stem, la_perfect_ending(slot));
}
if (str_eq(tense, EL_STR("future"))) {
return la_future_form(stem, vclass, slot);
}
return v;
return 0;
}
el_val_t la_declension(el_val_t noun) {
if (la_str_ends(noun, EL_STR("a"))) {
return EL_STR("1");
}
if (la_str_ends(noun, EL_STR("um"))) {
return EL_STR("2n");
}
if (la_str_ends(noun, EL_STR("er"))) {
return EL_STR("2m");
}
if (la_str_ends(noun, EL_STR("us"))) {
if (str_eq(noun, EL_STR("manus"))) {
return EL_STR("4");
}
if (str_eq(noun, EL_STR("usus"))) {
return EL_STR("4");
}
if (str_eq(noun, EL_STR("fructus"))) {
return EL_STR("4");
}
if (str_eq(noun, EL_STR("gradus"))) {
return EL_STR("4");
}
if (str_eq(noun, EL_STR("cursus"))) {
return EL_STR("4");
}
if (str_eq(noun, EL_STR("sensus"))) {
return EL_STR("4");
}
if (str_eq(noun, EL_STR("spiritus"))) {
return EL_STR("4");
}
if (str_eq(noun, EL_STR("portus"))) {
return EL_STR("4");
}
if (str_eq(noun, EL_STR("domus"))) {
return EL_STR("4");
}
if (str_eq(noun, EL_STR("impetus"))) {
return EL_STR("4");
}
return EL_STR("2m");
}
if (la_str_ends(noun, EL_STR("es"))) {
return EL_STR("5");
}
if (la_str_ends(noun, EL_STR("is"))) {
return EL_STR("3");
}
return EL_STR("3");
return 0;
}
el_val_t la_decline_1(el_val_t stem, el_val_t gram_case, el_val_t number) {
if (str_eq(number, EL_STR("singular"))) {
if (str_eq(gram_case, EL_STR("nominative"))) {
return el_str_concat(stem, EL_STR("a"));
}
if (str_eq(gram_case, EL_STR("genitive"))) {
return el_str_concat(stem, EL_STR("ae"));
}
if (str_eq(gram_case, EL_STR("dative"))) {
return el_str_concat(stem, EL_STR("ae"));
}
if (str_eq(gram_case, EL_STR("accusative"))) {
return el_str_concat(stem, EL_STR("am"));
}
if (str_eq(gram_case, EL_STR("ablative"))) {
return el_str_concat(stem, EL_STR("a"));
}
return el_str_concat(stem, EL_STR("a"));
}
if (str_eq(gram_case, EL_STR("nominative"))) {
return el_str_concat(stem, EL_STR("ae"));
}
if (str_eq(gram_case, EL_STR("genitive"))) {
return el_str_concat(stem, EL_STR("arum"));
}
if (str_eq(gram_case, EL_STR("dative"))) {
return el_str_concat(stem, EL_STR("is"));
}
if (str_eq(gram_case, EL_STR("accusative"))) {
return el_str_concat(stem, EL_STR("as"));
}
if (str_eq(gram_case, EL_STR("ablative"))) {
return el_str_concat(stem, EL_STR("is"));
}
return el_str_concat(stem, EL_STR("ae"));
return 0;
}
el_val_t la_decline_2m(el_val_t stem, el_val_t gram_case, el_val_t number) {
if (str_eq(number, EL_STR("singular"))) {
if (str_eq(gram_case, EL_STR("nominative"))) {
return el_str_concat(stem, EL_STR("us"));
}
if (str_eq(gram_case, EL_STR("genitive"))) {
return el_str_concat(stem, EL_STR("i"));
}
if (str_eq(gram_case, EL_STR("dative"))) {
return el_str_concat(stem, EL_STR("o"));
}
if (str_eq(gram_case, EL_STR("accusative"))) {
return el_str_concat(stem, EL_STR("um"));
}
if (str_eq(gram_case, EL_STR("ablative"))) {
return el_str_concat(stem, EL_STR("o"));
}
return el_str_concat(stem, EL_STR("us"));
}
if (str_eq(gram_case, EL_STR("nominative"))) {
return el_str_concat(stem, EL_STR("i"));
}
if (str_eq(gram_case, EL_STR("genitive"))) {
return el_str_concat(stem, EL_STR("orum"));
}
if (str_eq(gram_case, EL_STR("dative"))) {
return el_str_concat(stem, EL_STR("is"));
}
if (str_eq(gram_case, EL_STR("accusative"))) {
return el_str_concat(stem, EL_STR("os"));
}
if (str_eq(gram_case, EL_STR("ablative"))) {
return el_str_concat(stem, EL_STR("is"));
}
return el_str_concat(stem, EL_STR("i"));
return 0;
}
el_val_t la_decline_2n(el_val_t stem, el_val_t gram_case, el_val_t number) {
if (str_eq(number, EL_STR("singular"))) {
if (str_eq(gram_case, EL_STR("nominative"))) {
return el_str_concat(stem, EL_STR("um"));
}
if (str_eq(gram_case, EL_STR("genitive"))) {
return el_str_concat(stem, EL_STR("i"));
}
if (str_eq(gram_case, EL_STR("dative"))) {
return el_str_concat(stem, EL_STR("o"));
}
if (str_eq(gram_case, EL_STR("accusative"))) {
return el_str_concat(stem, EL_STR("um"));
}
if (str_eq(gram_case, EL_STR("ablative"))) {
return el_str_concat(stem, EL_STR("o"));
}
return el_str_concat(stem, EL_STR("um"));
}
if (str_eq(gram_case, EL_STR("nominative"))) {
return el_str_concat(stem, EL_STR("a"));
}
if (str_eq(gram_case, EL_STR("genitive"))) {
return el_str_concat(stem, EL_STR("orum"));
}
if (str_eq(gram_case, EL_STR("dative"))) {
return el_str_concat(stem, EL_STR("is"));
}
if (str_eq(gram_case, EL_STR("accusative"))) {
return el_str_concat(stem, EL_STR("a"));
}
if (str_eq(gram_case, EL_STR("ablative"))) {
return el_str_concat(stem, EL_STR("is"));
}
return el_str_concat(stem, EL_STR("a"));
return 0;
}
el_val_t la_decline_3(el_val_t noun, el_val_t gram_case, el_val_t number) {
el_val_t oblique_stem = EL_STR("");
if (la_str_ends(noun, EL_STR("is"))) {
oblique_stem = la_str_drop_last(noun, 2);
} else {
oblique_stem = noun;
}
if (str_eq(number, EL_STR("singular"))) {
if (str_eq(gram_case, EL_STR("nominative"))) {
return noun;
}
if (str_eq(gram_case, EL_STR("genitive"))) {
return el_str_concat(oblique_stem, EL_STR("is"));
}
if (str_eq(gram_case, EL_STR("dative"))) {
return el_str_concat(oblique_stem, EL_STR("i"));
}
if (str_eq(gram_case, EL_STR("accusative"))) {
return el_str_concat(oblique_stem, EL_STR("em"));
}
if (str_eq(gram_case, EL_STR("ablative"))) {
return el_str_concat(oblique_stem, EL_STR("e"));
}
return noun;
}
if (str_eq(gram_case, EL_STR("nominative"))) {
return el_str_concat(oblique_stem, EL_STR("es"));
}
if (str_eq(gram_case, EL_STR("genitive"))) {
return el_str_concat(oblique_stem, EL_STR("um"));
}
if (str_eq(gram_case, EL_STR("dative"))) {
return el_str_concat(oblique_stem, EL_STR("ibus"));
}
if (str_eq(gram_case, EL_STR("accusative"))) {
return el_str_concat(oblique_stem, EL_STR("es"));
}
if (str_eq(gram_case, EL_STR("ablative"))) {
return el_str_concat(oblique_stem, EL_STR("ibus"));
}
return el_str_concat(oblique_stem, EL_STR("es"));
return 0;
}
el_val_t la_decline_4(el_val_t stem, el_val_t gram_case, el_val_t number) {
if (str_eq(number, EL_STR("singular"))) {
if (str_eq(gram_case, EL_STR("nominative"))) {
return el_str_concat(stem, EL_STR("us"));
}
if (str_eq(gram_case, EL_STR("genitive"))) {
return el_str_concat(stem, EL_STR("us"));
}
if (str_eq(gram_case, EL_STR("dative"))) {
return el_str_concat(stem, EL_STR("ui"));
}
if (str_eq(gram_case, EL_STR("accusative"))) {
return el_str_concat(stem, EL_STR("um"));
}
if (str_eq(gram_case, EL_STR("ablative"))) {
return el_str_concat(stem, EL_STR("u"));
}
return el_str_concat(stem, EL_STR("us"));
}
if (str_eq(gram_case, EL_STR("nominative"))) {
return el_str_concat(stem, EL_STR("us"));
}
if (str_eq(gram_case, EL_STR("genitive"))) {
return el_str_concat(stem, EL_STR("uum"));
}
if (str_eq(gram_case, EL_STR("dative"))) {
return el_str_concat(stem, EL_STR("ibus"));
}
if (str_eq(gram_case, EL_STR("accusative"))) {
return el_str_concat(stem, EL_STR("us"));
}
if (str_eq(gram_case, EL_STR("ablative"))) {
return el_str_concat(stem, EL_STR("ibus"));
}
return el_str_concat(stem, EL_STR("us"));
return 0;
}
el_val_t la_decline_5(el_val_t stem, el_val_t gram_case, el_val_t number) {
if (str_eq(number, EL_STR("singular"))) {
if (str_eq(gram_case, EL_STR("nominative"))) {
return el_str_concat(stem, EL_STR("es"));
}
if (str_eq(gram_case, EL_STR("genitive"))) {
return el_str_concat(stem, EL_STR("ei"));
}
if (str_eq(gram_case, EL_STR("dative"))) {
return el_str_concat(stem, EL_STR("ei"));
}
if (str_eq(gram_case, EL_STR("accusative"))) {
return el_str_concat(stem, EL_STR("em"));
}
if (str_eq(gram_case, EL_STR("ablative"))) {
return el_str_concat(stem, EL_STR("e"));
}
return el_str_concat(stem, EL_STR("es"));
}
if (str_eq(gram_case, EL_STR("nominative"))) {
return el_str_concat(stem, EL_STR("es"));
}
if (str_eq(gram_case, EL_STR("genitive"))) {
return el_str_concat(stem, EL_STR("erum"));
}
if (str_eq(gram_case, EL_STR("dative"))) {
return el_str_concat(stem, EL_STR("ebus"));
}
if (str_eq(gram_case, EL_STR("accusative"))) {
return el_str_concat(stem, EL_STR("es"));
}
if (str_eq(gram_case, EL_STR("ablative"))) {
return el_str_concat(stem, EL_STR("ebus"));
}
return el_str_concat(stem, EL_STR("es"));
return 0;
}
el_val_t la_decline_2er(el_val_t noun, el_val_t gram_case, el_val_t number) {
el_val_t stem = la_str_drop_last(noun, 1);
if (str_eq(number, EL_STR("singular"))) {
if (str_eq(gram_case, EL_STR("nominative"))) {
return noun;
}
if (str_eq(gram_case, EL_STR("genitive"))) {
return el_str_concat(stem, EL_STR("ri"));
}
if (str_eq(gram_case, EL_STR("dative"))) {
return el_str_concat(stem, EL_STR("ro"));
}
if (str_eq(gram_case, EL_STR("accusative"))) {
return el_str_concat(stem, EL_STR("rum"));
}
if (str_eq(gram_case, EL_STR("ablative"))) {
return el_str_concat(stem, EL_STR("ro"));
}
return noun;
}
if (str_eq(gram_case, EL_STR("nominative"))) {
return el_str_concat(stem, EL_STR("ri"));
}
if (str_eq(gram_case, EL_STR("genitive"))) {
return el_str_concat(stem, EL_STR("rorum"));
}
if (str_eq(gram_case, EL_STR("dative"))) {
return el_str_concat(stem, EL_STR("ris"));
}
if (str_eq(gram_case, EL_STR("accusative"))) {
return el_str_concat(stem, EL_STR("ros"));
}
if (str_eq(gram_case, EL_STR("ablative"))) {
return el_str_concat(stem, EL_STR("ris"));
}
return el_str_concat(stem, EL_STR("ri"));
return 0;
}
el_val_t la_decline(el_val_t noun, el_val_t gram_case, el_val_t number) {
el_val_t decl = la_declension(noun);
if (str_eq(decl, EL_STR("1"))) {
el_val_t stem = la_str_drop_last(noun, 1);
return la_decline_1(stem, gram_case, number);
}
if (str_eq(decl, EL_STR("2m"))) {
el_val_t stem = la_str_drop_last(noun, 2);
return la_decline_2m(stem, gram_case, number);
}
if (str_eq(decl, EL_STR("2n"))) {
el_val_t stem = la_str_drop_last(noun, 2);
return la_decline_2n(stem, gram_case, number);
}
if (str_eq(decl, EL_STR("2er"))) {
return la_decline_2er(noun, gram_case, number);
}
if (str_eq(decl, EL_STR("3"))) {
return la_decline_3(noun, gram_case, number);
}
if (str_eq(decl, EL_STR("4"))) {
el_val_t stem = la_str_drop_last(noun, 2);
return la_decline_4(stem, gram_case, number);
}
if (str_eq(decl, EL_STR("5"))) {
el_val_t stem = la_str_drop_last(noun, 2);
return la_decline_5(stem, gram_case, number);
}
return noun;
return 0;
}
el_val_t la_noun_phrase(el_val_t noun, el_val_t gram_case, el_val_t number, el_val_t definite) {
return la_decline(noun, gram_case, number);
return 0;
}