Files
neuron/dist/morphology-fr.c
T
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

976 lines
22 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 fr_str_ends(el_val_t s, el_val_t suf);
el_val_t fr_str_drop_last(el_val_t s, el_val_t n);
el_val_t fr_str_last_char(el_val_t s);
el_val_t fr_str_last2(el_val_t s);
el_val_t fr_is_vowel_start(el_val_t s);
el_val_t fr_is_known_irregular(el_val_t verb);
el_val_t fr_verb_group(el_val_t base);
el_val_t fr_stem(el_val_t base);
el_val_t fr_slot(el_val_t person, el_val_t number);
el_val_t fr_irregular_present(el_val_t verb, el_val_t person, el_val_t number);
el_val_t fr_regular_present(el_val_t stem, el_val_t vgroup, el_val_t slot);
el_val_t fr_future_stem(el_val_t base, el_val_t vgroup);
el_val_t fr_regular_future(el_val_t fstem, el_val_t slot);
el_val_t fr_irregular_future_stem(el_val_t verb);
el_val_t fr_imperfect_stem(el_val_t base, el_val_t vgroup);
el_val_t fr_regular_imperfect(el_val_t istem, el_val_t slot);
el_val_t fr_uses_etre(el_val_t verb);
el_val_t fr_past_participle(el_val_t verb);
el_val_t fr_avoir_present(el_val_t slot);
el_val_t fr_etre_present(el_val_t slot);
el_val_t fr_conjugate(el_val_t verb, el_val_t tense, el_val_t person, el_val_t number);
el_val_t fr_gender(el_val_t noun);
el_val_t fr_invariant_plural(el_val_t noun);
el_val_t fr_pluralize(el_val_t noun);
el_val_t fr_agree_article(el_val_t noun, el_val_t definite, el_val_t number);
el_val_t fr_subject_starts_vowel(el_val_t subject);
el_val_t fr_verb_ends_vowel(el_val_t verb_form);
el_val_t fr_question_inversion(el_val_t subject, el_val_t verb_form);
el_val_t fr_str_ends(el_val_t s, el_val_t suf) {
return str_ends_with(s, suf);
return 0;
}
el_val_t fr_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 fr_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 fr_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 fr_is_vowel_start(el_val_t s) {
el_val_t n = str_len(s);
if (n == 0) {
return 0;
}
el_val_t c = str_slice(s, 0, 1);
if (str_eq(c, EL_STR("a"))) {
return 1;
}
if (str_eq(c, EL_STR("e"))) {
return 1;
}
if (str_eq(c, EL_STR("\xc3\xa9"))) {
return 1;
}
if (str_eq(c, EL_STR("\xc3\xa8"))) {
return 1;
}
if (str_eq(c, EL_STR("\xc3\xaa"))) {
return 1;
}
if (str_eq(c, EL_STR("i"))) {
return 1;
}
if (str_eq(c, EL_STR("\xc3\xae"))) {
return 1;
}
if (str_eq(c, EL_STR("o"))) {
return 1;
}
if (str_eq(c, EL_STR("\xc3\xb4"))) {
return 1;
}
if (str_eq(c, EL_STR("u"))) {
return 1;
}
if (str_eq(c, EL_STR("\xc3\xbb"))) {
return 1;
}
if (str_eq(c, EL_STR("h"))) {
return 1;
}
return 0;
return 0;
}
el_val_t fr_is_known_irregular(el_val_t verb) {
if (str_eq(verb, EL_STR("\xc3\xaatre"))) {
return 1;
}
if (str_eq(verb, EL_STR("avoir"))) {
return 1;
}
if (str_eq(verb, EL_STR("aller"))) {
return 1;
}
if (str_eq(verb, EL_STR("faire"))) {
return 1;
}
if (str_eq(verb, EL_STR("pouvoir"))) {
return 1;
}
if (str_eq(verb, EL_STR("vouloir"))) {
return 1;
}
if (str_eq(verb, EL_STR("venir"))) {
return 1;
}
if (str_eq(verb, EL_STR("dire"))) {
return 1;
}
if (str_eq(verb, EL_STR("voir"))) {
return 1;
}
if (str_eq(verb, EL_STR("prendre"))) {
return 1;
}
if (str_eq(verb, EL_STR("mettre"))) {
return 1;
}
if (str_eq(verb, EL_STR("savoir"))) {
return 1;
}
return 0;
return 0;
}
el_val_t fr_verb_group(el_val_t base) {
if (fr_is_known_irregular(base)) {
return EL_STR("irregular");
}
if (fr_str_ends(base, EL_STR("er"))) {
return EL_STR("er");
}
if (fr_str_ends(base, EL_STR("ir"))) {
return EL_STR("ir");
}
if (fr_str_ends(base, EL_STR("re"))) {
return EL_STR("re");
}
return EL_STR("er");
return 0;
}
el_val_t fr_stem(el_val_t base) {
return fr_str_drop_last(base, 2);
return 0;
}
el_val_t fr_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 fr_irregular_present(el_val_t verb, el_val_t person, el_val_t number) {
el_val_t slot = fr_slot(person, number);
if (str_eq(verb, EL_STR("\xc3\xaatre"))) {
if (slot == 0) {
return EL_STR("suis");
}
if (slot == 1) {
return EL_STR("es");
}
if (slot == 2) {
return EL_STR("est");
}
if (slot == 3) {
return EL_STR("sommes");
}
if (slot == 4) {
return EL_STR("etes");
}
return EL_STR("sont");
}
if (str_eq(verb, EL_STR("etre"))) {
if (slot == 0) {
return EL_STR("suis");
}
if (slot == 1) {
return EL_STR("es");
}
if (slot == 2) {
return EL_STR("est");
}
if (slot == 3) {
return EL_STR("sommes");
}
if (slot == 4) {
return EL_STR("etes");
}
return EL_STR("sont");
}
if (str_eq(verb, EL_STR("avoir"))) {
if (slot == 0) {
return EL_STR("ai");
}
if (slot == 1) {
return EL_STR("as");
}
if (slot == 2) {
return EL_STR("a");
}
if (slot == 3) {
return EL_STR("avons");
}
if (slot == 4) {
return EL_STR("avez");
}
return EL_STR("ont");
}
if (str_eq(verb, EL_STR("aller"))) {
if (slot == 0) {
return EL_STR("vais");
}
if (slot == 1) {
return EL_STR("vas");
}
if (slot == 2) {
return EL_STR("va");
}
if (slot == 3) {
return EL_STR("allons");
}
if (slot == 4) {
return EL_STR("allez");
}
return EL_STR("vont");
}
if (str_eq(verb, EL_STR("faire"))) {
if (slot == 0) {
return EL_STR("fais");
}
if (slot == 1) {
return EL_STR("fais");
}
if (slot == 2) {
return EL_STR("fait");
}
if (slot == 3) {
return EL_STR("faisons");
}
if (slot == 4) {
return EL_STR("faites");
}
return EL_STR("font");
}
if (str_eq(verb, EL_STR("pouvoir"))) {
if (slot == 0) {
return EL_STR("peux");
}
if (slot == 1) {
return EL_STR("peux");
}
if (slot == 2) {
return EL_STR("peut");
}
if (slot == 3) {
return EL_STR("pouvons");
}
if (slot == 4) {
return EL_STR("pouvez");
}
return EL_STR("peuvent");
}
if (str_eq(verb, EL_STR("vouloir"))) {
if (slot == 0) {
return EL_STR("veux");
}
if (slot == 1) {
return EL_STR("veux");
}
if (slot == 2) {
return EL_STR("veut");
}
if (slot == 3) {
return EL_STR("voulons");
}
if (slot == 4) {
return EL_STR("voulez");
}
return EL_STR("veulent");
}
if (str_eq(verb, EL_STR("venir"))) {
if (slot == 0) {
return EL_STR("viens");
}
if (slot == 1) {
return EL_STR("viens");
}
if (slot == 2) {
return EL_STR("vient");
}
if (slot == 3) {
return EL_STR("venons");
}
if (slot == 4) {
return EL_STR("venez");
}
return EL_STR("viennent");
}
if (str_eq(verb, EL_STR("dire"))) {
if (slot == 0) {
return EL_STR("dis");
}
if (slot == 1) {
return EL_STR("dis");
}
if (slot == 2) {
return EL_STR("dit");
}
if (slot == 3) {
return EL_STR("disons");
}
if (slot == 4) {
return EL_STR("dites");
}
return EL_STR("disent");
}
if (str_eq(verb, EL_STR("voir"))) {
if (slot == 0) {
return EL_STR("vois");
}
if (slot == 1) {
return EL_STR("vois");
}
if (slot == 2) {
return EL_STR("voit");
}
if (slot == 3) {
return EL_STR("voyons");
}
if (slot == 4) {
return EL_STR("voyez");
}
return EL_STR("voient");
}
if (str_eq(verb, EL_STR("prendre"))) {
if (slot == 0) {
return EL_STR("prends");
}
if (slot == 1) {
return EL_STR("prends");
}
if (slot == 2) {
return EL_STR("prend");
}
if (slot == 3) {
return EL_STR("prenons");
}
if (slot == 4) {
return EL_STR("prenez");
}
return EL_STR("prennent");
}
if (str_eq(verb, EL_STR("mettre"))) {
if (slot == 0) {
return EL_STR("mets");
}
if (slot == 1) {
return EL_STR("mets");
}
if (slot == 2) {
return EL_STR("met");
}
if (slot == 3) {
return EL_STR("mettons");
}
if (slot == 4) {
return EL_STR("mettez");
}
return EL_STR("mettent");
}
if (str_eq(verb, EL_STR("savoir"))) {
if (slot == 0) {
return EL_STR("sais");
}
if (slot == 1) {
return EL_STR("sais");
}
if (slot == 2) {
return EL_STR("sait");
}
if (slot == 3) {
return EL_STR("savons");
}
if (slot == 4) {
return EL_STR("savez");
}
return EL_STR("savent");
}
return EL_STR("");
return 0;
}
el_val_t fr_regular_present(el_val_t stem, el_val_t vgroup, el_val_t slot) {
if (str_eq(vgroup, EL_STR("er"))) {
if (slot == 0) {
return el_str_concat(stem, EL_STR("e"));
}
if (slot == 1) {
return el_str_concat(stem, EL_STR("es"));
}
if (slot == 2) {
return el_str_concat(stem, EL_STR("e"));
}
if (slot == 3) {
return el_str_concat(stem, EL_STR("ons"));
}
if (slot == 4) {
return el_str_concat(stem, EL_STR("ez"));
}
return el_str_concat(stem, EL_STR("ent"));
}
if (str_eq(vgroup, EL_STR("ir"))) {
if (slot == 0) {
return el_str_concat(stem, EL_STR("is"));
}
if (slot == 1) {
return el_str_concat(stem, EL_STR("is"));
}
if (slot == 2) {
return el_str_concat(stem, EL_STR("it"));
}
if (slot == 3) {
return el_str_concat(stem, EL_STR("issons"));
}
if (slot == 4) {
return el_str_concat(stem, EL_STR("issez"));
}
return el_str_concat(stem, EL_STR("issent"));
}
if (slot == 0) {
return el_str_concat(stem, EL_STR("s"));
}
if (slot == 1) {
return el_str_concat(stem, EL_STR("s"));
}
if (slot == 2) {
return stem;
}
if (slot == 3) {
return el_str_concat(stem, EL_STR("ons"));
}
if (slot == 4) {
return el_str_concat(stem, EL_STR("ez"));
}
return el_str_concat(stem, EL_STR("ent"));
return 0;
}
el_val_t fr_future_stem(el_val_t base, el_val_t vgroup) {
if (str_eq(vgroup, EL_STR("re"))) {
return fr_str_drop_last(base, 1);
}
return base;
return 0;
}
el_val_t fr_regular_future(el_val_t fstem, el_val_t slot) {
if (slot == 0) {
return el_str_concat(fstem, EL_STR("ai"));
}
if (slot == 1) {
return el_str_concat(fstem, EL_STR("as"));
}
if (slot == 2) {
return el_str_concat(fstem, EL_STR("a"));
}
if (slot == 3) {
return el_str_concat(fstem, EL_STR("ons"));
}
if (slot == 4) {
return el_str_concat(fstem, EL_STR("ez"));
}
return el_str_concat(fstem, EL_STR("ont"));
return 0;
}
el_val_t fr_irregular_future_stem(el_val_t verb) {
if (str_eq(verb, EL_STR("\xc3\xaatre"))) {
return EL_STR("ser");
}
if (str_eq(verb, EL_STR("avoir"))) {
return EL_STR("aur");
}
if (str_eq(verb, EL_STR("aller"))) {
return EL_STR("ir");
}
if (str_eq(verb, EL_STR("faire"))) {
return EL_STR("fer");
}
if (str_eq(verb, EL_STR("pouvoir"))) {
return EL_STR("pourr");
}
if (str_eq(verb, EL_STR("vouloir"))) {
return EL_STR("voudr");
}
if (str_eq(verb, EL_STR("venir"))) {
return EL_STR("viendr");
}
if (str_eq(verb, EL_STR("voir"))) {
return EL_STR("verr");
}
if (str_eq(verb, EL_STR("savoir"))) {
return EL_STR("saur");
}
return EL_STR("");
return 0;
}
el_val_t fr_imperfect_stem(el_val_t base, el_val_t vgroup) {
if (str_eq(base, EL_STR("\xc3\xaatre"))) {
return EL_STR("\xc3\xa9t");
}
return fr_stem(base);
return 0;
}
el_val_t fr_regular_imperfect(el_val_t istem, el_val_t slot) {
if (slot == 0) {
return el_str_concat(istem, EL_STR("ais"));
}
if (slot == 1) {
return el_str_concat(istem, EL_STR("ais"));
}
if (slot == 2) {
return el_str_concat(istem, EL_STR("ait"));
}
if (slot == 3) {
return el_str_concat(istem, EL_STR("ions"));
}
if (slot == 4) {
return el_str_concat(istem, EL_STR("iez"));
}
return el_str_concat(istem, EL_STR("aient"));
return 0;
}
el_val_t fr_uses_etre(el_val_t verb) {
if (str_eq(verb, EL_STR("aller"))) {
return 1;
}
if (str_eq(verb, EL_STR("venir"))) {
return 1;
}
if (str_eq(verb, EL_STR("partir"))) {
return 1;
}
if (str_eq(verb, EL_STR("arriver"))) {
return 1;
}
if (str_eq(verb, EL_STR("entrer"))) {
return 1;
}
if (str_eq(verb, EL_STR("sortir"))) {
return 1;
}
if (str_eq(verb, EL_STR("na\xc3\xaetre"))) {
return 1;
}
if (str_eq(verb, EL_STR("mourir"))) {
return 1;
}
if (str_eq(verb, EL_STR("rester"))) {
return 1;
}
if (str_eq(verb, EL_STR("tomber"))) {
return 1;
}
if (str_eq(verb, EL_STR("monter"))) {
return 1;
}
if (str_eq(verb, EL_STR("descendre"))) {
return 1;
}
if (str_eq(verb, EL_STR("rentrer"))) {
return 1;
}
if (str_eq(verb, EL_STR("retourner"))) {
return 1;
}
if (str_eq(verb, EL_STR("passer"))) {
return 1;
}
return 0;
return 0;
}
el_val_t fr_past_participle(el_val_t verb) {
if (str_eq(verb, EL_STR("\xc3\xaatre"))) {
return EL_STR("\xc3\xa9t\xc3\xa9");
}
if (str_eq(verb, EL_STR("avoir"))) {
return EL_STR("eu");
}
if (str_eq(verb, EL_STR("aller"))) {
return EL_STR("all\xc3\xa9");
}
if (str_eq(verb, EL_STR("faire"))) {
return EL_STR("fait");
}
if (str_eq(verb, EL_STR("pouvoir"))) {
return EL_STR("pu");
}
if (str_eq(verb, EL_STR("vouloir"))) {
return EL_STR("voulu");
}
if (str_eq(verb, EL_STR("venir"))) {
return EL_STR("venu");
}
if (str_eq(verb, EL_STR("dire"))) {
return EL_STR("dit");
}
if (str_eq(verb, EL_STR("voir"))) {
return EL_STR("vu");
}
if (str_eq(verb, EL_STR("prendre"))) {
return EL_STR("pris");
}
if (str_eq(verb, EL_STR("mettre"))) {
return EL_STR("mis");
}
if (str_eq(verb, EL_STR("savoir"))) {
return EL_STR("su");
}
if (str_eq(verb, EL_STR("na\xc3\xaetre"))) {
return EL_STR("n\xc3\xa9");
}
if (str_eq(verb, EL_STR("mourir"))) {
return EL_STR("mort");
}
el_val_t vgroup = fr_verb_group(verb);
if (str_eq(vgroup, EL_STR("er"))) {
return el_str_concat(fr_str_drop_last(verb, 2), EL_STR("\xc3\xa9"));
}
if (str_eq(vgroup, EL_STR("ir"))) {
return el_str_concat(fr_str_drop_last(verb, 2), EL_STR("i"));
}
return el_str_concat(fr_str_drop_last(verb, 2), EL_STR("u"));
return 0;
}
el_val_t fr_avoir_present(el_val_t slot) {
if (slot == 0) {
return EL_STR("ai");
}
if (slot == 1) {
return EL_STR("as");
}
if (slot == 2) {
return EL_STR("a");
}
if (slot == 3) {
return EL_STR("avons");
}
if (slot == 4) {
return EL_STR("avez");
}
return EL_STR("ont");
return 0;
}
el_val_t fr_etre_present(el_val_t slot) {
if (slot == 0) {
return EL_STR("suis");
}
if (slot == 1) {
return EL_STR("es");
}
if (slot == 2) {
return EL_STR("est");
}
if (slot == 3) {
return EL_STR("sommes");
}
if (slot == 4) {
return EL_STR("\xc3\xaates");
}
return EL_STR("sont");
return 0;
}
el_val_t fr_conjugate(el_val_t verb, el_val_t tense, el_val_t person, el_val_t number) {
el_val_t slot = fr_slot(person, number);
if (str_eq(tense, EL_STR("present"))) {
el_val_t irreg = fr_irregular_present(verb, person, number);
if (!str_eq(irreg, EL_STR(""))) {
return irreg;
}
el_val_t vgroup = fr_verb_group(verb);
el_val_t stem = fr_stem(verb);
return fr_regular_present(stem, vgroup, slot);
}
if (str_eq(tense, EL_STR("future"))) {
el_val_t irreg_stem = fr_irregular_future_stem(verb);
if (!str_eq(irreg_stem, EL_STR(""))) {
return fr_regular_future(irreg_stem, slot);
}
el_val_t vgroup = fr_verb_group(verb);
el_val_t fstem = fr_future_stem(verb, vgroup);
return fr_regular_future(fstem, slot);
}
if (str_eq(tense, EL_STR("imperfect"))) {
el_val_t vgroup = fr_verb_group(verb);
el_val_t istem = fr_imperfect_stem(verb, vgroup);
return fr_regular_imperfect(istem, slot);
}
if (str_eq(tense, EL_STR("past"))) {
el_val_t pp = fr_past_participle(verb);
if (fr_uses_etre(verb)) {
el_val_t aux = fr_etre_present(slot);
return el_str_concat(el_str_concat(aux, EL_STR(" ")), pp);
}
el_val_t aux = fr_avoir_present(slot);
return el_str_concat(el_str_concat(aux, EL_STR(" ")), pp);
}
return verb;
return 0;
}
el_val_t fr_gender(el_val_t noun) {
if (fr_str_ends(noun, EL_STR("tion"))) {
return EL_STR("f");
}
if (fr_str_ends(noun, EL_STR("sion"))) {
return EL_STR("f");
}
if (fr_str_ends(noun, EL_STR("xion"))) {
return EL_STR("f");
}
if (fr_str_ends(noun, EL_STR("ure"))) {
return EL_STR("f");
}
if (fr_str_ends(noun, EL_STR("ette"))) {
return EL_STR("f");
}
if (fr_str_ends(noun, EL_STR("ance"))) {
return EL_STR("f");
}
if (fr_str_ends(noun, EL_STR("ence"))) {
return EL_STR("f");
}
if (fr_str_ends(noun, EL_STR("it\xc3\xa9"))) {
return EL_STR("f");
}
if (fr_str_ends(noun, EL_STR("t\xc3\xa9"))) {
return EL_STR("f");
}
if (fr_str_ends(noun, EL_STR("ti\xc3\xa9"))) {
return EL_STR("f");
}
if (fr_str_ends(noun, EL_STR("ude"))) {
return EL_STR("f");
}
if (fr_str_ends(noun, EL_STR("ade"))) {
return EL_STR("f");
}
if (fr_str_ends(noun, EL_STR("\xc3\xa9""e"))) {
return EL_STR("f");
}
if (fr_str_ends(noun, EL_STR("ie"))) {
return EL_STR("f");
}
if (fr_str_ends(noun, EL_STR("ment"))) {
return EL_STR("m");
}
if (fr_str_ends(noun, EL_STR("age"))) {
return EL_STR("m");
}
if (fr_str_ends(noun, EL_STR("isme"))) {
return EL_STR("m");
}
if (fr_str_ends(noun, EL_STR("eau"))) {
return EL_STR("m");
}
if (fr_str_ends(noun, EL_STR("eur"))) {
return EL_STR("m");
}
if (fr_str_ends(noun, EL_STR("er"))) {
return EL_STR("m");
}
if (fr_str_ends(noun, EL_STR("\xc3\xa9"))) {
return EL_STR("m");
}
return EL_STR("unknown");
return 0;
}
el_val_t fr_invariant_plural(el_val_t noun) {
el_val_t last = fr_str_last_char(noun);
if (str_eq(last, EL_STR("s"))) {
return noun;
}
if (str_eq(last, EL_STR("x"))) {
return noun;
}
if (str_eq(last, EL_STR("z"))) {
return noun;
}
return EL_STR("");
return 0;
}
el_val_t fr_pluralize(el_val_t noun) {
el_val_t inv = fr_invariant_plural(noun);
if (!str_eq(inv, EL_STR(""))) {
return inv;
}
if (fr_str_ends(noun, EL_STR("eau"))) {
return el_str_concat(noun, EL_STR("x"));
}
if (fr_str_ends(noun, EL_STR("eu"))) {
return el_str_concat(noun, EL_STR("x"));
}
if (fr_str_ends(noun, EL_STR("al"))) {
return el_str_concat(fr_str_drop_last(noun, 2), EL_STR("aux"));
}
if (fr_str_ends(noun, EL_STR("ail"))) {
return el_str_concat(fr_str_drop_last(noun, 3), EL_STR("aux"));
}
return el_str_concat(noun, EL_STR("s"));
return 0;
}
el_val_t fr_agree_article(el_val_t noun, el_val_t definite, el_val_t number) {
el_val_t gender = fr_gender(noun);
el_val_t is_plural = str_eq(number, EL_STR("plural"));
el_val_t is_def = str_eq(definite, EL_STR("true"));
el_val_t vowel_start = fr_is_vowel_start(noun);
if (is_def) {
if (is_plural) {
return EL_STR("les");
}
if (vowel_start) {
return EL_STR("l'");
}
if (str_eq(gender, EL_STR("f"))) {
return EL_STR("la");
}
return EL_STR("le");
}
if (is_plural) {
return EL_STR("des");
}
if (str_eq(gender, EL_STR("f"))) {
return EL_STR("une");
}
return EL_STR("un");
return 0;
}
el_val_t fr_subject_starts_vowel(el_val_t subject) {
if (str_eq(subject, EL_STR("il"))) {
return 1;
}
if (str_eq(subject, EL_STR("elle"))) {
return 1;
}
if (str_eq(subject, EL_STR("ils"))) {
return 1;
}
if (str_eq(subject, EL_STR("elles"))) {
return 1;
}
return 0;
return 0;
}
el_val_t fr_verb_ends_vowel(el_val_t verb_form) {
el_val_t last = fr_str_last_char(verb_form);
if (str_eq(last, EL_STR("a"))) {
return 1;
}
if (str_eq(last, EL_STR("e"))) {
return 1;
}
if (str_eq(last, EL_STR("\xc3\xa9"))) {
return 1;
}
if (str_eq(last, EL_STR("i"))) {
return 1;
}
if (str_eq(last, EL_STR("o"))) {
return 1;
}
if (str_eq(last, EL_STR("u"))) {
return 1;
}
return 0;
return 0;
}
el_val_t fr_question_inversion(el_val_t subject, el_val_t verb_form) {
if (str_eq(subject, EL_STR("je"))) {
return el_str_concat(el_str_concat(EL_STR("est-ce que je "), verb_form), EL_STR(" ?"));
}
el_val_t need_t = 0;
if (fr_verb_ends_vowel(verb_form)) {
if (fr_subject_starts_vowel(subject)) {
need_t = 1;
}
}
if (need_t) {
return el_str_concat(el_str_concat(el_str_concat(verb_form, EL_STR("-t-")), subject), EL_STR(" ?"));
}
return el_str_concat(el_str_concat(el_str_concat(verb_form, EL_STR("-")), subject), EL_STR(" ?"));
return 0;
}