//// /// This file is a file for Sámi, modified from the file // genfisuffix - a Finnish affix table generator for ispell // Copyright (C) 2000 Pauli Virtanen // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // The program's output is also subject to this license, and considered // program source code. // ////////////////////////////////////////////////////////////////////////////// // // Flags used: // U do_verbs_infinitive_stem // V do_verbs_infinitive_stem // // W do_verbs_declination_stem // X do_verbs_declination_stem // // Y do_verbs_consonant_gradated_declination_stem // Z do_verbs_consonant_gradated_declination_stem // // Forms of Finnish verbs are numerous. Luckily most of the forms ispell is // able to produce from three (often different) verb stems: // - infinitive stem // - declination stem // - consonant gradated declination stem (because ispell can't do // consonant gradation) // // All verb forms can be deduced from the infinitive stem, but the relation // between the declination stem and the infinitive stem is sometimes too // complex to resolve by ispell's means. // // Note also that vowel harmony is mostly symmetric: front vowel versions // of rules can be created easily from back vowel versions. // // In verbs there are some exceptions from this symmetricity. // (The exceptions are due to the vowel change in past form.) // (Conditional vowel change is back-front vowel symmetric.) // // STATUS: Produces all verb forms of all verbs, but not the past forms // of all verbs, whose stems end in '-a' or '-�'. // // There are two problems: anta/a verbs sometimes change -ta or -t� // to -s in their past form. I don't know how it can be determined. // // Other problem is the fact, that words, whose declination stem // ends in a single -a, which may change to -o or disappear in two- // syllable words depending on the first vowel of the word. // // I see no way to overcome the latter problem in ispell. // #include #include #include #include #include #include "genfisuffix.hh" #include "sami_data.hh" // Following forms form from infinitive stem: // - 1st and 2nd infinitives (n�hd�, n�hd�/kseni; n�hde/ss�, n�hd/en) // - all passive forms, except for the type_1 or anta/a verbs // - imperative (except the singular 3rd form) (n�h/k��n, n�h/k��) // - potential (n�h/nen, n�h/nee) // - perfect participe (n�h/nyt, n�h/neet) // // 1st infinitive form is used as the base of flags herein. // It is also the passive present negative form. // void do_verbs_infinitive_stem() { vector infinitive_1st_suffixes = new_list( // 1st infinitive translative "kseni", "ksesi", "ksensa", "kseni", "ksemme", "ksenne", "kseen", NULL); vector infinitive_2nd_suffixes = new_list( // 2st infinitive inessive "essa", // 2st infinitive instructive "en", NULL); vector infinitive_2nd_possessivable_suffixes; // Note the omitted leading 'n' of these suffixes vector participe_and_potential_suffixes = new_list( "ut", "eet", "et", "ee", // "en", This is alike 2st infinitive instructive in // type5 verbs, so I specify this separately to avoid // duplicate rules. "emme", "ette", "evat", NULL); vector potential_singular_1st_suffix = new_list( "en", NULL); vector potential_no_suffix_particles_suffixes = new_list( "e", NULL); vector imperative_suffixes = new_list( "kaa", NULL); vector imperative_no_suffix_particles_suffixes = new_list( "koon", "koot", "kaamme", "ko", NULL); // Generate possessive forms of infinitive_2nd_suffixes infinitive_2nd_possessivable_suffixes = combine( suffix_strings(new_list("essa", NULL), possessive_suffixes), generate_n_possessive_suffix(new_list("essa", NULL))); // Suffix particles // Infinitives add_to_vector(infinitive_1st_suffixes, suffix_strings(infinitive_1st_suffixes, suffix_particles)); add_to_vector(infinitive_2nd_suffixes, suffix_strings(infinitive_2nd_suffixes, suffix_particles)); // Potential and participes add_to_vector(participe_and_potential_suffixes, suffix_strings(participe_and_potential_suffixes, suffix_particles_verbs)); add_to_vector(potential_singular_1st_suffix, suffix_strings(potential_singular_1st_suffix, suffix_particles_verbs)); add_to_vector(participe_and_potential_suffixes, potential_no_suffix_particles_suffixes); // Add other suffix particles if (options.use_all_suffix_particles) { add_to_vector(infinitive_2nd_suffixes, suffix_strings( infinitive_2nd_possessivable_suffixes, suffix_particles)); } // Imperative add_to_vector( imperative_suffixes, suffix_strings(imperative_suffixes, imperative_suffix_particles)); add_to_vector(imperative_suffixes, imperative_no_suffix_particles_suffixes); // Add possessive forms add_to_vector(infinitive_2nd_suffixes, infinitive_2nd_possessivable_suffixes); // flag *U, flag *V: Suffix suffixes[] = { // All verbs: Suffix("a", "", infinitive_1st_suffixes), Suffix("ea", "ea", prefix_strings(infinitive_2nd_suffixes, "i")), Suffix("[^e]a", "a", infinitive_2nd_suffixes), // anta/a (type1) verbs (whose passive doesn't form // from this stem) Suffix("[aeiou]a", "a", prefix_strings(combine(participe_and_potential_suffixes, potential_singular_1st_suffix), "n")), Suffix("[aeiou]a", "a", imperative_suffixes), // huomat/a (type2) verbs Suffix("[^s]ta", "ta", combine(add_and_suffix(new_list("taan", NULL), suffix_particles_verbs), prefix_strings(passive_suffixes, "t"))), Suffix("[^s]ta", "ta", prefix_strings(combine(participe_and_potential_suffixes, potential_singular_1st_suffix), "nn")), Suffix("[^s]ta", "a", imperative_suffixes), // saa/da (type3) verbs Suffix("da", "da", combine(add_and_suffix(new_list("daan", NULL), suffix_particles_verbs), passive_suffixes)), Suffix("da", "da", prefix_strings(combine(participe_and_potential_suffixes, potential_singular_1st_suffix), "n")), Suffix("da", "da", imperative_suffixes), // nous/ta (type4) verbs Suffix("sta", "ta", combine(add_and_suffix(new_list("taan", NULL), suffix_particles_verbs), passive_suffixes)), Suffix("sta", "ta", prefix_strings(combine(participe_and_potential_suffixes, potential_singular_1st_suffix), "s")), Suffix("sta", "ta", imperative_suffixes), // tul/la (type5) verbs Suffix("la", "la", combine(add_and_suffix(new_list("laan", NULL), suffix_particles_verbs), passive_suffixes)), Suffix("la", "a", participe_and_potential_suffixes), Suffix("la", "la", imperative_suffixes), // men/n� (type5) verbs Suffix("na", "na", combine(add_and_suffix(new_list("naan", NULL), suffix_particles_verbs), passive_suffixes)), Suffix("na", "a", participe_and_potential_suffixes), Suffix("na", "na", imperative_suffixes), // pur/ra (type5) verbs Suffix("ra", "ra", combine(add_and_suffix(new_list("raan", NULL), suffix_particles_verbs), passive_suffixes)), Suffix("ra", "a", participe_and_potential_suffixes), Suffix("ra", "ra", imperative_suffixes) }; int suffixes_n = sizeof(suffixes) / sizeof(Suffix); // flag *U, flag *V: // output_flag('U'); output_suffix_list(suffixes, suffixes_n, 'U'); // output_flag('V'); output_suffix_list_to_front(suffixes, suffixes_n, 'V'); } // Following forms form from pure declination stem: // - active present participe // - 3rd infinitive } NOTE: These are very alike! // - agent participe } // - 4th infinitive // - active conditional (all forms) // - active present singular and plural 3rd forms. // - active past singular and plural 3rd forms. // (FIXME or NOTE: ispell can't do vowel changing fully: when // declinating verbs, whose declination stem ends '-a', the syllable // count of words _must_ be known. Also exceptions arise in these // verbs) // // Active present participe base form (-va) is used as the base, // as it attaches directly to the unmodified declination stem. // void do_verbs_declination_stem() { vector verb_case_suffixes = combine(case_suffixes, new_list("na", NULL)); vector verb_case_possessivable_suffixes = combine(case_possessivable_suffixes, new_list("na", NULL)); // This holds forms of 3rd infinitive and active present participe // They replace the -va suffix. vector basic_suffixes; // This is just for temporary use: it will be merged to basic_suffixes vector basic_possessivable_suffixes; // Conditional vector conditional_suffixes = new_list("isin", "isit", "isi", "isimme", "isitte", "isivat", NULL); // These are meant to be prefixed by some string. This vector // contains also an empty item. (As you can see.) // These are used to provide suffix particles easily to some verb // forms (namely the 3rd present and past forms) vector prefixable_suffixes = combine(new_list("", NULL), suffix_particles_verbs); // Add active present participe form declinations to basic_suffixes and // basic_possessivable_suffixes // Add both singular and plural (noun like) case declinations add_to_vector(basic_suffixes, prefix_strings(verb_case_suffixes, "va")); add_to_vector(basic_suffixes, prefix_strings(verb_case_suffixes, "vi")); // Add plural and singular partitive, illative and plural genitive // (but not the basic -va form, as it is used as the base) add_to_vector(basic_suffixes, new_list("vaa", "vaan", "vat", "via", "vien", "viin", NULL)); // Then add possessivable forms of the above add_to_vector(basic_possessivable_suffixes, prefix_strings(verb_case_possessivable_suffixes, "va")); add_to_vector(basic_possessivable_suffixes, prefix_strings(verb_case_possessivable_suffixes, "vi")); // This time add also base form, as it will be suffixed with // possessive suffixes. Add also comitative. add_to_vector(basic_possessivable_suffixes, new_list("va", "vaa", "via", "vie", "vii", "vine", NULL)); // Add 3rd infinitive, AND forms of agent participe. // Practically forms the 3rd infinitive are a subset of agent participe's // forms. So adding only forms of agent participe is enough. // Add both plural and singular add_to_vector(basic_suffixes, prefix_strings(verb_case_suffixes,"ma")); add_to_vector(basic_suffixes, prefix_strings(verb_case_suffixes,"mi")); // Add plural and singular basic form, partitive, illative, // plural genitive and singular abessive add_to_vector(basic_suffixes, new_list("ma", "maa", "maan", "mat", "mia", "mien", "miin", "matta", NULL)); add_to_vector(basic_possessivable_suffixes, prefix_strings(verb_case_possessivable_suffixes, "ma")); add_to_vector(basic_possessivable_suffixes, prefix_strings(verb_case_possessivable_suffixes, "mi")); add_to_vector(basic_possessivable_suffixes, new_list("ma", "maa", "mia", "mie", "mii", NULL)); // Generate possessive forms // (i.e. merge basic_possessivable_suffixes to basic_suffixes, whilst // suffixing the former with possessive suffixes.) basic_possessivable_suffixes = combine( suffix_strings(basic_possessivable_suffixes, possessive_suffixes), generate_n_possessive_suffix( basic_possessivable_suffixes)); // Add proper suffix particled forms of conditional suffixes to // vector conditional_suffixes add_to_vector(conditional_suffixes, suffix_strings(conditional_suffixes, suffix_particles_verbs)); // Add suffix particles to basic_suffixes add_to_vector(basic_suffixes, suffix_strings(basic_suffixes, suffix_particles)); if (options.use_all_suffix_particles) { add_to_vector(basic_suffixes, suffix_strings(basic_possessivable_suffixes, suffix_particles)); } // Add the possessive suffixed forms add_to_vector(basic_suffixes, basic_possessivable_suffixes); // Add the 4th infinitive. Note that this is very much alike to the -minen // "verb to noun" derivation suffix. These don't get suffix particles // (being added after their adding), because these forms are rather rare. add_to_vector(basic_suffixes, new_list("minen", "mista", NULL)); // flag *W, flag *X Suffix suffixes[] = { /// First the active agent participe and 1st participe forms Suffix("va", "va", basic_suffixes), // palava -> palavassa /// Then form the present active singular 3rd form. // Words which haven't got dipthong or double vowel before // -va get their vowel doubled Suffix("[^a]ava", "va", // jakava -> jakaa prefix_strings(prefixable_suffixes, "a")), Suffix("[^ei]eva", "va", // hakeva -> hakee prefix_strings(prefixable_suffixes, "e")), Suffix("[^aeiou]iva", "va", // raapiva -> raapii prefix_strings(prefixable_suffixes, "i")), Suffix("[^ou]ova", "va", // halkova -> halkoo prefix_strings(prefixable_suffixes, "o")), Suffix("[^aeiou]uva", "va", // sortuva -> sortuu prefix_strings(prefixable_suffixes, "u")), // Other words just drop their -va suffix Suffix("aava", "va", // saava -> saa prefixable_suffixes), Suffix("[ei]eva", "va", // ? -> ? prefixable_suffixes), Suffix("[aeiou]iva", "va", // ? -> ? prefixable_suffixes), Suffix("[ou]ova", "va", // juova -> juo prefixable_suffixes), Suffix("[aeiou]uva", "va", // ? -> ? prefixable_suffixes), /// Then the present active plural 3rd form Suffix("va", "", // lukeva -> lukevat prefix_strings(prefixable_suffixes, "t")), /// Past active singular 3rd form // Triggers the vowel change, which is not back-front vowel // symmetric on declination stems ending in '-a' or '-�'. // There is also other trickery about in these forms. // Note, that I haven't included here those vowel change // rules, which lead to forms not appearing in verbs. // Same applies to the conditional forms. Suffix("[^ei]eva", "eva", // lukeva -> luki prefix_strings(prefixable_suffixes, "i")), Suffix("iva", "va", // juhliva -> juhli prefix_strings(prefixable_suffixes, "")), Suffix("[^ou]ova", "va", // uskova -> uskoi prefix_strings(prefixable_suffixes, "i")), Suffix("uova", "uova", // juova -> joi prefix_strings(prefixable_suffixes, "oi")), Suffix("[^u]uva", "va", // sattuva -> sattui prefix_strings(prefixable_suffixes, "i")), // NOTE, FIXME: saada doesn't declinate this way! // Thus this extremely ugly hack. Suffix("[ABCDEFGHIJKLMNOPQRSTUVWXYZ���] [^AEIOU] [AEIOU] A V A", "AVA", prefix_strings(prefixable_suffixes, "SI")), Suffix("[ABCDEFGHIJKLMNOPQRSTUVWXYZ���] [^AEIOU] [AEIOU] A V A", "AVA", prefix_strings(prefixable_suffixes, "SIVAT")), // Past active plural 3rd form Suffix("[^ei]eva", "eava", // lukeva -> lukivat prefix_strings(prefixable_suffixes, "ivat")), Suffix("iva", "va", // juhliva -> juhlivat prefix_strings(prefixable_suffixes, "vat")), Suffix("[^ou]ova", "va", // uskova -> uskoivat prefix_strings(prefixable_suffixes, "ivat")), Suffix("uova", "uova", // juova -> joivat prefix_strings(prefixable_suffixes, "oivat")), Suffix("[^u]uva", "va", // sattuva -> sattuivat prefix_strings(prefixable_suffixes, "ivat")), /// Conditional // Conditional triggers vowel change, but without ambiguities. // It is also fully back-front vowel symmetric. // singular active 3rd conditional Suffix("AAVA", "AVA", conditional_suffixes), Suffix("[^A]AVA", "VA", conditional_suffixes), Suffix("[^EI]EVA", "EVA", conditional_suffixes), Suffix("IVA", "IVA", conditional_suffixes), Suffix("UOVA", "UOVA", prefix_strings(conditional_suffixes, "o")), Suffix("[^OU]OVA", "VA", conditional_suffixes), Suffix("[^U]UVA", "VA", conditional_suffixes) }; int suffixes_n = sizeof(suffixes) / sizeof(Suffix); // flag *W: // output_flag('W'); output_suffix_list(suffixes, suffixes_n, 'W'); /// Past active singular 3rd form cannot be formed /// from -a ending verbs because of ambiguity, which /// ispell has no means of resolving. (Syllables should be counted, /// and the first vowel of the word checked). For example: // A V A > -AVA,OI # palava -> paloi, two-syllable // A V A > -AVA,I # saava -> sai, two-syllable // A V A > -AVA,I # valmistava -> valmisti, non-two-syll. // flag *X: // output_flag('X'); output_suffix_list_to_front(suffixes, suffixes_n, 'X'); // In anta/a (type1) verbs if stem ends in -ta or -t�, the -ta or -t� // changes in imperfect to -s. This doesn't happen always, and is // thus considered ambiguous, and not implemented here. // Other anta/a verbs output_suffix_group((char) NULL, "[^�EI�YT]�V�", "�V�", // el�v� -> eli to_front_vowel(prefix_strings(prefixable_suffixes, "I"))); output_suffix_group((char) NULL, "[^�EI�YT]�V�", "�V�", // el�v� -> eliv�t to_front_vowel(prefix_strings(prefixable_suffixes, "IV�T"))); } // Following forms form from consonant gradated declination stem: // - active present singular and plural, except the 3rd forms // - active imperative singular 3rd form // - active past singular and plural, except the 3rd forms // - some verbs form passive from this stem // // Active present singular 1st form (-n) is used as the base. // void do_verbs_consonant_gradated_declination_stem() { vector person_endings = // -n is used as base new_list("t", "mme", "tte", NULL); // Note the empty item of this list. vector imperative_and_negative_suffix_particles = combine(new_list("", NULL), negative_suffix_particles, imperative_suffix_particles); vector past_person_endings = // -n is used as base new_list("n", "t", "mme", "tte", NULL); // Suffix particles add_to_vector(person_endings, suffix_strings(person_endings, suffix_particles_verbs)); add_to_vector(past_person_endings, suffix_strings(past_person_endings, suffix_particles_verbs)); // flag *Y, flag *Z Suffix suffixes[] = { /// Active present 1st form Suffix("N", "", suffix_particles_verbs), // Active present other forms (except negative) Suffix("N", "N", person_endings), // Active present negative form, which is also the active // imperative singular 3rd form. Suffix("[^I]N", "N", imperative_and_negative_suffix_particles), /// Active past forms, except the 3rd forms // Triggers the vowel change, which is not back-front vowel // symmetric on declination stems ending in '-a' or '-�'. // There is also other trickery about in these forms. // Note, that I haven't included here those vowel change // rules, which lead to forms not appearing in verbs. // Verbs, whose this stem ends in -i don't have past forms Suffix("[^EI]EN", "EN", // n�en -> n�in prefix_strings(past_person_endings, "I")), Suffix("[^OU]ON", "N", // uskon -> uskoin prefix_strings(past_person_endings, "I")), Suffix("UON", "UON", // juon -> join prefix_strings(past_person_endings, "OI")), Suffix("[^U]UN", "N", // satun -> satuin prefix_strings(past_person_endings, "I")), /// huomat/a verbs // NOTE, FIXME: saada doesn't declinate this way! // Thus this extremely ugly hack. Suffix("[ABCDEFGHIJKLMNOPQRSTUVWXZ�] [^AEIOU] [AEIOU] A N", "AN", prefix_strings(past_person_endings, "SI")), /// Passive forms of anta/a (type1) verbs Suffix("[^AEIOU][OU]N", "N", combine(suffix_strings(new_list("taan", NULL), suffix_particles_verbs), prefix_strings(passive_suffixes, "t"))), Suffix("[^AEIOU]AN", "AN", prefix_strings( combine(suffix_strings(new_list("taan", NULL), suffix_particles_verbs), prefix_strings(passive_suffixes, "t")), "e")) }; int suffixes_n = sizeof(suffixes) / sizeof(Suffix); // flag *Y: // output_flag('Y'); output_suffix_list(suffixes, suffixes_n, 'Y'); // For comments see flag *W // flag *Z: // output_flag('Z'); output_suffix_list_to_front(suffixes, suffixes_n, 'Z'); // For comment see flag *X. // Also note that the alka/a verbs have here gone through consonant // gradation, so I don't know how could I distinguish the thing spoken // in flag *X. (Excluding T won't help now, as it may be changed) }