00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #include "ffpriv_general_local_cases.h"
00031 #include "ffpriv_genitive_stem.h"
00032 #include "ffpriv_partitive_stem.h"
00033 #include "ffpriv_essive_stem.h"
00034 #include "ffpriv_plural_stem.h"
00035 #include "ffregex.h"
00036 #include "ffutil.h"
00037
00038 ffint32 ffpriv_partitive_singular(ffword* word)
00039 {
00040 ffint32 err;
00041
00042
00043 if ( (err = ffpriv_partitive_stem(word)) ) {
00044 return err;
00045 }
00046
00047
00048
00049 if ( ffstring_tail_equals_ci(&word->data, 2, "ea") || ffstring_tail_equals_ci(&word->data, 2, "eä")) {
00050 return ffstring_append(&word->data, ffpriv_vowel_harmony(&word->data, "a", "ä"));
00051 }
00052
00053 if ( ffpriv_is_consonant(ffstring_last(&word->data)) || ffregex_match_ci("^.*[aeiouyåäöÅÄÖ][aeiouyåäöÅÄÖ]$", &word->data) ) {
00054 return ffstring_append(&word->data, ffpriv_vowel_harmony(&word->data, "ta", "tä"));
00055 } else {
00056 return ffstring_append(&word->data, ffpriv_vowel_harmony(&word->data, "a", "ä"));
00057 }
00058 }
00059
00060 ffint32 ffpriv_partitive_plural(ffword* word)
00061 {
00062 ffword stem;
00063 ffstring_copy(&word->data,&stem.data);
00064 stem.metadata = word->metadata;
00065 stem.metadata.cg = 1;
00066 ffpriv_plural_stem(&stem);
00067
00068 if (
00069 ffregex_match_ci("^.*[aeiouyåäöÅÄÖ][aeiouyåäöÅÄÖ]$", &stem.data) && (
00070 ffregex_match_ci("^.*[aeiouyåäöÅÄÖ][^aeiouyåäöÅÄÖ]+[aeiouyåäöÅÄÖ][^aeiouyåäöÅÄÖ][aeiouyåäöÅÄÖ]$", &word->data) ||
00071 ffregex_match_ci("^.*[aeiouyåäöÅÄÖ][aeiouyåäöÅÄÖ]$", &word->data) ||
00072 ffpriv_is_consonant(ffstring_last(&word->data))
00073 )
00074 ) {
00075 ffstring_append(&stem.data, ffpriv_vowel_harmony(&stem.data, "ta", "tä"));
00076 ffstring_delete(&word->data);
00077 word->data = stem.data;
00078 return 0;
00079 } else {
00080 if ( ffpriv_is_vowel( stem.data.str[stem.data.len - 2] ) ) {
00081 ffstring_rfe(&stem.data, 1, ffpriv_vowel_harmony(&stem.data, "ja", "jä") );
00082 ffstring_delete(&word->data);
00083 word->data = stem.data;
00084 return 0;
00085
00086 } else {
00087 ffstring_append(&stem.data, ffpriv_vowel_harmony(&stem.data, "a", "ä") );
00088 ffstring_delete(&word->data);
00089 word->data = stem.data;
00090 return 0;
00091
00092 }
00093
00094 }
00095
00096
00097 }
00098
00099 ffint32 ffpriv_essive_singular(ffword* word)
00100 {
00101 ffint32 err;
00102
00103 if ( (err = ffpriv_essive_stem(word)) ) {
00104
00105 return err;
00106 }
00107
00108 return ffstring_append(&word->data, ffpriv_vowel_harmony(&word->data, "na", "nä"));
00109 }
00110
00111 ffint32 ffpriv_essive_plural(ffword* word)
00112 {
00113 word->metadata.cg = 1;
00114 ffpriv_plural_stem(word);
00115 ffstring_append(&word->data, ffpriv_vowel_harmony(&word->data, "na", "nä"));
00116 return 0;
00117 }
00118
00119 ffint32 ffpriv_translative_singular(ffword* word)
00120 {
00121 ffint32 err;
00122
00123 if ( (err = ffpriv_genitive_stem(word)) ) {
00124 return err;
00125 } else {
00126 return ffstring_append(&word->data,"ksi");
00127 }
00128 }
00129
00130 ffint32 ffpriv_translative_plural(ffword* word)
00131 {
00132 ffpriv_plural_stem(word);
00133 ffstring_append(&word->data,"ksi");
00134 return 0;
00135 }