42 MediaWikiServices::getInstance()->getMainConfig()->get( MainConfigNames::GrammarForms );
43 if ( isset( $grammarForms[
'tyv'][$case][$word] ) ) {
44 return $grammarForms[
'tyv'][$case][$word];
48 $allVowels = [
"е",
"и",
"э",
"ө",
"ү",
"а",
"ё",
"о",
"у",
"ы",
"ю",
"я" ];
49 $frontVowels = [
"е",
"и",
"э",
"ө",
"ү" ];
50 $backVowels = [
"а",
"ё",
"о",
"у",
"ы",
"ю",
"я" ];
51 $unroundFrontVowels = [
"е",
"и",
"э" ];
52 $roundFrontVowels = [
"ө",
"ү" ];
53 $unroundBackVowels = [
"а",
"ы",
"я" ];
54 $roundBackVowels = [
"ё",
"о",
"у",
"ю" ];
55 $unvoicedPhonemes = [
"т",
"п",
"с",
"ш",
"к",
"ч",
"х" ];
56 $directiveUnvoicedStems = [
"т",
"п",
"с",
"ш",
"к",
"ч",
"х",
"л",
"м",
"н",
"ң" ];
57 $directiveVoicedStems = [
"д",
"б",
"з",
"ж",
"г",
"р",
"й" ];
60 preg_match_all(
'/./us', $word, $ar );
63 $wordEnding = $ar[0][count( $ar[0] ) - 1];
67 $wordReversed = array_reverse( $ar[0] );
70 $wordLastVowel =
null;
71 foreach ( $wordReversed as $xvalue ) {
72 foreach ( $allVowels as $yvalue ) {
73 if ( strcmp( $xvalue, $yvalue ) == 0 ) {
74 $wordLastVowel = $xvalue;
79 if ( $wordLastVowel !==
null ) {
87 if ( in_array( $wordEnding, $unvoicedPhonemes ) ) {
88 if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
89 $word = implode(
"", $ar[0] ) .
"түң";
90 } elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
91 $word = implode(
"", $ar[0] ) .
"тиң";
92 } elseif ( in_array( $wordLastVowel, $roundBackVowels ) ) {
93 $word = implode(
"", $ar[0] ) .
"туң";
94 } elseif ( in_array( $wordLastVowel, $unroundBackVowels ) ) {
95 $word = implode(
"", $ar[0] ) .
"тың";
98 } elseif ( $wordEnding ===
"л" ) {
99 if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
100 $word = implode(
"", $ar[0] ) .
"дүң";
101 } elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
102 $word = implode(
"", $ar[0] ) .
"диң";
103 } elseif ( in_array( $wordLastVowel, $roundBackVowels ) ) {
104 $word = implode(
"", $ar[0] ) .
"дуң";
105 } elseif ( in_array( $wordLastVowel, $unroundBackVowels ) ) {
106 $word = implode(
"", $ar[0] ) .
"дың";
110 if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
111 $word = implode(
"", $ar[0] ) .
"нүң";
112 } elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
113 $word = implode(
"", $ar[0] ) .
"ниң";
114 } elseif ( in_array( $wordLastVowel, $roundBackVowels ) ) {
115 $word = implode(
"", $ar[0] ) .
"нуң";
116 } elseif ( in_array( $wordLastVowel, $unroundBackVowels ) ) {
117 $word = implode(
"", $ar[0] ) .
"ның";
123 if ( in_array( $wordEnding, $unvoicedPhonemes ) ) {
124 if ( in_array( $wordLastVowel, $frontVowels ) ) {
125 $word = implode(
"", $ar[0] ) .
"ке";
126 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
127 $word = implode(
"", $ar[0] ) .
"ка";
131 if ( in_array( $wordLastVowel, $frontVowels ) ) {
132 $word = implode(
"", $ar[0] ) .
"ге";
133 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
134 $word = implode(
"", $ar[0] ) .
"га";
140 if ( in_array( $wordEnding, $unvoicedPhonemes ) ) {
141 if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
142 $word = implode(
"", $ar[0] ) .
"тү";
143 } elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
144 $word = implode(
"", $ar[0] ) .
"ти";
145 } elseif ( in_array( $wordLastVowel, $roundBackVowels ) ) {
146 $word = implode(
"", $ar[0] ) .
"ту";
147 } elseif ( in_array( $wordLastVowel, $unroundBackVowels ) ) {
148 $word = implode(
"", $ar[0] ) .
"ты";
151 } elseif ( $wordEnding ===
"л" ) {
152 if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
153 $word = implode(
"", $ar[0] ) .
"дү";
154 } elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
155 $word = implode(
"", $ar[0] ) .
"ди";
156 } elseif ( in_array( $wordLastVowel, $roundBackVowels ) ) {
157 $word = implode(
"", $ar[0] ) .
"ду";
158 } elseif ( in_array( $wordLastVowel, $unroundBackVowels ) ) {
159 $word = implode(
"", $ar[0] ) .
"ды";
163 if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
164 $word = implode(
"", $ar[0] ) .
"нү";
165 } elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
166 $word = implode(
"", $ar[0] ) .
"ни";
167 } elseif ( in_array( $wordLastVowel, $roundBackVowels ) ) {
168 $word = implode(
"", $ar[0] ) .
"ну";
169 } elseif ( in_array( $wordLastVowel, $unroundBackVowels ) ) {
170 $word = implode(
"", $ar[0] ) .
"ны";
176 if ( in_array( $wordEnding, $unvoicedPhonemes ) ) {
177 if ( in_array( $wordLastVowel, $frontVowels ) ) {
178 $word = implode(
"", $ar[0] ) .
"те";
179 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
180 $word = implode(
"", $ar[0] ) .
"та";
184 if ( in_array( $wordLastVowel, $frontVowels ) ) {
185 $word = implode(
"", $ar[0] ) .
"де";
186 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
187 $word = implode(
"", $ar[0] ) .
"да";
193 if ( in_array( $wordEnding, $unvoicedPhonemes ) ) {
194 if ( in_array( $wordLastVowel, $frontVowels ) ) {
195 $word = implode(
"", $ar[0] ) .
"тен";
196 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
197 $word = implode(
"", $ar[0] ) .
"тан";
201 if ( in_array( $wordLastVowel, $frontVowels ) ) {
202 $word = implode(
"", $ar[0] ) .
"ден";
203 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
204 $word = implode(
"", $ar[0] ) .
"дан";
210 if ( in_array( $wordEnding, $directiveVoicedStems ) ) {
211 $word = implode(
"", $ar[0] ) .
"же";
212 } elseif ( in_array( $wordEnding, $directiveUnvoicedStems ) ) {
213 $word = implode(
"", $ar[0] ) .
"че";
218 if ( in_array( $wordEnding, $unvoicedPhonemes ) ) {
219 if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
220 $word = implode(
"", $ar[0] ) .
"түве";
221 } elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
222 $word = implode(
"", $ar[0] ) .
"тиве";
223 } elseif ( in_array( $wordLastVowel, $roundBackVowels ) ) {
224 $word = implode(
"", $ar[0] ) .
"туве";
225 } elseif ( in_array( $wordLastVowel, $unroundBackVowels ) ) {
226 $word = implode(
"", $ar[0] ) .
"тыве";
230 if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
231 $word = implode(
"", $ar[0] ) .
"дүве";
232 } elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
233 $word = implode(
"", $ar[0] ) .
"диве";
234 } elseif ( in_array( $wordLastVowel, $roundBackVowels ) ) {
235 $word = implode(
"", $ar[0] ) .
"дуве";
236 } elseif ( in_array( $wordLastVowel, $unroundBackVowels ) ) {
237 $word = implode(
"", $ar[0] ) .
"дыве";