#include #include #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 ang_str_ends(el_val_t s, el_val_t suf); el_val_t ang_str_drop_last(el_val_t s, el_val_t n); el_val_t ang_str_last_char(el_val_t s); el_val_t ang_str_last2(el_val_t s); el_val_t ang_slot(el_val_t person, el_val_t number); el_val_t ang_map_canonical(el_val_t verb); el_val_t ang_wesan_past(el_val_t slot); el_val_t ang_beon_present(el_val_t slot); el_val_t ang_wesan_present(el_val_t slot); el_val_t ang_habban_present(el_val_t slot); el_val_t ang_habban_past(el_val_t slot); el_val_t ang_gan_present(el_val_t slot); el_val_t ang_gan_past(el_val_t slot); el_val_t ang_cuman_present(el_val_t slot); el_val_t ang_cuman_past(el_val_t slot); el_val_t ang_secgan_present(el_val_t slot); el_val_t ang_secgan_past(el_val_t slot); el_val_t ang_seon_present(el_val_t slot); el_val_t ang_seon_past(el_val_t slot); el_val_t ang_don_present(el_val_t slot); el_val_t ang_don_past(el_val_t slot); el_val_t ang_willan_present(el_val_t slot); el_val_t ang_willan_past(el_val_t slot); el_val_t ang_magan_present(el_val_t slot); el_val_t ang_magan_past(el_val_t slot); el_val_t ang_witan_present(el_val_t slot); el_val_t ang_witan_past(el_val_t slot); el_val_t ang_weak_present_ending(el_val_t slot); el_val_t ang_weak_past_stem(el_val_t stem); el_val_t ang_weak_past(el_val_t stem, el_val_t slot); el_val_t ang_weak_stem(el_val_t verb); el_val_t ang_conjugate(el_val_t verb, el_val_t tense, el_val_t person, el_val_t number); el_val_t ang_declension(el_val_t noun, el_val_t gender); el_val_t ang_decline_strong_masc(el_val_t noun, el_val_t gram_case, el_val_t number); el_val_t ang_decline_strong_neut(el_val_t noun, el_val_t gram_case, el_val_t number); el_val_t ang_decline_weak(el_val_t noun, el_val_t gram_case, el_val_t number); el_val_t ang_decline(el_val_t noun, el_val_t gram_case, el_val_t number, el_val_t gender); el_val_t ang_article_masculine(el_val_t gram_case, el_val_t number); el_val_t ang_article_feminine(el_val_t gram_case, el_val_t number); el_val_t ang_article_neuter(el_val_t gram_case, el_val_t number); el_val_t ang_article(el_val_t gender, el_val_t gram_case, el_val_t number); el_val_t ang_infer_gender(el_val_t noun); el_val_t ang_noun_phrase(el_val_t noun, el_val_t gram_case, el_val_t number, el_val_t definite); el_val_t ang_str_ends(el_val_t s, el_val_t suf) { return str_ends_with(s, suf); return 0; } el_val_t ang_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 ang_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 ang_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 ang_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 ang_map_canonical(el_val_t verb) { if (str_eq(verb, EL_STR("be"))) { return EL_STR("beon"); } if (str_eq(verb, EL_STR("have"))) { return EL_STR("habban"); } if (str_eq(verb, EL_STR("go"))) { return EL_STR("g\xc4\x81n"); } if (str_eq(verb, EL_STR("come"))) { return EL_STR("cuman"); } if (str_eq(verb, EL_STR("say"))) { return EL_STR("secgan"); } if (str_eq(verb, EL_STR("see"))) { return EL_STR("s\xc4\x93on"); } if (str_eq(verb, EL_STR("do"))) { return EL_STR("d\xc5\x8dn"); } if (str_eq(verb, EL_STR("want"))) { return EL_STR("willan"); } if (str_eq(verb, EL_STR("will"))) { return EL_STR("willan"); } if (str_eq(verb, EL_STR("can"))) { return EL_STR("magan"); } if (str_eq(verb, EL_STR("know"))) { return EL_STR("witan"); } if (str_eq(verb, EL_STR("give"))) { return EL_STR("giefan"); } if (str_eq(verb, EL_STR("take"))) { return EL_STR("niman"); } if (str_eq(verb, EL_STR("find"))) { return EL_STR("findan"); } if (str_eq(verb, EL_STR("make"))) { return EL_STR("macian"); } return verb; return 0; } el_val_t ang_wesan_past(el_val_t slot) { if (slot == 0) { return EL_STR("w\xc3\xa6s"); } if (slot == 1) { return EL_STR("w\xc7\xa3re"); } if (slot == 2) { return EL_STR("w\xc3\xa6s"); } if (slot == 3) { return EL_STR("w\xc7\xa3ron"); } if (slot == 4) { return EL_STR("w\xc7\xa3ron"); } return EL_STR("w\xc7\xa3ron"); return 0; } el_val_t ang_beon_present(el_val_t slot) { if (slot == 0) { return EL_STR("b\xc4\x93o"); } if (slot == 1) { return EL_STR("bist"); } if (slot == 2) { return EL_STR("bi\xc3\xbe"); } if (slot == 3) { return EL_STR("b\xc4\x93o\xc3\xbe"); } if (slot == 4) { return EL_STR("b\xc4\x93o\xc3\xbe"); } return EL_STR("b\xc4\x93o\xc3\xbe"); return 0; } el_val_t ang_wesan_present(el_val_t slot) { if (slot == 0) { return EL_STR("eom"); } if (slot == 1) { return EL_STR("eart"); } if (slot == 2) { return EL_STR("is"); } if (slot == 3) { return EL_STR("sind"); } if (slot == 4) { return EL_STR("sind"); } return EL_STR("sind"); return 0; } el_val_t ang_habban_present(el_val_t slot) { if (slot == 0) { return EL_STR("h\xc3\xa6""bbe"); } if (slot == 1) { return EL_STR("h\xc3\xa6""fst"); } if (slot == 2) { return EL_STR("h\xc3\xa6""f\xc3\xbe"); } if (slot == 3) { return EL_STR("habba\xc3\xb0"); } if (slot == 4) { return EL_STR("habba\xc3\xb0"); } return EL_STR("habba\xc3\xb0"); return 0; } el_val_t ang_habban_past(el_val_t slot) { if (slot == 0) { return EL_STR("h\xc3\xa6""fde"); } if (slot == 1) { return EL_STR("h\xc3\xa6""fdest"); } if (slot == 2) { return EL_STR("h\xc3\xa6""fde"); } if (slot == 3) { return EL_STR("h\xc3\xa6""fdon"); } if (slot == 4) { return EL_STR("h\xc3\xa6""fdon"); } return EL_STR("h\xc3\xa6""fdon"); return 0; } el_val_t ang_gan_present(el_val_t slot) { if (slot == 0) { return EL_STR("g\xc4\x81"); } if (slot == 1) { return EL_STR("g\xc7\xa3st"); } if (slot == 2) { return EL_STR("g\xc7\xa3\xc3\xbe"); } if (slot == 3) { return EL_STR("g\xc4\x81\xc3\xb0"); } if (slot == 4) { return EL_STR("g\xc4\x81\xc3\xb0"); } return EL_STR("g\xc4\x81\xc3\xb0"); return 0; } el_val_t ang_gan_past(el_val_t slot) { if (slot == 0) { return EL_STR("\xc4\x93ode"); } if (slot == 1) { return EL_STR("\xc4\x93odest"); } if (slot == 2) { return EL_STR("\xc4\x93ode"); } if (slot == 3) { return EL_STR("\xc4\x93odon"); } if (slot == 4) { return EL_STR("\xc4\x93odon"); } return EL_STR("\xc4\x93odon"); return 0; } el_val_t ang_cuman_present(el_val_t slot) { if (slot == 0) { return EL_STR("cume"); } if (slot == 1) { return EL_STR("cymst"); } if (slot == 2) { return EL_STR("cym\xc3\xbe"); } if (slot == 3) { return EL_STR("cuma\xc3\xb0"); } if (slot == 4) { return EL_STR("cuma\xc3\xb0"); } return EL_STR("cuma\xc3\xb0"); return 0; } el_val_t ang_cuman_past(el_val_t slot) { if (slot == 0) { return EL_STR("c\xc5\x8dm"); } if (slot == 1) { return EL_STR("c\xc5\x8dme"); } if (slot == 2) { return EL_STR("c\xc5\x8dm"); } if (slot == 3) { return EL_STR("c\xc5\x8dmon"); } if (slot == 4) { return EL_STR("c\xc5\x8dmon"); } return EL_STR("c\xc5\x8dmon"); return 0; } el_val_t ang_secgan_present(el_val_t slot) { if (slot == 0) { return EL_STR("secge"); } if (slot == 1) { return EL_STR("sagast"); } if (slot == 2) { return EL_STR("saga\xc3\xb0"); } if (slot == 3) { return EL_STR("secga\xc3\xb0"); } if (slot == 4) { return EL_STR("secga\xc3\xb0"); } return EL_STR("secga\xc3\xb0"); return 0; } el_val_t ang_secgan_past(el_val_t slot) { if (slot == 0) { return EL_STR("s\xc3\xa6gde"); } if (slot == 1) { return EL_STR("s\xc3\xa6gdest"); } if (slot == 2) { return EL_STR("s\xc3\xa6gde"); } if (slot == 3) { return EL_STR("s\xc3\xa6gdon"); } if (slot == 4) { return EL_STR("s\xc3\xa6gdon"); } return EL_STR("s\xc3\xa6gdon"); return 0; } el_val_t ang_seon_present(el_val_t slot) { if (slot == 0) { return EL_STR("s\xc4\x93o"); } if (slot == 1) { return EL_STR("siehst"); } if (slot == 2) { return EL_STR("sieh\xc3\xbe"); } if (slot == 3) { return EL_STR("s\xc4\x93o\xc3\xb0"); } if (slot == 4) { return EL_STR("s\xc4\x93o\xc3\xb0"); } return EL_STR("s\xc4\x93o\xc3\xb0"); return 0; } el_val_t ang_seon_past(el_val_t slot) { if (slot == 0) { return EL_STR("seah"); } if (slot == 1) { return EL_STR("s\xc4\x81we"); } if (slot == 2) { return EL_STR("seah"); } if (slot == 3) { return EL_STR("s\xc4\x81won"); } if (slot == 4) { return EL_STR("s\xc4\x81won"); } return EL_STR("s\xc4\x81won"); return 0; } el_val_t ang_don_present(el_val_t slot) { if (slot == 0) { return EL_STR("d\xc5\x8d"); } if (slot == 1) { return EL_STR("d\xc4\x93st"); } if (slot == 2) { return EL_STR("d\xc4\x93\xc3\xbe"); } if (slot == 3) { return EL_STR("d\xc5\x8d\xc3\xb0"); } if (slot == 4) { return EL_STR("d\xc5\x8d\xc3\xb0"); } return EL_STR("d\xc5\x8d\xc3\xb0"); return 0; } el_val_t ang_don_past(el_val_t slot) { if (slot == 0) { return EL_STR("dyde"); } if (slot == 1) { return EL_STR("dydest"); } if (slot == 2) { return EL_STR("dyde"); } if (slot == 3) { return EL_STR("dydon"); } if (slot == 4) { return EL_STR("dydon"); } return EL_STR("dydon"); return 0; } el_val_t ang_willan_present(el_val_t slot) { if (slot == 0) { return EL_STR("wille"); } if (slot == 1) { return EL_STR("wilt"); } if (slot == 2) { return EL_STR("wile"); } if (slot == 3) { return EL_STR("willa\xc3\xb0"); } if (slot == 4) { return EL_STR("willa\xc3\xb0"); } return EL_STR("willa\xc3\xb0"); return 0; } el_val_t ang_willan_past(el_val_t slot) { if (slot == 0) { return EL_STR("wolde"); } if (slot == 1) { return EL_STR("woldest"); } if (slot == 2) { return EL_STR("wolde"); } if (slot == 3) { return EL_STR("woldon"); } if (slot == 4) { return EL_STR("woldon"); } return EL_STR("woldon"); return 0; } el_val_t ang_magan_present(el_val_t slot) { if (slot == 0) { return EL_STR("m\xc3\xa6g"); } if (slot == 1) { return EL_STR("meaht"); } if (slot == 2) { return EL_STR("m\xc3\xa6g"); } if (slot == 3) { return EL_STR("magon"); } if (slot == 4) { return EL_STR("magon"); } return EL_STR("magon"); return 0; } el_val_t ang_magan_past(el_val_t slot) { if (slot == 0) { return EL_STR("meahte"); } if (slot == 1) { return EL_STR("meahtest"); } if (slot == 2) { return EL_STR("meahte"); } if (slot == 3) { return EL_STR("meahton"); } if (slot == 4) { return EL_STR("meahton"); } return EL_STR("meahton"); return 0; } el_val_t ang_witan_present(el_val_t slot) { if (slot == 0) { return EL_STR("w\xc4\x81t"); } if (slot == 1) { return EL_STR("w\xc4\x81st"); } if (slot == 2) { return EL_STR("w\xc4\x81t"); } if (slot == 3) { return EL_STR("witon"); } if (slot == 4) { return EL_STR("witon"); } return EL_STR("witon"); return 0; } el_val_t ang_witan_past(el_val_t slot) { if (slot == 0) { return EL_STR("wisse"); } if (slot == 1) { return EL_STR("wissest"); } if (slot == 2) { return EL_STR("wisse"); } if (slot == 3) { return EL_STR("wisson"); } if (slot == 4) { return EL_STR("wisson"); } return EL_STR("wisson"); return 0; } el_val_t ang_weak_present_ending(el_val_t slot) { if (slot == 0) { return EL_STR("e"); } if (slot == 1) { return EL_STR("est"); } if (slot == 2) { return EL_STR("e\xc3\xbe"); } if (slot == 3) { return EL_STR("a\xc3\xbe"); } if (slot == 4) { return EL_STR("a\xc3\xbe"); } return EL_STR("a\xc3\xbe"); return 0; } el_val_t ang_weak_past_stem(el_val_t stem) { el_val_t slen = str_len(stem); if (slen <= 2) { return el_str_concat(stem, EL_STR("ede")); } return el_str_concat(stem, EL_STR("ode")); return 0; } el_val_t ang_weak_past(el_val_t stem, el_val_t slot) { el_val_t pstem = ang_weak_past_stem(stem); if (slot == 0) { return pstem; } if (slot == 1) { return el_str_concat(pstem, EL_STR("st")); } if (slot == 2) { return pstem; } if (slot == 3) { return el_str_concat(ang_str_drop_last(pstem, 1), EL_STR("on")); } if (slot == 4) { return el_str_concat(ang_str_drop_last(pstem, 1), EL_STR("on")); } return el_str_concat(ang_str_drop_last(pstem, 1), EL_STR("on")); return 0; } el_val_t ang_weak_stem(el_val_t verb) { if (ang_str_ends(verb, EL_STR("ian"))) { return ang_str_drop_last(verb, 3); } if (ang_str_ends(verb, EL_STR("an"))) { return ang_str_drop_last(verb, 2); } return verb; return 0; } el_val_t ang_conjugate(el_val_t verb, el_val_t tense, el_val_t person, el_val_t number) { el_val_t v = ang_map_canonical(verb); el_val_t slot = ang_slot(person, number); if (str_eq(v, EL_STR("beon"))) { if (str_eq(tense, EL_STR("present"))) { return ang_beon_present(slot); } return ang_wesan_past(slot); } if (str_eq(v, EL_STR("wesan"))) { if (str_eq(tense, EL_STR("present"))) { return ang_wesan_present(slot); } return ang_wesan_past(slot); } if (str_eq(v, EL_STR("habban"))) { if (str_eq(tense, EL_STR("present"))) { return ang_habban_present(slot); } return ang_habban_past(slot); } if (str_eq(v, EL_STR("g\xc4\x81n"))) { if (str_eq(tense, EL_STR("present"))) { return ang_gan_present(slot); } return ang_gan_past(slot); } if (str_eq(v, EL_STR("cuman"))) { if (str_eq(tense, EL_STR("present"))) { return ang_cuman_present(slot); } return ang_cuman_past(slot); } if (str_eq(v, EL_STR("secgan"))) { if (str_eq(tense, EL_STR("present"))) { return ang_secgan_present(slot); } return ang_secgan_past(slot); } if (str_eq(v, EL_STR("s\xc4\x93on"))) { if (str_eq(tense, EL_STR("present"))) { return ang_seon_present(slot); } return ang_seon_past(slot); } if (str_eq(v, EL_STR("d\xc5\x8dn"))) { if (str_eq(tense, EL_STR("present"))) { return ang_don_present(slot); } return ang_don_past(slot); } if (str_eq(v, EL_STR("willan"))) { if (str_eq(tense, EL_STR("present"))) { return ang_willan_present(slot); } return ang_willan_past(slot); } if (str_eq(v, EL_STR("magan"))) { if (str_eq(tense, EL_STR("present"))) { return ang_magan_present(slot); } return ang_magan_past(slot); } if (str_eq(v, EL_STR("witan"))) { if (str_eq(tense, EL_STR("present"))) { return ang_witan_present(slot); } return ang_witan_past(slot); } el_val_t stem = ang_weak_stem(v); if (str_eq(tense, EL_STR("present"))) { return el_str_concat(stem, ang_weak_present_ending(slot)); } if (str_eq(tense, EL_STR("past"))) { return ang_weak_past(stem, slot); } return v; return 0; } el_val_t ang_declension(el_val_t noun, el_val_t gender) { if (ang_str_ends(noun, EL_STR("a"))) { return EL_STR("weak"); } if (str_eq(gender, EL_STR("neuter"))) { return EL_STR("strong_neut"); } return EL_STR("strong_masc"); return 0; } el_val_t ang_decline_strong_masc(el_val_t noun, 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 noun; } if (str_eq(gram_case, EL_STR("accusative"))) { return noun; } if (str_eq(gram_case, EL_STR("genitive"))) { return el_str_concat(noun, EL_STR("es")); } if (str_eq(gram_case, EL_STR("dative"))) { return el_str_concat(noun, EL_STR("e")); } return noun; } if (str_eq(gram_case, EL_STR("nominative"))) { return el_str_concat(noun, EL_STR("as")); } if (str_eq(gram_case, EL_STR("accusative"))) { return el_str_concat(noun, EL_STR("as")); } if (str_eq(gram_case, EL_STR("genitive"))) { return el_str_concat(noun, EL_STR("a")); } if (str_eq(gram_case, EL_STR("dative"))) { return el_str_concat(noun, EL_STR("um")); } return el_str_concat(noun, EL_STR("as")); return 0; } el_val_t ang_decline_strong_neut(el_val_t noun, 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 noun; } if (str_eq(gram_case, EL_STR("accusative"))) { return noun; } if (str_eq(gram_case, EL_STR("genitive"))) { return el_str_concat(noun, EL_STR("es")); } if (str_eq(gram_case, EL_STR("dative"))) { return el_str_concat(noun, EL_STR("e")); } return noun; } if (str_eq(gram_case, EL_STR("nominative"))) { return noun; } if (str_eq(gram_case, EL_STR("accusative"))) { return noun; } if (str_eq(gram_case, EL_STR("genitive"))) { return el_str_concat(noun, EL_STR("a")); } if (str_eq(gram_case, EL_STR("dative"))) { return el_str_concat(noun, EL_STR("um")); } return noun; return 0; } el_val_t ang_decline_weak(el_val_t noun, el_val_t gram_case, el_val_t number) { el_val_t stem = ang_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("accusative"))) { return el_str_concat(stem, EL_STR("an")); } if (str_eq(gram_case, EL_STR("genitive"))) { return el_str_concat(stem, EL_STR("an")); } if (str_eq(gram_case, EL_STR("dative"))) { return el_str_concat(stem, EL_STR("an")); } return noun; } if (str_eq(gram_case, EL_STR("nominative"))) { return el_str_concat(stem, EL_STR("an")); } 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("ena")); } if (str_eq(gram_case, EL_STR("dative"))) { return el_str_concat(stem, EL_STR("um")); } return el_str_concat(stem, EL_STR("an")); return 0; } el_val_t ang_decline(el_val_t noun, el_val_t gram_case, el_val_t number, el_val_t gender) { el_val_t decl = ang_declension(noun, gender); if (str_eq(decl, EL_STR("strong_masc"))) { return ang_decline_strong_masc(noun, gram_case, number); } if (str_eq(decl, EL_STR("strong_neut"))) { return ang_decline_strong_neut(noun, gram_case, number); } if (str_eq(decl, EL_STR("weak"))) { return ang_decline_weak(noun, gram_case, number); } return noun; return 0; } el_val_t ang_article_masculine(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("se"); } if (str_eq(gram_case, EL_STR("accusative"))) { return EL_STR("\xc3\xbeone"); } if (str_eq(gram_case, EL_STR("genitive"))) { return EL_STR("\xc3\xbe\xc3\xa6s"); } if (str_eq(gram_case, EL_STR("dative"))) { return EL_STR("\xc3\xbe\xc7\xa3m"); } return EL_STR("se"); } if (str_eq(gram_case, EL_STR("nominative"))) { return EL_STR("\xc3\xbe\xc4\x81"); } if (str_eq(gram_case, EL_STR("accusative"))) { return EL_STR("\xc3\xbe\xc4\x81"); } if (str_eq(gram_case, EL_STR("genitive"))) { return EL_STR("\xc3\xbe\xc4\x81ra"); } if (str_eq(gram_case, EL_STR("dative"))) { return EL_STR("\xc3\xbe\xc7\xa3m"); } return EL_STR("\xc3\xbe\xc4\x81"); return 0; } el_val_t ang_article_feminine(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("s\xc4\x93o"); } if (str_eq(gram_case, EL_STR("accusative"))) { return EL_STR("\xc3\xbe\xc4\x81"); } if (str_eq(gram_case, EL_STR("genitive"))) { return EL_STR("\xc3\xbe\xc7\xa3re"); } if (str_eq(gram_case, EL_STR("dative"))) { return EL_STR("\xc3\xbe\xc7\xa3re"); } return EL_STR("s\xc4\x93o"); } if (str_eq(gram_case, EL_STR("nominative"))) { return EL_STR("\xc3\xbe\xc4\x81"); } if (str_eq(gram_case, EL_STR("accusative"))) { return EL_STR("\xc3\xbe\xc4\x81"); } if (str_eq(gram_case, EL_STR("genitive"))) { return EL_STR("\xc3\xbe\xc4\x81ra"); } if (str_eq(gram_case, EL_STR("dative"))) { return EL_STR("\xc3\xbe\xc7\xa3m"); } return EL_STR("\xc3\xbe\xc4\x81"); return 0; } el_val_t ang_article_neuter(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("\xc3\xbe\xc3\xa6t"); } if (str_eq(gram_case, EL_STR("accusative"))) { return EL_STR("\xc3\xbe\xc3\xa6t"); } if (str_eq(gram_case, EL_STR("genitive"))) { return EL_STR("\xc3\xbe\xc3\xa6s"); } if (str_eq(gram_case, EL_STR("dative"))) { return EL_STR("\xc3\xbe\xc7\xa3m"); } return EL_STR("\xc3\xbe\xc3\xa6t"); } if (str_eq(gram_case, EL_STR("nominative"))) { return EL_STR("\xc3\xbe\xc4\x81"); } if (str_eq(gram_case, EL_STR("accusative"))) { return EL_STR("\xc3\xbe\xc4\x81"); } if (str_eq(gram_case, EL_STR("genitive"))) { return EL_STR("\xc3\xbe\xc4\x81ra"); } if (str_eq(gram_case, EL_STR("dative"))) { return EL_STR("\xc3\xbe\xc7\xa3m"); } return EL_STR("\xc3\xbe\xc4\x81"); return 0; } el_val_t ang_article(el_val_t gender, el_val_t gram_case, el_val_t number) { if (str_eq(gender, EL_STR("masculine"))) { return ang_article_masculine(gram_case, number); } if (str_eq(gender, EL_STR("feminine"))) { return ang_article_feminine(gram_case, number); } return ang_article_neuter(gram_case, number); return 0; } el_val_t ang_infer_gender(el_val_t noun) { if (ang_str_ends(noun, EL_STR("u"))) { return EL_STR("feminine"); } if (ang_str_ends(noun, EL_STR("e"))) { return EL_STR("feminine"); } return EL_STR("masculine"); return 0; } el_val_t ang_noun_phrase(el_val_t noun, el_val_t gram_case, el_val_t number, el_val_t definite) { el_val_t gender = ang_infer_gender(noun); el_val_t declined = ang_decline(noun, gram_case, number, gender); if (str_eq(definite, EL_STR("true"))) { el_val_t art = ang_article(gender, gram_case, number); return el_str_concat(el_str_concat(art, EL_STR(" ")), declined); } return declined; return 0; }