48ecd83421
- 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)
816 lines
20 KiB
C
816 lines
20 KiB
C
#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 sa_str_ends(el_val_t s, el_val_t suf);
|
|
el_val_t sa_str_drop_last(el_val_t s, el_val_t n);
|
|
el_val_t sa_slot(el_val_t person, el_val_t number);
|
|
el_val_t sa_map_canonical(el_val_t verb);
|
|
el_val_t sa_as_present(el_val_t slot);
|
|
el_val_t sa_as_past(el_val_t slot);
|
|
el_val_t sa_as_future(el_val_t slot);
|
|
el_val_t sa_bhu_present(el_val_t slot);
|
|
el_val_t sa_bhu_past(el_val_t slot);
|
|
el_val_t sa_bhu_future(el_val_t slot);
|
|
el_val_t sa_gam_present(el_val_t slot);
|
|
el_val_t sa_gam_past(el_val_t slot);
|
|
el_val_t sa_gam_future(el_val_t slot);
|
|
el_val_t sa_drs_present(el_val_t slot);
|
|
el_val_t sa_drs_past(el_val_t slot);
|
|
el_val_t sa_drs_future(el_val_t slot);
|
|
el_val_t sa_vad_present(el_val_t slot);
|
|
el_val_t sa_vad_past(el_val_t slot);
|
|
el_val_t sa_vad_future(el_val_t slot);
|
|
el_val_t sa_kr_present(el_val_t slot);
|
|
el_val_t sa_kr_past(el_val_t slot);
|
|
el_val_t sa_kr_future(el_val_t slot);
|
|
el_val_t sa_class1_present_ending(el_val_t slot);
|
|
el_val_t sa_class1_past_ending(el_val_t slot);
|
|
el_val_t sa_class1_future_ending(el_val_t slot);
|
|
el_val_t sa_class1_conjugate(el_val_t stem, el_val_t tense, el_val_t slot);
|
|
el_val_t sa_conjugate(el_val_t verb, el_val_t tense, el_val_t person, el_val_t number);
|
|
el_val_t sa_decline_a_stem_sg(el_val_t stem, el_val_t gram_case);
|
|
el_val_t sa_decline_a_stem_pl(el_val_t stem, el_val_t gram_case);
|
|
el_val_t sa_decline_aa_stem_sg(el_val_t stem, el_val_t gram_case);
|
|
el_val_t sa_decline_aa_stem_pl(el_val_t stem, el_val_t gram_case);
|
|
el_val_t sa_stem_type(el_val_t noun);
|
|
el_val_t sa_extract_stem(el_val_t noun, el_val_t stype);
|
|
el_val_t sa_decline(el_val_t noun, el_val_t gram_case, el_val_t number);
|
|
el_val_t sa_noun_phrase(el_val_t noun, el_val_t gram_case, el_val_t number, el_val_t definite);
|
|
|
|
el_val_t sa_str_ends(el_val_t s, el_val_t suf) {
|
|
return str_ends_with(s, suf);
|
|
return 0;
|
|
}
|
|
|
|
el_val_t sa_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 sa_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 sa_map_canonical(el_val_t verb) {
|
|
if (str_eq(verb, EL_STR("be"))) {
|
|
return EL_STR("as");
|
|
}
|
|
if (str_eq(verb, EL_STR("become"))) {
|
|
return EL_STR("bhu");
|
|
}
|
|
if (str_eq(verb, EL_STR("go"))) {
|
|
return EL_STR("gam");
|
|
}
|
|
if (str_eq(verb, EL_STR("see"))) {
|
|
return EL_STR("drs");
|
|
}
|
|
if (str_eq(verb, EL_STR("speak"))) {
|
|
return EL_STR("vad");
|
|
}
|
|
if (str_eq(verb, EL_STR("say"))) {
|
|
return EL_STR("vad");
|
|
}
|
|
if (str_eq(verb, EL_STR("do"))) {
|
|
return EL_STR("kr");
|
|
}
|
|
if (str_eq(verb, EL_STR("make"))) {
|
|
return EL_STR("kr");
|
|
}
|
|
return verb;
|
|
return 0;
|
|
}
|
|
|
|
el_val_t sa_as_present(el_val_t slot) {
|
|
if (slot == 0) {
|
|
return EL_STR("asmi");
|
|
}
|
|
if (slot == 1) {
|
|
return EL_STR("asi");
|
|
}
|
|
if (slot == 2) {
|
|
return EL_STR("asti");
|
|
}
|
|
if (slot == 3) {
|
|
return EL_STR("sma\xe1\xb8\xa5");
|
|
}
|
|
if (slot == 4) {
|
|
return EL_STR("stha");
|
|
}
|
|
return EL_STR("santi");
|
|
return 0;
|
|
}
|
|
|
|
el_val_t sa_as_past(el_val_t slot) {
|
|
if (slot == 0) {
|
|
return EL_STR("\xc4\x81sam");
|
|
}
|
|
if (slot == 1) {
|
|
return EL_STR("\xc4\x81s\xc4\xab\xe1\xb8\xa5");
|
|
}
|
|
if (slot == 2) {
|
|
return EL_STR("\xc4\x81s\xc4\xabt");
|
|
}
|
|
if (slot == 3) {
|
|
return EL_STR("\xc4\x81sma");
|
|
}
|
|
if (slot == 4) {
|
|
return EL_STR("\xc4\x81sta");
|
|
}
|
|
return EL_STR("\xc4\x81san");
|
|
return 0;
|
|
}
|
|
|
|
el_val_t sa_as_future(el_val_t slot) {
|
|
if (slot == 0) {
|
|
return EL_STR("bhavi\xe1\xb9\xa3y\xc4\x81mi");
|
|
}
|
|
if (slot == 1) {
|
|
return EL_STR("bhavi\xe1\xb9\xa3yasi");
|
|
}
|
|
if (slot == 2) {
|
|
return EL_STR("bhavi\xe1\xb9\xa3yati");
|
|
}
|
|
if (slot == 3) {
|
|
return EL_STR("bhavi\xe1\xb9\xa3y\xc4\x81ma\xe1\xb8\xa5");
|
|
}
|
|
if (slot == 4) {
|
|
return EL_STR("bhavi\xe1\xb9\xa3yatha");
|
|
}
|
|
return EL_STR("bhavi\xe1\xb9\xa3yanti");
|
|
return 0;
|
|
}
|
|
|
|
el_val_t sa_bhu_present(el_val_t slot) {
|
|
if (slot == 0) {
|
|
return EL_STR("bhav\xc4\x81mi");
|
|
}
|
|
if (slot == 1) {
|
|
return EL_STR("bhavasi");
|
|
}
|
|
if (slot == 2) {
|
|
return EL_STR("bhavati");
|
|
}
|
|
if (slot == 3) {
|
|
return EL_STR("bhav\xc4\x81ma\xe1\xb8\xa5");
|
|
}
|
|
if (slot == 4) {
|
|
return EL_STR("bhavatha");
|
|
}
|
|
return EL_STR("bhavanti");
|
|
return 0;
|
|
}
|
|
|
|
el_val_t sa_bhu_past(el_val_t slot) {
|
|
if (slot == 0) {
|
|
return EL_STR("abhavam");
|
|
}
|
|
if (slot == 1) {
|
|
return EL_STR("abhava\xe1\xb8\xa5");
|
|
}
|
|
if (slot == 2) {
|
|
return EL_STR("abhavat");
|
|
}
|
|
if (slot == 3) {
|
|
return EL_STR("abhav\xc4\x81ma");
|
|
}
|
|
if (slot == 4) {
|
|
return EL_STR("abhavata");
|
|
}
|
|
return EL_STR("abhavan");
|
|
return 0;
|
|
}
|
|
|
|
el_val_t sa_bhu_future(el_val_t slot) {
|
|
if (slot == 0) {
|
|
return EL_STR("bhavi\xe1\xb9\xa3y\xc4\x81mi");
|
|
}
|
|
if (slot == 1) {
|
|
return EL_STR("bhavi\xe1\xb9\xa3yasi");
|
|
}
|
|
if (slot == 2) {
|
|
return EL_STR("bhavi\xe1\xb9\xa3yati");
|
|
}
|
|
if (slot == 3) {
|
|
return EL_STR("bhavi\xe1\xb9\xa3y\xc4\x81ma\xe1\xb8\xa5");
|
|
}
|
|
if (slot == 4) {
|
|
return EL_STR("bhavi\xe1\xb9\xa3yatha");
|
|
}
|
|
return EL_STR("bhavi\xe1\xb9\xa3yanti");
|
|
return 0;
|
|
}
|
|
|
|
el_val_t sa_gam_present(el_val_t slot) {
|
|
if (slot == 0) {
|
|
return EL_STR("gacch\xc4\x81mi");
|
|
}
|
|
if (slot == 1) {
|
|
return EL_STR("gacchasi");
|
|
}
|
|
if (slot == 2) {
|
|
return EL_STR("gacchati");
|
|
}
|
|
if (slot == 3) {
|
|
return EL_STR("gacch\xc4\x81ma\xe1\xb8\xa5");
|
|
}
|
|
if (slot == 4) {
|
|
return EL_STR("gacchatha");
|
|
}
|
|
return EL_STR("gacchanti");
|
|
return 0;
|
|
}
|
|
|
|
el_val_t sa_gam_past(el_val_t slot) {
|
|
if (slot == 0) {
|
|
return EL_STR("agaccham");
|
|
}
|
|
if (slot == 1) {
|
|
return EL_STR("agaccha\xe1\xb8\xa5");
|
|
}
|
|
if (slot == 2) {
|
|
return EL_STR("agacchat");
|
|
}
|
|
if (slot == 3) {
|
|
return EL_STR("agacch\xc4\x81ma");
|
|
}
|
|
if (slot == 4) {
|
|
return EL_STR("agacchata");
|
|
}
|
|
return EL_STR("agacchan");
|
|
return 0;
|
|
}
|
|
|
|
el_val_t sa_gam_future(el_val_t slot) {
|
|
if (slot == 0) {
|
|
return EL_STR("gami\xe1\xb9\xa3y\xc4\x81mi");
|
|
}
|
|
if (slot == 1) {
|
|
return EL_STR("gami\xe1\xb9\xa3yasi");
|
|
}
|
|
if (slot == 2) {
|
|
return EL_STR("gami\xe1\xb9\xa3yati");
|
|
}
|
|
if (slot == 3) {
|
|
return EL_STR("gami\xe1\xb9\xa3y\xc4\x81ma\xe1\xb8\xa5");
|
|
}
|
|
if (slot == 4) {
|
|
return EL_STR("gami\xe1\xb9\xa3yatha");
|
|
}
|
|
return EL_STR("gami\xe1\xb9\xa3yanti");
|
|
return 0;
|
|
}
|
|
|
|
el_val_t sa_drs_present(el_val_t slot) {
|
|
if (slot == 0) {
|
|
return EL_STR("pa\xc5\x9by\xc4\x81mi");
|
|
}
|
|
if (slot == 1) {
|
|
return EL_STR("pa\xc5\x9byasi");
|
|
}
|
|
if (slot == 2) {
|
|
return EL_STR("pa\xc5\x9byati");
|
|
}
|
|
if (slot == 3) {
|
|
return EL_STR("pa\xc5\x9by\xc4\x81ma\xe1\xb8\xa5");
|
|
}
|
|
if (slot == 4) {
|
|
return EL_STR("pa\xc5\x9byatha");
|
|
}
|
|
return EL_STR("pa\xc5\x9byanti");
|
|
return 0;
|
|
}
|
|
|
|
el_val_t sa_drs_past(el_val_t slot) {
|
|
if (slot == 0) {
|
|
return EL_STR("apa\xc5\x9byam");
|
|
}
|
|
if (slot == 1) {
|
|
return EL_STR("apa\xc5\x9bya\xe1\xb8\xa5");
|
|
}
|
|
if (slot == 2) {
|
|
return EL_STR("apa\xc5\x9byat");
|
|
}
|
|
if (slot == 3) {
|
|
return EL_STR("apa\xc5\x9by\xc4\x81ma");
|
|
}
|
|
if (slot == 4) {
|
|
return EL_STR("apa\xc5\x9byata");
|
|
}
|
|
return EL_STR("apa\xc5\x9byan");
|
|
return 0;
|
|
}
|
|
|
|
el_val_t sa_drs_future(el_val_t slot) {
|
|
if (slot == 0) {
|
|
return EL_STR("drak\xe1\xb9\xa3y\xc4\x81mi");
|
|
}
|
|
if (slot == 1) {
|
|
return EL_STR("drak\xe1\xb9\xa3yasi");
|
|
}
|
|
if (slot == 2) {
|
|
return EL_STR("drak\xe1\xb9\xa3yati");
|
|
}
|
|
if (slot == 3) {
|
|
return EL_STR("drak\xe1\xb9\xa3y\xc4\x81ma\xe1\xb8\xa5");
|
|
}
|
|
if (slot == 4) {
|
|
return EL_STR("drak\xe1\xb9\xa3yatha");
|
|
}
|
|
return EL_STR("drak\xe1\xb9\xa3yanti");
|
|
return 0;
|
|
}
|
|
|
|
el_val_t sa_vad_present(el_val_t slot) {
|
|
if (slot == 0) {
|
|
return EL_STR("vad\xc4\x81mi");
|
|
}
|
|
if (slot == 1) {
|
|
return EL_STR("vadasi");
|
|
}
|
|
if (slot == 2) {
|
|
return EL_STR("vadati");
|
|
}
|
|
if (slot == 3) {
|
|
return EL_STR("vad\xc4\x81ma\xe1\xb8\xa5");
|
|
}
|
|
if (slot == 4) {
|
|
return EL_STR("vadatha");
|
|
}
|
|
return EL_STR("vadanti");
|
|
return 0;
|
|
}
|
|
|
|
el_val_t sa_vad_past(el_val_t slot) {
|
|
if (slot == 0) {
|
|
return EL_STR("avadam");
|
|
}
|
|
if (slot == 1) {
|
|
return EL_STR("avada\xe1\xb8\xa5");
|
|
}
|
|
if (slot == 2) {
|
|
return EL_STR("avadat");
|
|
}
|
|
if (slot == 3) {
|
|
return EL_STR("avad\xc4\x81ma");
|
|
}
|
|
if (slot == 4) {
|
|
return EL_STR("avadata");
|
|
}
|
|
return EL_STR("avadan");
|
|
return 0;
|
|
}
|
|
|
|
el_val_t sa_vad_future(el_val_t slot) {
|
|
if (slot == 0) {
|
|
return EL_STR("vadi\xe1\xb9\xa3y\xc4\x81mi");
|
|
}
|
|
if (slot == 1) {
|
|
return EL_STR("vadi\xe1\xb9\xa3yasi");
|
|
}
|
|
if (slot == 2) {
|
|
return EL_STR("vadi\xe1\xb9\xa3yati");
|
|
}
|
|
if (slot == 3) {
|
|
return EL_STR("vadi\xe1\xb9\xa3y\xc4\x81ma\xe1\xb8\xa5");
|
|
}
|
|
if (slot == 4) {
|
|
return EL_STR("vadi\xe1\xb9\xa3yatha");
|
|
}
|
|
return EL_STR("vadi\xe1\xb9\xa3yanti");
|
|
return 0;
|
|
}
|
|
|
|
el_val_t sa_kr_present(el_val_t slot) {
|
|
if (slot == 0) {
|
|
return EL_STR("karomi");
|
|
}
|
|
if (slot == 1) {
|
|
return EL_STR("karo\xe1\xb9\xa3i");
|
|
}
|
|
if (slot == 2) {
|
|
return EL_STR("karoti");
|
|
}
|
|
if (slot == 3) {
|
|
return EL_STR("kurma\xe1\xb8\xa5");
|
|
}
|
|
if (slot == 4) {
|
|
return EL_STR("kurutha");
|
|
}
|
|
return EL_STR("kurvanti");
|
|
return 0;
|
|
}
|
|
|
|
el_val_t sa_kr_past(el_val_t slot) {
|
|
if (slot == 0) {
|
|
return EL_STR("akaravam");
|
|
}
|
|
if (slot == 1) {
|
|
return EL_STR("akaroda\xe1\xb8\xa5");
|
|
}
|
|
if (slot == 2) {
|
|
return EL_STR("akarot");
|
|
}
|
|
if (slot == 3) {
|
|
return EL_STR("akurma");
|
|
}
|
|
if (slot == 4) {
|
|
return EL_STR("akuruta");
|
|
}
|
|
return EL_STR("akurvan");
|
|
return 0;
|
|
}
|
|
|
|
el_val_t sa_kr_future(el_val_t slot) {
|
|
if (slot == 0) {
|
|
return EL_STR("kari\xe1\xb9\xa3y\xc4\x81mi");
|
|
}
|
|
if (slot == 1) {
|
|
return EL_STR("kari\xe1\xb9\xa3yasi");
|
|
}
|
|
if (slot == 2) {
|
|
return EL_STR("kari\xe1\xb9\xa3yati");
|
|
}
|
|
if (slot == 3) {
|
|
return EL_STR("kari\xe1\xb9\xa3y\xc4\x81ma\xe1\xb8\xa5");
|
|
}
|
|
if (slot == 4) {
|
|
return EL_STR("kari\xe1\xb9\xa3yatha");
|
|
}
|
|
return EL_STR("kari\xe1\xb9\xa3yanti");
|
|
return 0;
|
|
}
|
|
|
|
el_val_t sa_class1_present_ending(el_val_t slot) {
|
|
if (slot == 0) {
|
|
return EL_STR("\xc4\x81mi");
|
|
}
|
|
if (slot == 1) {
|
|
return EL_STR("asi");
|
|
}
|
|
if (slot == 2) {
|
|
return EL_STR("ati");
|
|
}
|
|
if (slot == 3) {
|
|
return EL_STR("\xc4\x81ma\xe1\xb8\xa5");
|
|
}
|
|
if (slot == 4) {
|
|
return EL_STR("atha");
|
|
}
|
|
return EL_STR("anti");
|
|
return 0;
|
|
}
|
|
|
|
el_val_t sa_class1_past_ending(el_val_t slot) {
|
|
if (slot == 0) {
|
|
return EL_STR("am");
|
|
}
|
|
if (slot == 1) {
|
|
return EL_STR("a\xe1\xb8\xa5");
|
|
}
|
|
if (slot == 2) {
|
|
return EL_STR("at");
|
|
}
|
|
if (slot == 3) {
|
|
return EL_STR("\xc4\x81ma");
|
|
}
|
|
if (slot == 4) {
|
|
return EL_STR("ata");
|
|
}
|
|
return EL_STR("an");
|
|
return 0;
|
|
}
|
|
|
|
el_val_t sa_class1_future_ending(el_val_t slot) {
|
|
if (slot == 0) {
|
|
return EL_STR("i\xe1\xb9\xa3y\xc4\x81mi");
|
|
}
|
|
if (slot == 1) {
|
|
return EL_STR("i\xe1\xb9\xa3yasi");
|
|
}
|
|
if (slot == 2) {
|
|
return EL_STR("i\xe1\xb9\xa3yati");
|
|
}
|
|
if (slot == 3) {
|
|
return EL_STR("i\xe1\xb9\xa3y\xc4\x81ma\xe1\xb8\xa5");
|
|
}
|
|
if (slot == 4) {
|
|
return EL_STR("i\xe1\xb9\xa3yatha");
|
|
}
|
|
return EL_STR("i\xe1\xb9\xa3yanti");
|
|
return 0;
|
|
}
|
|
|
|
el_val_t sa_class1_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, sa_class1_present_ending(slot));
|
|
}
|
|
if (str_eq(tense, EL_STR("past"))) {
|
|
return el_str_concat(el_str_concat(EL_STR("a"), stem), sa_class1_past_ending(slot));
|
|
}
|
|
if (str_eq(tense, EL_STR("future"))) {
|
|
return el_str_concat(stem, sa_class1_future_ending(slot));
|
|
}
|
|
return stem;
|
|
return 0;
|
|
}
|
|
|
|
el_val_t sa_conjugate(el_val_t verb, el_val_t tense, el_val_t person, el_val_t number) {
|
|
el_val_t v = sa_map_canonical(verb);
|
|
el_val_t slot = sa_slot(person, number);
|
|
if (str_eq(v, EL_STR("as"))) {
|
|
if (str_eq(tense, EL_STR("present"))) {
|
|
return sa_as_present(slot);
|
|
}
|
|
if (str_eq(tense, EL_STR("past"))) {
|
|
return sa_as_past(slot);
|
|
}
|
|
if (str_eq(tense, EL_STR("future"))) {
|
|
return sa_as_future(slot);
|
|
}
|
|
return v;
|
|
}
|
|
if (str_eq(v, EL_STR("bhu"))) {
|
|
if (str_eq(tense, EL_STR("present"))) {
|
|
return sa_bhu_present(slot);
|
|
}
|
|
if (str_eq(tense, EL_STR("past"))) {
|
|
return sa_bhu_past(slot);
|
|
}
|
|
if (str_eq(tense, EL_STR("future"))) {
|
|
return sa_bhu_future(slot);
|
|
}
|
|
return v;
|
|
}
|
|
if (str_eq(v, EL_STR("gam"))) {
|
|
if (str_eq(tense, EL_STR("present"))) {
|
|
return sa_gam_present(slot);
|
|
}
|
|
if (str_eq(tense, EL_STR("past"))) {
|
|
return sa_gam_past(slot);
|
|
}
|
|
if (str_eq(tense, EL_STR("future"))) {
|
|
return sa_gam_future(slot);
|
|
}
|
|
return v;
|
|
}
|
|
if (str_eq(v, EL_STR("drs"))) {
|
|
if (str_eq(tense, EL_STR("present"))) {
|
|
return sa_drs_present(slot);
|
|
}
|
|
if (str_eq(tense, EL_STR("past"))) {
|
|
return sa_drs_past(slot);
|
|
}
|
|
if (str_eq(tense, EL_STR("future"))) {
|
|
return sa_drs_future(slot);
|
|
}
|
|
return v;
|
|
}
|
|
if (str_eq(v, EL_STR("vad"))) {
|
|
if (str_eq(tense, EL_STR("present"))) {
|
|
return sa_vad_present(slot);
|
|
}
|
|
if (str_eq(tense, EL_STR("past"))) {
|
|
return sa_vad_past(slot);
|
|
}
|
|
if (str_eq(tense, EL_STR("future"))) {
|
|
return sa_vad_future(slot);
|
|
}
|
|
return v;
|
|
}
|
|
if (str_eq(v, EL_STR("kr"))) {
|
|
if (str_eq(tense, EL_STR("present"))) {
|
|
return sa_kr_present(slot);
|
|
}
|
|
if (str_eq(tense, EL_STR("past"))) {
|
|
return sa_kr_past(slot);
|
|
}
|
|
if (str_eq(tense, EL_STR("future"))) {
|
|
return sa_kr_future(slot);
|
|
}
|
|
return v;
|
|
}
|
|
return sa_class1_conjugate(v, tense, slot);
|
|
return 0;
|
|
}
|
|
|
|
el_val_t sa_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("\xe1\xb8\xa5"));
|
|
}
|
|
if (str_eq(gram_case, EL_STR("accusative"))) {
|
|
return el_str_concat(stem, EL_STR("m"));
|
|
}
|
|
if (str_eq(gram_case, EL_STR("instrumental"))) {
|
|
return el_str_concat(stem, EL_STR("ena"));
|
|
}
|
|
if (str_eq(gram_case, EL_STR("dative"))) {
|
|
return el_str_concat(stem, EL_STR("\xc4\x81ya"));
|
|
}
|
|
if (str_eq(gram_case, EL_STR("ablative"))) {
|
|
return el_str_concat(stem, EL_STR("\xc4\x81t"));
|
|
}
|
|
if (str_eq(gram_case, EL_STR("genitive"))) {
|
|
return el_str_concat(stem, EL_STR("sya"));
|
|
}
|
|
if (str_eq(gram_case, EL_STR("locative"))) {
|
|
return el_str_concat(stem, EL_STR("e"));
|
|
}
|
|
if (str_eq(gram_case, EL_STR("vocative"))) {
|
|
return stem;
|
|
}
|
|
return stem;
|
|
return 0;
|
|
}
|
|
|
|
el_val_t sa_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("\xc4\x81\xe1\xb8\xa5"));
|
|
}
|
|
if (str_eq(gram_case, EL_STR("accusative"))) {
|
|
return el_str_concat(stem, EL_STR("\xc4\x81n"));
|
|
}
|
|
if (str_eq(gram_case, EL_STR("instrumental"))) {
|
|
return el_str_concat(stem, EL_STR("ai\xe1\xb8\xa5"));
|
|
}
|
|
if (str_eq(gram_case, EL_STR("dative"))) {
|
|
return el_str_concat(stem, EL_STR("ebhya\xe1\xb8\xa5"));
|
|
}
|
|
if (str_eq(gram_case, EL_STR("ablative"))) {
|
|
return el_str_concat(stem, EL_STR("ebhya\xe1\xb8\xa5"));
|
|
}
|
|
if (str_eq(gram_case, EL_STR("genitive"))) {
|
|
return el_str_concat(stem, EL_STR("\xc4\x81n\xc4\x81m"));
|
|
}
|
|
if (str_eq(gram_case, EL_STR("locative"))) {
|
|
return el_str_concat(stem, EL_STR("e\xe1\xb9\xa3u"));
|
|
}
|
|
if (str_eq(gram_case, EL_STR("vocative"))) {
|
|
return el_str_concat(stem, EL_STR("\xc4\x81\xe1\xb8\xa5"));
|
|
}
|
|
return el_str_concat(stem, EL_STR("\xc4\x81\xe1\xb8\xa5"));
|
|
return 0;
|
|
}
|
|
|
|
el_val_t sa_decline_aa_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("\xc4\xab"));
|
|
}
|
|
if (str_eq(gram_case, EL_STR("accusative"))) {
|
|
return el_str_concat(stem, EL_STR("\xc4\xabm"));
|
|
}
|
|
if (str_eq(gram_case, EL_STR("instrumental"))) {
|
|
return el_str_concat(stem, EL_STR("y\xc4\x81"));
|
|
}
|
|
if (str_eq(gram_case, EL_STR("dative"))) {
|
|
return el_str_concat(stem, EL_STR("yai"));
|
|
}
|
|
if (str_eq(gram_case, EL_STR("ablative"))) {
|
|
return el_str_concat(stem, EL_STR("y\xc4\x81\xe1\xb8\xa5"));
|
|
}
|
|
if (str_eq(gram_case, EL_STR("genitive"))) {
|
|
return el_str_concat(stem, EL_STR("y\xc4\x81\xe1\xb8\xa5"));
|
|
}
|
|
if (str_eq(gram_case, EL_STR("locative"))) {
|
|
return el_str_concat(stem, EL_STR("y\xc4\x81m"));
|
|
}
|
|
if (str_eq(gram_case, EL_STR("vocative"))) {
|
|
return el_str_concat(stem, EL_STR("i"));
|
|
}
|
|
return el_str_concat(stem, EL_STR("\xc4\xab"));
|
|
return 0;
|
|
}
|
|
|
|
el_val_t sa_decline_aa_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("ya\xe1\xb8\xa5"));
|
|
}
|
|
if (str_eq(gram_case, EL_STR("accusative"))) {
|
|
return el_str_concat(stem, EL_STR("\xc4\xab\xe1\xb8\xa5"));
|
|
}
|
|
if (str_eq(gram_case, EL_STR("instrumental"))) {
|
|
return el_str_concat(stem, EL_STR("\xc4\xab""bhi\xe1\xb8\xa5"));
|
|
}
|
|
if (str_eq(gram_case, EL_STR("dative"))) {
|
|
return el_str_concat(stem, EL_STR("\xc4\xab""bhya\xe1\xb8\xa5"));
|
|
}
|
|
if (str_eq(gram_case, EL_STR("ablative"))) {
|
|
return el_str_concat(stem, EL_STR("\xc4\xab""bhya\xe1\xb8\xa5"));
|
|
}
|
|
if (str_eq(gram_case, EL_STR("genitive"))) {
|
|
return el_str_concat(stem, EL_STR("\xc4\xab\xe1\xb9\x87\xc4\x81m"));
|
|
}
|
|
if (str_eq(gram_case, EL_STR("locative"))) {
|
|
return el_str_concat(stem, EL_STR("\xc4\xab\xe1\xb9\xa3u"));
|
|
}
|
|
if (str_eq(gram_case, EL_STR("vocative"))) {
|
|
return el_str_concat(stem, EL_STR("ya\xe1\xb8\xa5"));
|
|
}
|
|
return el_str_concat(stem, EL_STR("ya\xe1\xb8\xa5"));
|
|
return 0;
|
|
}
|
|
|
|
el_val_t sa_stem_type(el_val_t noun) {
|
|
if (sa_str_ends(noun, EL_STR("\xc4\x81"))) {
|
|
return EL_STR("aa");
|
|
}
|
|
if (sa_str_ends(noun, EL_STR("\xc4\xab"))) {
|
|
return EL_STR("aa");
|
|
}
|
|
if (sa_str_ends(noun, EL_STR("a\xe1\xb8\xa5"))) {
|
|
return EL_STR("a");
|
|
}
|
|
if (sa_str_ends(noun, EL_STR("a"))) {
|
|
return EL_STR("a");
|
|
}
|
|
return EL_STR("unknown");
|
|
return 0;
|
|
}
|
|
|
|
el_val_t sa_extract_stem(el_val_t noun, el_val_t stype) {
|
|
el_val_t n = str_len(noun);
|
|
if (str_eq(stype, EL_STR("a"))) {
|
|
if (sa_str_ends(noun, EL_STR("a\xe1\xb8\xa5"))) {
|
|
return str_slice(noun, 0, (n - 4));
|
|
}
|
|
return str_slice(noun, 0, (n - 1));
|
|
}
|
|
if (str_eq(stype, EL_STR("aa"))) {
|
|
return str_slice(noun, 0, (n - 2));
|
|
}
|
|
return noun;
|
|
return 0;
|
|
}
|
|
|
|
el_val_t sa_decline(el_val_t noun, el_val_t gram_case, el_val_t number) {
|
|
el_val_t stype = sa_stem_type(noun);
|
|
if (str_eq(stype, EL_STR("a"))) {
|
|
el_val_t stem = sa_extract_stem(noun, EL_STR("a"));
|
|
if (str_eq(number, EL_STR("singular"))) {
|
|
return sa_decline_a_stem_sg(stem, gram_case);
|
|
}
|
|
return sa_decline_a_stem_pl(stem, gram_case);
|
|
}
|
|
if (str_eq(stype, EL_STR("aa"))) {
|
|
el_val_t stem = sa_extract_stem(noun, EL_STR("aa"));
|
|
if (str_eq(number, EL_STR("singular"))) {
|
|
return sa_decline_aa_stem_sg(stem, gram_case);
|
|
}
|
|
return sa_decline_aa_stem_pl(stem, gram_case);
|
|
}
|
|
return noun;
|
|
return 0;
|
|
}
|
|
|
|
el_val_t sa_noun_phrase(el_val_t noun, el_val_t gram_case, el_val_t number, el_val_t definite) {
|
|
return sa_decline(noun, gram_case, number);
|
|
return 0;
|
|
}
|
|
|