47 $allVowels = [
"е",
"и",
"э",
"ө",
"ү",
"а",
"ё",
"о",
"у",
"ы",
"ю",
"я" ];
48 $frontVowels = [
"е",
"и",
"э",
"ө",
"ү" ];
49 $backVowels = [
"а",
"ё",
"о",
"у",
"ы",
"ю",
"я" ];
50 $unroundFrontVowels = [
"е",
"и",
"э" ];
51 $roundFrontVowels = [
"ө",
"ү" ];
52 $unroundBackVowels = [
"а",
"ы",
"я" ];
53 $roundBackVowels = [
"ё",
"о",
"у",
"ю" ];
54 $unvoicedPhonemes = [
"т",
"п",
"с",
"ш",
"к",
"ч",
"х" ];
55 $directiveUnvoicedStems = [
"т",
"п",
"с",
"ш",
"к",
"ч",
"х",
"л",
"м",
"н",
"ң" ];
56 $directiveVoicedStems = [
"д",
"б",
"з",
"ж",
"г",
"р",
"й" ];
59 preg_match_all(
'/./us', $word, $ar );
62 $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;
78 if ( $wordLastVowel !==
null ) {
86 if ( in_array( $wordEnding, $unvoicedPhonemes ) ) {
87 if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
88 $word = implode(
"", $ar[0] ) .
"түң";
89 } elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
90 $word = implode(
"", $ar[0] ) .
"тиң";
91 } elseif ( in_array( $wordLastVowel, $roundBackVowels ) ) {
92 $word = implode(
"", $ar[0] ) .
"туң";
93 } elseif ( in_array( $wordLastVowel, $unroundBackVowels ) ) {
94 $word = implode(
"", $ar[0] ) .
"тың";
97 } elseif ( $wordEnding ===
"л" ) {
98 if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
99 $word = implode(
"", $ar[0] ) .
"дүң";
100 } elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
101 $word = implode(
"", $ar[0] ) .
"диң";
102 } elseif ( in_array( $wordLastVowel, $roundBackVowels ) ) {
103 $word = implode(
"", $ar[0] ) .
"дуң";
104 } elseif ( in_array( $wordLastVowel, $unroundBackVowels ) ) {
105 $word = implode(
"", $ar[0] ) .
"дың";
109 if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
110 $word = implode(
"", $ar[0] ) .
"нүң";
111 } elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
112 $word = implode(
"", $ar[0] ) .
"ниң";
113 } elseif ( in_array( $wordLastVowel, $roundBackVowels ) ) {
114 $word = implode(
"", $ar[0] ) .
"нуң";
115 } elseif ( in_array( $wordLastVowel, $unroundBackVowels ) ) {
116 $word = implode(
"", $ar[0] ) .
"ның";
122 if ( in_array( $wordEnding, $unvoicedPhonemes ) ) {
123 if ( in_array( $wordLastVowel, $frontVowels ) ) {
124 $word = implode(
"", $ar[0] ) .
"ке";
125 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
126 $word = implode(
"", $ar[0] ) .
"ка";
130 if ( in_array( $wordLastVowel, $frontVowels ) ) {
131 $word = implode(
"", $ar[0] ) .
"ге";
132 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
133 $word = implode(
"", $ar[0] ) .
"га";
139 if ( in_array( $wordEnding, $unvoicedPhonemes ) ) {
140 if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
141 $word = implode(
"", $ar[0] ) .
"тү";
142 } elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
143 $word = implode(
"", $ar[0] ) .
"ти";
144 } elseif ( in_array( $wordLastVowel, $roundBackVowels ) ) {
145 $word = implode(
"", $ar[0] ) .
"ту";
146 } elseif ( in_array( $wordLastVowel, $unroundBackVowels ) ) {
147 $word = implode(
"", $ar[0] ) .
"ты";
150 } elseif ( $wordEnding ===
"л" ) {
151 if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
152 $word = implode(
"", $ar[0] ) .
"дү";
153 } elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
154 $word = implode(
"", $ar[0] ) .
"ди";
155 } elseif ( in_array( $wordLastVowel, $roundBackVowels ) ) {
156 $word = implode(
"", $ar[0] ) .
"ду";
157 } elseif ( in_array( $wordLastVowel, $unroundBackVowels ) ) {
158 $word = implode(
"", $ar[0] ) .
"ды";
162 if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
163 $word = implode(
"", $ar[0] ) .
"нү";
164 } elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
165 $word = implode(
"", $ar[0] ) .
"ни";
166 } elseif ( in_array( $wordLastVowel, $roundBackVowels ) ) {
167 $word = implode(
"", $ar[0] ) .
"ну";
168 } elseif ( in_array( $wordLastVowel, $unroundBackVowels ) ) {
169 $word = implode(
"", $ar[0] ) .
"ны";
175 if ( in_array( $wordEnding, $unvoicedPhonemes ) ) {
176 if ( in_array( $wordLastVowel, $frontVowels ) ) {
177 $word = implode(
"", $ar[0] ) .
"те";
178 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
179 $word = implode(
"", $ar[0] ) .
"та";
183 if ( in_array( $wordLastVowel, $frontVowels ) ) {
184 $word = implode(
"", $ar[0] ) .
"де";
185 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
186 $word = implode(
"", $ar[0] ) .
"да";
192 if ( in_array( $wordEnding, $unvoicedPhonemes ) ) {
193 if ( in_array( $wordLastVowel, $frontVowels ) ) {
194 $word = implode(
"", $ar[0] ) .
"тен";
195 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
196 $word = implode(
"", $ar[0] ) .
"тан";
200 if ( in_array( $wordLastVowel, $frontVowels ) ) {
201 $word = implode(
"", $ar[0] ) .
"ден";
202 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
203 $word = implode(
"", $ar[0] ) .
"дан";
209 if ( in_array( $wordEnding, $directiveVoicedStems ) ) {
210 $word = implode(
"", $ar[0] ) .
"же";
211 } elseif ( in_array( $wordEnding, $directiveUnvoicedStems ) ) {
212 $word = implode(
"", $ar[0] ) .
"че";
217 if ( in_array( $wordEnding, $unvoicedPhonemes ) ) {
218 if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
219 $word = implode(
"", $ar[0] ) .
"түве";
220 } elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
221 $word = implode(
"", $ar[0] ) .
"тиве";
222 } elseif ( in_array( $wordLastVowel, $roundBackVowels ) ) {
223 $word = implode(
"", $ar[0] ) .
"туве";
224 } elseif ( in_array( $wordLastVowel, $unroundBackVowels ) ) {
225 $word = implode(
"", $ar[0] ) .
"тыве";
229 if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
230 $word = implode(
"", $ar[0] ) .
"дүве";
231 } elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
232 $word = implode(
"", $ar[0] ) .
"диве";
233 } elseif ( in_array( $wordLastVowel, $roundBackVowels ) ) {
234 $word = implode(
"", $ar[0] ) .
"дуве";
235 } elseif ( in_array( $wordLastVowel, $unroundBackVowels ) ) {
236 $word = implode(
"", $ar[0] ) .
"дыве";