42 if ( isset( $wgGrammarForms[
'tyv'][$case][$word] ) ) {
43 return $wgGrammarForms[
'tyv'][$case][$word];
47 $allVowels =
array(
"е",
"и",
"э",
"ө",
"ү",
"а",
"ё",
"о",
"у",
"ы",
"ю",
"я",
"a",
"e",
"i",
"o",
"ö",
"u",
"ü",
"y" );
48 $frontVowels =
array(
"е",
"и",
"э",
"ө",
"ү",
"e",
"i",
"ö",
"ü" );
49 $backVowels =
array(
"а",
"ё",
"о",
"у",
"ы",
"ю",
"я",
"a",
"o",
"u",
"y" );
50 $unroundFrontVowels =
array(
"е",
"и",
"э",
"e",
"i" );
51 $roundFrontVowels =
array(
"ө",
"ү",
"ö",
"ü" );
52 $unroundBackVowels =
array(
"а",
"ы",
"я",
"a",
"y" );
53 $roundBackVowels =
array(
"ё",
"о",
"у",
"ю",
"o",
"u" );
55 $unvoicedPhonemes =
array(
"т",
"п",
"с",
"ш",
"к",
"ч",
"х",
"t",
"p",
"s",
"k",
"x" );
56 $directiveUnvoicedStems =
array(
"т",
"п",
"с",
"ш",
"к",
"ч",
"х",
"л",
"м",
"н",
"ң",
"t",
"p",
"s",
"k",
"x",
"l",
"m",
"n",
"ŋ" );
57 $directiveVoicedStems =
array(
"д",
"б",
"з",
"ж",
"г",
"р",
"й",
"d",
"b",
"z",
"g",
"r",
"j" );
63 preg_match_all(
'/./us', $word, $ar );
65 $wordEnding = $ar[0][count( $ar[0] ) - 1];
66 $wordReversed = array_reverse( $ar[0] );
69 $wordLastVowel =
null;
70 foreach ( $wordReversed
as $xvalue ) {
71 foreach ( $allVowels
as $yvalue ) {
72 if ( strcmp( $xvalue, $yvalue ) == 0 ) {
73 $wordLastVowel = $xvalue;
79 if ( $wordLastVowel !==
null ) {
89 if ( in_array( $wordEnding, $unvoicedPhonemes ) ) {
90 if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
91 $word = implode(
"", $ar[0] ) .
"түң";
92 } elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
93 $word = implode(
"", $ar[0] ) .
"тиң";
94 } elseif ( in_array( $wordLastVowel, $roundBackVowels ) ) {
95 $word = implode(
"", $ar[0] ) .
"туң";
96 } elseif ( in_array( $wordLastVowel, $unroundBackVowels ) ) {
97 $word = implode(
"", $ar[0] ) .
"тың";
100 } elseif ( $wordEnding ===
"л" || $wordEnding ===
"l" ) {
101 if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
102 $word = implode(
"", $ar[0] ) .
"дүң";
103 } elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
104 $word = implode(
"", $ar[0] ) .
"диң";
105 } elseif ( in_array( $wordLastVowel, $roundBackVowels ) ) {
106 $word = implode(
"", $ar[0] ) .
"дуң";
107 } elseif ( in_array( $wordLastVowel, $unroundBackVowels ) ) {
108 $word = implode(
"", $ar[0] ) .
"дың";
112 if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
113 $word = implode(
"", $ar[0] ) .
"нүң";
114 } elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
115 $word = implode(
"", $ar[0] ) .
"ниң";
116 } elseif ( in_array( $wordLastVowel, $roundBackVowels ) ) {
117 $word = implode(
"", $ar[0] ) .
"нуң";
118 } elseif ( in_array( $wordLastVowel, $unroundBackVowels ) ) {
119 $word = implode(
"", $ar[0] ) .
"ның";
125 if ( in_array( $wordEnding, $unvoicedPhonemes ) ) {
126 if ( in_array( $wordLastVowel, $frontVowels ) ) {
127 $word = implode(
"", $ar[0] ) .
"ке";
128 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
129 $word = implode(
"", $ar[0] ) .
"ка";
133 if ( in_array( $wordLastVowel, $frontVowels ) ) {
134 $word = implode(
"", $ar[0] ) .
"ге";
135 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
136 $word = implode(
"", $ar[0] ) .
"га";
142 if ( in_array( $wordEnding, $unvoicedPhonemes ) ) {
143 if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
144 $word = implode(
"", $ar[0] ) .
"тү";
145 } elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
146 $word = implode(
"", $ar[0] ) .
"ти";
147 } elseif ( in_array( $wordLastVowel, $roundBackVowels ) ) {
148 $word = implode(
"", $ar[0] ) .
"ту";
149 } elseif ( in_array( $wordLastVowel, $unroundBackVowels ) ) {
150 $word = implode(
"", $ar[0] ) .
"ты";
153 } elseif ( $wordEnding ===
"л" || $wordEnding ===
"l" ) {
154 if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
155 $word = implode(
"", $ar[0] ) .
"дү";
156 } elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
157 $word = implode(
"", $ar[0] ) .
"ди";
158 } elseif ( in_array( $wordLastVowel, $roundBackVowels ) ) {
159 $word = implode(
"", $ar[0] ) .
"ду";
160 } elseif ( in_array( $wordLastVowel, $unroundBackVowels ) ) {
161 $word = implode(
"", $ar[0] ) .
"ды";
165 if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
166 $word = implode(
"", $ar[0] ) .
"нү";
167 } elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
168 $word = implode(
"", $ar[0] ) .
"ни";
169 } elseif ( in_array( $wordLastVowel, $roundBackVowels ) ) {
170 $word = implode(
"", $ar[0] ) .
"ну";
171 } elseif ( in_array( $wordLastVowel, $unroundBackVowels ) ) {
172 $word = implode(
"", $ar[0] ) .
"ны";
178 if ( in_array( $wordEnding, $unvoicedPhonemes ) ) {
179 if ( in_array( $wordLastVowel, $frontVowels ) ) {
180 $word = implode(
"", $ar[0] ) .
"те";
181 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
182 $word = implode(
"", $ar[0] ) .
"та";
186 if ( in_array( $wordLastVowel, $frontVowels ) ) {
187 $word = implode(
"", $ar[0] ) .
"де";
188 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
189 $word = implode(
"", $ar[0] ) .
"да";
195 if ( in_array( $wordEnding, $unvoicedPhonemes ) ) {
196 if ( in_array( $wordLastVowel, $frontVowels ) ) {
197 $word = implode(
"", $ar[0] ) .
"тен";
198 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
199 $word = implode(
"", $ar[0] ) .
"тан";
203 if ( in_array( $wordLastVowel, $frontVowels ) ) {
204 $word = implode(
"", $ar[0] ) .
"ден";
205 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
206 $word = implode(
"", $ar[0] ) .
"дан";
212 if ( in_array( $wordEnding, $directiveVoicedStems ) ) {
213 $word = implode(
"", $ar[0] ) .
"же";
214 } elseif ( in_array( $wordEnding, $directiveUnvoicedStems ) ) {
215 $word = implode(
"", $ar[0] ) .
"че";
220 if ( in_array( $wordEnding, $unvoicedPhonemes ) ) {
221 if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
222 $word = implode(
"", $ar[0] ) .
"түве";
223 } elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
224 $word = implode(
"", $ar[0] ) .
"тиве";
225 } elseif ( in_array( $wordLastVowel, $roundBackVowels ) ) {
226 $word = implode(
"", $ar[0] ) .
"туве";
227 } elseif ( in_array( $wordLastVowel, $unroundBackVowels ) ) {
228 $word = implode(
"", $ar[0] ) .
"тыве";
232 if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
233 $word = implode(
"", $ar[0] ) .
"дүве";
234 } elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
235 $word = implode(
"", $ar[0] ) .
"диве";
236 } elseif ( in_array( $wordLastVowel, $roundBackVowels ) ) {
237 $word = implode(
"", $ar[0] ) .
"дуве";
238 } elseif ( in_array( $wordLastVowel, $unroundBackVowels ) ) {
239 $word = implode(
"", $ar[0] ) .
"дыве";