Files
neuron/dist/morphology-got.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

736 lines
18 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 got_str_ends(el_val_t s, el_val_t suf);
el_val_t got_str_drop_last(el_val_t s, el_val_t n);
el_val_t got_slot(el_val_t person, el_val_t number);
el_val_t got_map_canonical(el_val_t verb);
el_val_t got_wisan_present(el_val_t slot);
el_val_t got_wisan_past(el_val_t slot);
el_val_t got_haban_present(el_val_t slot);
el_val_t got_haban_past(el_val_t slot);
el_val_t got_gaggan_present(el_val_t slot);
el_val_t got_gaggan_past(el_val_t slot);
el_val_t got_saihwan_present(el_val_t slot);
el_val_t got_saihwan_past(el_val_t slot);
el_val_t got_qithan_present(el_val_t slot);
el_val_t got_qithan_past(el_val_t slot);
el_val_t got_niman_present(el_val_t slot);
el_val_t got_niman_past(el_val_t slot);
el_val_t got_wk1_present_ending(el_val_t slot);
el_val_t got_wk1_past_ending(el_val_t slot);
el_val_t got_wk1_conjugate(el_val_t stem, el_val_t tense, el_val_t slot);
el_val_t got_wk2_present_ending(el_val_t slot);
el_val_t got_wk2_past_ending(el_val_t slot);
el_val_t got_wk2_conjugate(el_val_t stem, el_val_t tense, el_val_t slot);
el_val_t got_verb_class(el_val_t verb);
el_val_t got_verb_stem(el_val_t verb, el_val_t vclass);
el_val_t got_conjugate(el_val_t verb, el_val_t tense, el_val_t person, el_val_t number);
el_val_t got_decline_a_stem_sg(el_val_t stem, el_val_t gram_case);
el_val_t got_decline_a_stem_pl(el_val_t stem, el_val_t gram_case);
el_val_t got_decline_o_stem_sg(el_val_t stem, el_val_t gram_case);
el_val_t got_decline_o_stem_pl(el_val_t stem, el_val_t gram_case);
el_val_t got_decline_n_stem_sg(el_val_t stem, el_val_t gram_case);
el_val_t got_decline_n_stem_pl(el_val_t stem, el_val_t gram_case);
el_val_t got_stem_type(el_val_t noun);
el_val_t got_extract_stem(el_val_t noun, el_val_t stype);
el_val_t got_demo_article(el_val_t stype);
el_val_t got_decline(el_val_t noun, el_val_t gram_case, el_val_t number);
el_val_t got_noun_phrase(el_val_t noun, el_val_t gram_case, el_val_t number, el_val_t definite);
el_val_t got_str_ends(el_val_t s, el_val_t suf) {
return str_ends_with(s, suf);
return 0;
}
el_val_t got_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 got_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 got_map_canonical(el_val_t verb) {
if (str_eq(verb, EL_STR("be"))) {
return EL_STR("wisan");
}
if (str_eq(verb, EL_STR("have"))) {
return EL_STR("haban");
}
if (str_eq(verb, EL_STR("go"))) {
return EL_STR("gaggan");
}
if (str_eq(verb, EL_STR("see"))) {
return EL_STR("saihwan");
}
if (str_eq(verb, EL_STR("say"))) {
return EL_STR("qi\xc3\xbe""an");
}
if (str_eq(verb, EL_STR("take"))) {
return EL_STR("niman");
}
if (str_eq(verb, EL_STR("come"))) {
return EL_STR("qiman");
}
if (str_eq(verb, EL_STR("give"))) {
return EL_STR("giban");
}
if (str_eq(verb, EL_STR("know"))) {
return EL_STR("kunnan");
}
if (str_eq(verb, EL_STR("want"))) {
return EL_STR("wiljan");
}
return verb;
return 0;
}
el_val_t got_wisan_present(el_val_t slot) {
if (slot == 0) {
return EL_STR("im");
}
if (slot == 1) {
return EL_STR("is");
}
if (slot == 2) {
return EL_STR("ist");
}
if (slot == 3) {
return EL_STR("sijum");
}
if (slot == 4) {
return EL_STR("siju\xc3\xbe");
}
return EL_STR("sind");
return 0;
}
el_val_t got_wisan_past(el_val_t slot) {
if (slot == 0) {
return EL_STR("was");
}
if (slot == 1) {
return EL_STR("wast");
}
if (slot == 2) {
return EL_STR("was");
}
if (slot == 3) {
return EL_STR("wesum");
}
if (slot == 4) {
return EL_STR("wesu\xc3\xbe");
}
return EL_STR("wesun");
return 0;
}
el_val_t got_haban_present(el_val_t slot) {
if (slot == 0) {
return EL_STR("haba");
}
if (slot == 1) {
return EL_STR("habais");
}
if (slot == 2) {
return EL_STR("habai\xc3\xbe");
}
if (slot == 3) {
return EL_STR("habam");
}
if (slot == 4) {
return EL_STR("habai\xc3\xbe");
}
return EL_STR("haband");
return 0;
}
el_val_t got_haban_past(el_val_t slot) {
if (slot == 0) {
return EL_STR("habida");
}
if (slot == 1) {
return EL_STR("habides");
}
if (slot == 2) {
return EL_STR("habida");
}
if (slot == 3) {
return EL_STR("habidum");
}
if (slot == 4) {
return EL_STR("habide\xc3\xbe");
}
return EL_STR("habidedun");
return 0;
}
el_val_t got_gaggan_present(el_val_t slot) {
if (slot == 0) {
return EL_STR("gagga");
}
if (slot == 1) {
return EL_STR("gaggis");
}
if (slot == 2) {
return EL_STR("gaggi\xc3\xbe");
}
if (slot == 3) {
return EL_STR("gagam");
}
if (slot == 4) {
return EL_STR("gagi\xc3\xbe");
}
return EL_STR("gaggand");
return 0;
}
el_val_t got_gaggan_past(el_val_t slot) {
if (slot == 0) {
return EL_STR("iddja");
}
if (slot == 1) {
return EL_STR("iddj\xc4\x93s");
}
if (slot == 2) {
return EL_STR("iddja");
}
if (slot == 3) {
return EL_STR("iddj\xc4\x93""dum");
}
if (slot == 4) {
return EL_STR("iddj\xc4\x93""du\xc3\xbe");
}
return EL_STR("iddj\xc4\x93""dun");
return 0;
}
el_val_t got_saihwan_present(el_val_t slot) {
if (slot == 0) {
return EL_STR("saihwa");
}
if (slot == 1) {
return EL_STR("saihwis");
}
if (slot == 2) {
return EL_STR("saihwi\xc3\xbe");
}
if (slot == 3) {
return EL_STR("saihwam");
}
if (slot == 4) {
return EL_STR("saihwi\xc3\xbe");
}
return EL_STR("saihwand");
return 0;
}
el_val_t got_saihwan_past(el_val_t slot) {
if (slot == 0) {
return EL_STR("sahw");
}
if (slot == 1) {
return EL_STR("sahwt");
}
if (slot == 2) {
return EL_STR("sahw");
}
if (slot == 3) {
return EL_STR("sehwum");
}
if (slot == 4) {
return EL_STR("sehwu\xc3\xbe");
}
return EL_STR("sehwun");
return 0;
}
el_val_t got_qithan_present(el_val_t slot) {
if (slot == 0) {
return EL_STR("qi\xc3\xbe""a");
}
if (slot == 1) {
return EL_STR("qi\xc3\xbeis");
}
if (slot == 2) {
return EL_STR("qi\xc3\xbei\xc3\xbe");
}
if (slot == 3) {
return EL_STR("qi\xc3\xbe""am");
}
if (slot == 4) {
return EL_STR("qi\xc3\xbei\xc3\xbe");
}
return EL_STR("qi\xc3\xbe""and");
return 0;
}
el_val_t got_qithan_past(el_val_t slot) {
if (slot == 0) {
return EL_STR("qa\xc3\xbe");
}
if (slot == 1) {
return EL_STR("qast");
}
if (slot == 2) {
return EL_STR("qa\xc3\xbe");
}
if (slot == 3) {
return EL_STR("q\xc4\x93\xc3\xbeum");
}
if (slot == 4) {
return EL_STR("q\xc4\x93\xc3\xbeu\xc3\xbe");
}
return EL_STR("q\xc4\x93\xc3\xbeun");
return 0;
}
el_val_t got_niman_present(el_val_t slot) {
if (slot == 0) {
return EL_STR("nima");
}
if (slot == 1) {
return EL_STR("nimis");
}
if (slot == 2) {
return EL_STR("nimi\xc3\xbe");
}
if (slot == 3) {
return EL_STR("nimam");
}
if (slot == 4) {
return EL_STR("nimi\xc3\xbe");
}
return EL_STR("nimand");
return 0;
}
el_val_t got_niman_past(el_val_t slot) {
if (slot == 0) {
return EL_STR("nam");
}
if (slot == 1) {
return EL_STR("namt");
}
if (slot == 2) {
return EL_STR("nam");
}
if (slot == 3) {
return EL_STR("n\xc4\x93mum");
}
if (slot == 4) {
return EL_STR("n\xc4\x93mu\xc3\xbe");
}
return EL_STR("n\xc4\x93mun");
return 0;
}
el_val_t got_wk1_present_ending(el_val_t slot) {
if (slot == 0) {
return EL_STR("a");
}
if (slot == 1) {
return EL_STR("is");
}
if (slot == 2) {
return EL_STR("i\xc3\xbe");
}
if (slot == 3) {
return EL_STR("jam");
}
if (slot == 4) {
return EL_STR("ji\xc3\xbe");
}
return EL_STR("jand");
return 0;
}
el_val_t got_wk1_past_ending(el_val_t slot) {
if (slot == 0) {
return EL_STR("ida");
}
if (slot == 1) {
return EL_STR("ides");
}
if (slot == 2) {
return EL_STR("ida");
}
if (slot == 3) {
return EL_STR("idum");
}
if (slot == 4) {
return EL_STR("ide\xc3\xbe");
}
return EL_STR("idedun");
return 0;
}
el_val_t got_wk1_conjugate(el_val_t stem, el_val_t tense, el_val_t slot) {
if (str_eq(tense, EL_STR("present"))) {
return el_str_concat(stem, got_wk1_present_ending(slot));
}
if (str_eq(tense, EL_STR("past"))) {
return el_str_concat(stem, got_wk1_past_ending(slot));
}
return stem;
return 0;
}
el_val_t got_wk2_present_ending(el_val_t slot) {
if (slot == 0) {
return EL_STR("o");
}
if (slot == 1) {
return EL_STR("os");
}
if (slot == 2) {
return EL_STR("o\xc3\xbe");
}
if (slot == 3) {
return EL_STR("om");
}
if (slot == 4) {
return EL_STR("o\xc3\xbe");
}
return EL_STR("ond");
return 0;
}
el_val_t got_wk2_past_ending(el_val_t slot) {
if (slot == 0) {
return EL_STR("oda");
}
if (slot == 1) {
return EL_STR("odes");
}
if (slot == 2) {
return EL_STR("oda");
}
if (slot == 3) {
return EL_STR("odum");
}
if (slot == 4) {
return EL_STR("ode\xc3\xbe");
}
return EL_STR("odedun");
return 0;
}
el_val_t got_wk2_conjugate(el_val_t stem, el_val_t tense, el_val_t slot) {
if (str_eq(tense, EL_STR("present"))) {
return el_str_concat(stem, got_wk2_present_ending(slot));
}
if (str_eq(tense, EL_STR("past"))) {
return el_str_concat(stem, got_wk2_past_ending(slot));
}
return stem;
return 0;
}
el_val_t got_verb_class(el_val_t verb) {
if (got_str_ends(verb, EL_STR("jan"))) {
return EL_STR("wk1");
}
if (got_str_ends(verb, EL_STR("on"))) {
return EL_STR("wk2");
}
return EL_STR("wk1");
return 0;
}
el_val_t got_verb_stem(el_val_t verb, el_val_t vclass) {
if (str_eq(vclass, EL_STR("wk1"))) {
return got_str_drop_last(verb, 3);
}
if (str_eq(vclass, EL_STR("wk2"))) {
return got_str_drop_last(verb, 2);
}
return got_str_drop_last(verb, 2);
return 0;
}
el_val_t got_conjugate(el_val_t verb, el_val_t tense, el_val_t person, el_val_t number) {
el_val_t v = got_map_canonical(verb);
el_val_t slot = got_slot(person, number);
if (str_eq(v, EL_STR("wisan"))) {
if (str_eq(tense, EL_STR("present"))) {
return got_wisan_present(slot);
}
if (str_eq(tense, EL_STR("past"))) {
return got_wisan_past(slot);
}
return v;
}
if (str_eq(v, EL_STR("haban"))) {
if (str_eq(tense, EL_STR("present"))) {
return got_haban_present(slot);
}
if (str_eq(tense, EL_STR("past"))) {
return got_haban_past(slot);
}
return v;
}
if (str_eq(v, EL_STR("gaggan"))) {
if (str_eq(tense, EL_STR("present"))) {
return got_gaggan_present(slot);
}
if (str_eq(tense, EL_STR("past"))) {
return got_gaggan_past(slot);
}
return v;
}
if (str_eq(v, EL_STR("saihwan"))) {
if (str_eq(tense, EL_STR("present"))) {
return got_saihwan_present(slot);
}
if (str_eq(tense, EL_STR("past"))) {
return got_saihwan_past(slot);
}
return v;
}
if (str_eq(v, EL_STR("qi\xc3\xbe""an"))) {
if (str_eq(tense, EL_STR("present"))) {
return got_qithan_present(slot);
}
if (str_eq(tense, EL_STR("past"))) {
return got_qithan_past(slot);
}
return v;
}
if (str_eq(v, EL_STR("niman"))) {
if (str_eq(tense, EL_STR("present"))) {
return got_niman_present(slot);
}
if (str_eq(tense, EL_STR("past"))) {
return got_niman_past(slot);
}
return v;
}
el_val_t vclass = got_verb_class(v);
el_val_t stem = got_verb_stem(v, vclass);
if (str_eq(vclass, EL_STR("wk1"))) {
return got_wk1_conjugate(stem, tense, slot);
}
if (str_eq(vclass, EL_STR("wk2"))) {
return got_wk2_conjugate(stem, tense, slot);
}
return v;
return 0;
}
el_val_t got_decline_a_stem_sg(el_val_t stem, el_val_t gram_case) {
if (str_eq(gram_case, EL_STR("nominative"))) {
return el_str_concat(stem, EL_STR("s"));
}
if (str_eq(gram_case, EL_STR("accusative"))) {
return stem;
}
if (str_eq(gram_case, EL_STR("genitive"))) {
return el_str_concat(stem, EL_STR("is"));
}
if (str_eq(gram_case, EL_STR("dative"))) {
return el_str_concat(stem, EL_STR("a"));
}
return el_str_concat(stem, EL_STR("s"));
return 0;
}
el_val_t got_decline_a_stem_pl(el_val_t stem, el_val_t gram_case) {
if (str_eq(gram_case, EL_STR("nominative"))) {
return el_str_concat(stem, EL_STR("os"));
}
if (str_eq(gram_case, EL_STR("accusative"))) {
return el_str_concat(stem, EL_STR("ans"));
}
if (str_eq(gram_case, EL_STR("genitive"))) {
return el_str_concat(stem, EL_STR("e"));
}
if (str_eq(gram_case, EL_STR("dative"))) {
return el_str_concat(stem, EL_STR("am"));
}
return el_str_concat(stem, EL_STR("os"));
return 0;
}
el_val_t got_decline_o_stem_sg(el_val_t stem, el_val_t gram_case) {
if (str_eq(gram_case, EL_STR("nominative"))) {
return el_str_concat(stem, EL_STR("o"));
}
if (str_eq(gram_case, EL_STR("accusative"))) {
return el_str_concat(stem, EL_STR("a"));
}
if (str_eq(gram_case, EL_STR("genitive"))) {
return el_str_concat(stem, EL_STR("os"));
}
if (str_eq(gram_case, EL_STR("dative"))) {
return el_str_concat(stem, EL_STR("ai"));
}
return el_str_concat(stem, EL_STR("o"));
return 0;
}
el_val_t got_decline_o_stem_pl(el_val_t stem, el_val_t gram_case) {
if (str_eq(gram_case, EL_STR("nominative"))) {
return el_str_concat(stem, EL_STR("os"));
}
if (str_eq(gram_case, EL_STR("accusative"))) {
return el_str_concat(stem, EL_STR("os"));
}
if (str_eq(gram_case, EL_STR("genitive"))) {
return el_str_concat(stem, EL_STR("o"));
}
if (str_eq(gram_case, EL_STR("dative"))) {
return el_str_concat(stem, EL_STR("om"));
}
return el_str_concat(stem, EL_STR("os"));
return 0;
}
el_val_t got_decline_n_stem_sg(el_val_t stem, el_val_t gram_case) {
if (str_eq(gram_case, EL_STR("nominative"))) {
return el_str_concat(stem, EL_STR("a"));
}
if (str_eq(gram_case, EL_STR("accusative"))) {
return el_str_concat(stem, EL_STR("an"));
}
if (str_eq(gram_case, EL_STR("genitive"))) {
return el_str_concat(stem, EL_STR("ins"));
}
if (str_eq(gram_case, EL_STR("dative"))) {
return el_str_concat(stem, EL_STR("in"));
}
return el_str_concat(stem, EL_STR("a"));
return 0;
}
el_val_t got_decline_n_stem_pl(el_val_t stem, el_val_t gram_case) {
if (str_eq(gram_case, EL_STR("nominative"))) {
return el_str_concat(stem, EL_STR("ans"));
}
if (str_eq(gram_case, EL_STR("accusative"))) {
return el_str_concat(stem, EL_STR("ans"));
}
if (str_eq(gram_case, EL_STR("genitive"))) {
return el_str_concat(stem, EL_STR("ane"));
}
if (str_eq(gram_case, EL_STR("dative"))) {
return el_str_concat(stem, EL_STR("am"));
}
return el_str_concat(stem, EL_STR("ans"));
return 0;
}
el_val_t got_stem_type(el_val_t noun) {
if (got_str_ends(noun, EL_STR("o"))) {
return EL_STR("o");
}
if (got_str_ends(noun, EL_STR("a"))) {
return EL_STR("n");
}
if (got_str_ends(noun, EL_STR("s"))) {
return EL_STR("a");
}
return EL_STR("a");
return 0;
}
el_val_t got_extract_stem(el_val_t noun, el_val_t stype) {
el_val_t n = str_len(noun);
return str_slice(noun, 0, (n - 1));
return 0;
}
el_val_t got_demo_article(el_val_t stype) {
if (str_eq(stype, EL_STR("o"))) {
return EL_STR("\xc3\xbeo");
}
return EL_STR("sa");
return 0;
}
el_val_t got_decline(el_val_t noun, el_val_t gram_case, el_val_t number) {
el_val_t stype = got_stem_type(noun);
el_val_t stem = got_extract_stem(noun, stype);
if (str_eq(stype, EL_STR("a"))) {
if (str_eq(number, EL_STR("singular"))) {
return got_decline_a_stem_sg(stem, gram_case);
}
return got_decline_a_stem_pl(stem, gram_case);
}
if (str_eq(stype, EL_STR("o"))) {
if (str_eq(number, EL_STR("singular"))) {
return got_decline_o_stem_sg(stem, gram_case);
}
return got_decline_o_stem_pl(stem, gram_case);
}
if (str_eq(stype, EL_STR("n"))) {
if (str_eq(number, EL_STR("singular"))) {
return got_decline_n_stem_sg(stem, gram_case);
}
return got_decline_n_stem_pl(stem, gram_case);
}
return noun;
return 0;
}
el_val_t got_noun_phrase(el_val_t noun, el_val_t gram_case, el_val_t number, el_val_t definite) {
el_val_t declined = got_decline(noun, gram_case, number);
if (str_eq(definite, EL_STR("true"))) {
el_val_t stype = got_stem_type(noun);
el_val_t article = got_demo_article(stype);
return el_str_concat(el_str_concat(article, EL_STR(" ")), declined);
}
return declined;
return 0;
}