31 # Convert from the nominative form of a noun to some other case
32 # Invoked with {{GRAMMAR:case|word}}
51 $frontVowels = [
"е",
"ө",
"ү",
"і",
"ә",
"э",
"я",
"ё",
"и" ];
52 $backVowels = [
"а",
"о",
"ұ",
"ы" ];
53 $allVowels = [
"е",
"ө",
"ү",
"і",
"ә",
"э",
"а",
"о",
"ұ",
"ы",
"я",
"ё",
"и" ];
55 $Nasals = [
"м",
"н",
"ң" ];
56 $Sonants = [
"и",
"й",
"л",
"р",
"у",
"ю" ];
57 $Consonants = [
"п",
"ф",
"к",
"қ",
"т",
"ш",
"с",
"х",
"ц",
"ч",
"щ",
"б",
"в",
"г",
"д" ];
58 $Sibilants = [
"ж",
"з" ];
59 $Sonorants = [
"и",
"й",
"л",
"р",
"у",
"ю",
"м",
"н",
"ң",
"ж",
"з" ];
62 $firstPerson = [
"м",
"ң" ];
63 $secondPerson = [
"з" ];
64 $thirdPerson = [
"ы",
"і" ];
66 list( $wordEnding, $wordLastVowel ) = $this->
lastLetter( $word, $allVowels );
71 case "genitive": # ilik
72 if ( in_array( $wordEnding, $Consonants ) ) {
73 if ( in_array( $wordLastVowel, $frontVowels ) ) {
75 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
78 } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Nasals ) ) {
79 if ( in_array( $wordLastVowel, $frontVowels ) ) {
81 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
84 } elseif ( in_array( $wordEnding, $Sonants ) || in_array( $wordEnding, $Sibilants ) ) {
85 if ( in_array( $wordLastVowel, $frontVowels ) ) {
87 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
93 case "dative": # barıs
94 if ( in_array( $wordEnding, $Consonants ) ) {
95 if ( in_array( $wordLastVowel, $frontVowels ) ) {
97 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
100 } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Sonorants ) ) {
101 if ( in_array( $wordLastVowel, $frontVowels ) ) {
103 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
109 case "possessive dative": # täweldık + barıs
110 if ( in_array( $wordEnding, $firstPerson ) ) {
111 if ( in_array( $wordLastVowel, $frontVowels ) ) {
113 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
116 } elseif ( in_array( $wordEnding, $secondPerson ) ) {
117 if ( in_array( $wordLastVowel, $frontVowels ) ) {
119 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
122 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
123 if ( in_array( $wordLastVowel, $frontVowels ) ) {
125 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
131 case "accusative": # tabıs
132 if ( in_array( $wordEnding, $Consonants ) ) {
133 if ( in_array( $wordLastVowel, $frontVowels ) ) {
135 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
138 } elseif ( in_array( $wordEnding, $allVowels ) ) {
139 if ( in_array( $wordLastVowel, $frontVowels ) ) {
141 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
144 } elseif ( in_array( $wordEnding, $Sonorants ) ) {
145 if ( in_array( $wordLastVowel, $frontVowels ) ) {
147 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
153 case "possessive accusative": # täweldık + tabıs
154 if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson ) ) {
155 if ( in_array( $wordLastVowel, $frontVowels ) ) {
157 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
160 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
165 case "locative": # jatıs
166 if ( in_array( $wordEnding, $Consonants ) ) {
167 if ( in_array( $wordLastVowel, $frontVowels ) ) {
169 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
172 } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Sonorants ) ) {
173 if ( in_array( $wordLastVowel, $frontVowels ) ) {
175 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
181 case "possessive locative": # täweldık + jatıs
182 if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson ) ) {
183 if ( in_array( $wordLastVowel, $frontVowels ) ) {
185 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
188 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
189 if ( in_array( $wordLastVowel, $frontVowels ) ) {
191 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
197 case "ablative": # şığıs
198 if ( in_array( $wordEnding, $Consonants ) ) {
199 if ( in_array( $wordLastVowel, $frontVowels ) ) {
201 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
204 } elseif ( in_array( $wordEnding, $allVowels )
205 || in_array( $wordEnding, $Sonants )
206 || in_array( $wordEnding, $Sibilants )
208 if ( in_array( $wordLastVowel, $frontVowels ) ) {
210 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
213 } elseif ( in_array( $wordEnding, $Nasals ) ) {
214 if ( in_array( $wordLastVowel, $frontVowels ) ) {
216 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
222 case "possessive ablative": # täweldık + şığıs
223 if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $thirdPerson ) ) {
224 if ( in_array( $wordLastVowel, $frontVowels ) ) {
226 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
229 } elseif ( in_array( $wordEnding, $secondPerson ) ) {
230 if ( in_array( $wordLastVowel, $frontVowels ) ) {
232 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
238 case "comitative": # kömektes
239 if ( in_array( $wordEnding, $Consonants ) ) {
241 } elseif ( in_array( $wordEnding, $allVowels )
242 || in_array( $wordEnding, $Nasals )
243 || in_array( $wordEnding, $Sonants )
246 } elseif ( in_array( $wordEnding, $Sibilants ) ) {
251 case "possessive comitative": # täweldık + kömektes
252 if ( in_array( $wordEnding, $Consonants ) ) {
254 } elseif ( in_array( $wordEnding, $allVowels )
255 || in_array( $wordEnding, $Nasals )
256 || in_array( $wordEnding, $Sonants )
259 } elseif ( in_array( $wordEnding, $Sibilants ) ) {
263 default: # dc0 #nominative #ataw
283 $frontVowels = [
"e",
"ö",
"ü",
"i",
"ä",
"é" ];
284 $backVowels = [
"a",
"o",
"u",
"ı" ];
285 $allVowels = [
"e",
"ö",
"ü",
"i",
"ä",
"é",
"a",
"o",
"u",
"ı" ];
287 $Nasals = [
"m",
"n",
"ñ" ];
288 $Sonants = [
"ï",
"y",
"ý",
"l",
"r",
"w" ];
289 $Consonants = [
"p",
"f",
"k",
"q",
"t",
"ş",
"s",
"x",
"c",
"ç",
"b",
"v",
"g",
"d" ];
290 $Sibilants = [
"j",
"z" ];
291 $Sonorants = [
"ï",
"y",
"ý",
"l",
"r",
"w",
"m",
"n",
"ñ",
"j",
"z" ];
294 $firstPerson = [
"m",
"ñ" ];
295 $secondPerson = [
"z" ];
296 $thirdPerson = [
"ı",
"i" ];
298 list( $wordEnding, $wordLastVowel ) = $this->
lastLetter( $word, $allVowels );
303 case "genitive": # ilik
304 if ( in_array( $wordEnding, $Consonants ) ) {
305 if ( in_array( $wordLastVowel, $frontVowels ) ) {
307 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
310 } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Nasals ) ) {
311 if ( in_array( $wordLastVowel, $frontVowels ) ) {
313 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
316 } elseif ( in_array( $wordEnding, $Sonants ) || in_array( $wordEnding, $Sibilants ) ) {
317 if ( in_array( $wordLastVowel, $frontVowels ) ) {
319 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
325 case "dative": # barıs
326 if ( in_array( $wordEnding, $Consonants ) ) {
327 if ( in_array( $wordLastVowel, $frontVowels ) ) {
329 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
332 } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Sonorants ) ) {
333 if ( in_array( $wordLastVowel, $frontVowels ) ) {
335 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
341 case "possessive dative": # täweldık + barıs
342 if ( in_array( $wordEnding, $firstPerson ) ) {
343 if ( in_array( $wordLastVowel, $frontVowels ) ) {
345 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
348 } elseif ( in_array( $wordEnding, $secondPerson ) ) {
349 if ( in_array( $wordLastVowel, $frontVowels ) ) {
351 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
354 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
355 if ( in_array( $wordLastVowel, $frontVowels ) ) {
357 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
363 case "accusative": # tabıs
364 if ( in_array( $wordEnding, $Consonants ) ) {
365 if ( in_array( $wordLastVowel, $frontVowels ) ) {
367 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
370 } elseif ( in_array( $wordEnding, $allVowels ) ) {
371 if ( in_array( $wordLastVowel, $frontVowels ) ) {
373 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
376 } elseif ( in_array( $wordEnding, $Sonorants ) ) {
377 if ( in_array( $wordLastVowel, $frontVowels ) ) {
379 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
385 case "possessive accusative": # täweldık + tabıs
386 if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson ) ) {
387 if ( in_array( $wordLastVowel, $frontVowels ) ) {
389 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
392 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
397 case "locative": # jatıs
398 if ( in_array( $wordEnding, $Consonants ) ) {
399 if ( in_array( $wordLastVowel, $frontVowels ) ) {
401 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
404 } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Sonorants ) ) {
405 if ( in_array( $wordLastVowel, $frontVowels ) ) {
407 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
413 case "possessive locative": # täweldık + jatıs
414 if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson ) ) {
415 if ( in_array( $wordLastVowel, $frontVowels ) ) {
417 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
420 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
421 if ( in_array( $wordLastVowel, $frontVowels ) ) {
423 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
429 case "ablative": # şığıs
430 if ( in_array( $wordEnding, $Consonants ) ) {
431 if ( in_array( $wordLastVowel, $frontVowels ) ) {
433 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
436 } elseif ( in_array( $wordEnding, $allVowels )
437 || in_array( $wordEnding, $Sonants )
438 || in_array( $wordEnding, $Sibilants )
440 if ( in_array( $wordLastVowel, $frontVowels ) ) {
442 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
445 } elseif ( in_array( $wordEnding, $Nasals ) ) {
446 if ( in_array( $wordLastVowel, $frontVowels ) ) {
448 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
454 case "possessive ablative": # täweldık + şığıs
455 if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $thirdPerson ) ) {
456 if ( in_array( $wordLastVowel, $frontVowels ) ) {
458 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
461 } elseif ( in_array( $wordEnding, $secondPerson ) ) {
462 if ( in_array( $wordLastVowel, $frontVowels ) ) {
464 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
470 case "comitative": # kömektes
471 if ( in_array( $wordEnding, $Consonants ) ) {
473 } elseif ( in_array( $wordEnding, $allVowels )
474 || in_array( $wordEnding, $Nasals )
475 || in_array( $wordEnding, $Sonants )
478 } elseif ( in_array( $wordEnding, $Sibilants ) ) {
483 case "possessive comitative": # täweldık + kömektes
484 if ( in_array( $wordEnding, $Consonants ) ) {
486 } elseif ( in_array( $wordEnding, $allVowels )
487 || in_array( $wordEnding, $Nasals )
488 || in_array( $wordEnding, $Sonants )
491 } elseif ( in_array( $wordEnding, $Sibilants ) ) {
495 default: # dc0 #nominative #ataw
515 $frontVowels = [
"ە",
"ٶ",
"ٷ",
"ٸ",
"ٵ",
"ە" ];
516 $backVowels = [
"ا",
"و",
"ۇ",
"ى" ];
517 $allVowels = [
"ە",
"ٶ",
"ٷ",
"ٸ",
"ٵ",
"ە",
"ا",
"و",
"ۇ",
"ى" ];
519 $Nasals = [
"م",
"ن",
"ڭ" ];
520 $Sonants = [
"ي",
"ي",
"ل",
"ر",
"ۋ" ];
521 $Consonants = [
"پ",
"ف",
"ك",
"ق",
"ت",
"ش",
"س",
"ح",
"تس",
"چ",
"ب",
"ۆ",
"گ",
"د" ];
522 $Sibilants = [
"ج",
"ز" ];
523 $Sonorants = [
"ي",
"ي",
"ل",
"ر",
"ۋ",
"م",
"ن",
"ڭ",
"ج",
"ز" ];
526 $firstPerson = [
"م",
"ڭ" ];
527 $secondPerson = [
"ز" ];
528 $thirdPerson = [
"ى",
"ٸ" ];
530 list( $wordEnding, $wordLastVowel ) = $this->
lastLetter( $word, $allVowels );
535 case "genitive": # ilik
536 if ( in_array( $wordEnding, $Consonants ) ) {
537 if ( in_array( $wordLastVowel, $frontVowels ) ) {
539 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
542 } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Nasals ) ) {
543 if ( in_array( $wordLastVowel, $frontVowels ) ) {
545 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
548 } elseif ( in_array( $wordEnding, $Sonants ) || in_array( $wordEnding, $Sibilants ) ) {
549 if ( in_array( $wordLastVowel, $frontVowels ) ) {
551 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
557 case "dative": # barıs
558 if ( in_array( $wordEnding, $Consonants ) ) {
559 if ( in_array( $wordLastVowel, $frontVowels ) ) {
561 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
564 } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Sonorants ) ) {
565 if ( in_array( $wordLastVowel, $frontVowels ) ) {
567 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
573 case "possessive dative": # täweldık + barıs
574 if ( in_array( $wordEnding, $firstPerson ) ) {
575 if ( in_array( $wordLastVowel, $frontVowels ) ) {
577 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
580 } elseif ( in_array( $wordEnding, $secondPerson ) ) {
581 if ( in_array( $wordLastVowel, $frontVowels ) ) {
583 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
586 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
587 if ( in_array( $wordLastVowel, $frontVowels ) ) {
589 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
595 case "accusative": # tabıs
596 if ( in_array( $wordEnding, $Consonants ) ) {
597 if ( in_array( $wordLastVowel, $frontVowels ) ) {
599 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
602 } elseif ( in_array( $wordEnding, $allVowels ) ) {
603 if ( in_array( $wordLastVowel, $frontVowels ) ) {
605 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
608 } elseif ( in_array( $wordEnding, $Sonorants ) ) {
609 if ( in_array( $wordLastVowel, $frontVowels ) ) {
611 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
617 case "possessive accusative": # täweldık + tabıs
618 if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson ) ) {
619 if ( in_array( $wordLastVowel, $frontVowels ) ) {
621 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
624 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
629 case "locative": # jatıs
630 if ( in_array( $wordEnding, $Consonants ) ) {
631 if ( in_array( $wordLastVowel, $frontVowels ) ) {
633 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
636 } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Sonorants ) ) {
637 if ( in_array( $wordLastVowel, $frontVowels ) ) {
639 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
645 case "possessive locative": # täweldık + jatıs
646 if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson ) ) {
647 if ( in_array( $wordLastVowel, $frontVowels ) ) {
649 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
652 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
653 if ( in_array( $wordLastVowel, $frontVowels ) ) {
655 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
661 case "ablative": # şığıs
662 if ( in_array( $wordEnding, $Consonants ) ) {
663 if ( in_array( $wordLastVowel, $frontVowels ) ) {
665 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
668 } elseif ( in_array( $wordEnding, $allVowels )
669 || in_array( $wordEnding, $Sonants )
670 || in_array( $wordEnding, $Sibilants )
672 if ( in_array( $wordLastVowel, $frontVowels ) ) {
674 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
677 } elseif ( in_array( $wordEnding, $Nasals ) ) {
678 if ( in_array( $wordLastVowel, $frontVowels ) ) {
680 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
686 case "possessive ablative": # täweldık + şığıs
687 if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $thirdPerson ) ) {
688 if ( in_array( $wordLastVowel, $frontVowels ) ) {
690 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
693 } elseif ( in_array( $wordEnding, $secondPerson ) ) {
694 if ( in_array( $wordLastVowel, $frontVowels ) ) {
696 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
702 case "comitative": # kömektes
703 if ( in_array( $wordEnding, $Consonants ) ) {
705 } elseif ( in_array( $wordEnding, $allVowels )
706 || in_array( $wordEnding, $Nasals )
707 || in_array( $wordEnding, $Sonants )
710 } elseif ( in_array( $wordEnding, $Sibilants ) ) {
715 case "possessive comitative": # täweldık + kömektes
716 if ( in_array( $wordEnding, $Consonants ) ) {
718 } elseif ( in_array( $wordEnding, $allVowels )
719 || in_array( $wordEnding, $Nasals )
720 || in_array( $wordEnding, $Sonants )
723 } elseif ( in_array( $wordEnding, $Sibilants ) ) {
727 default: # dc0 #nominative #ataw
741 $ar = preg_split(
'//u', parent::lc( $word ), -1, PREG_SPLIT_NO_EMPTY );
745 $wordReversed = array_reverse( $ar );
748 $lastLetter[0] = $ar[count( $ar ) - 1];
751 $lastLetter[1] =
null;
752 foreach ( $wordReversed as $xvalue ) {
753 foreach ( $allVowels as $yvalue ) {
754 if ( strcmp( $xvalue, $yvalue ) == 0 ) {
755 $lastLetter[1] = $xvalue;
759 if ( $lastLetter[1] !==
null ) {