123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777 |
- <?php
- /**
- * Kazakh (Қазақша) specific code.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- * @ingroup Language
- */
- /**
- * Kazakh (Қазақша)
- *
- * @ingroup Language
- */
- // phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps
- class LanguageKk_cyrl extends Language {
- # Convert from the nominative form of a noun to some other case
- # Invoked with {{GRAMMAR:case|word}}
- /**
- * Cases: genitive, dative, accusative, locative, ablative, comitative + possessive forms
- *
- * @param string $word
- * @param string $case
- *
- * @return string
- */
- function convertGrammarKk_cyrl( $word, $case ) {
- global $wgGrammarForms;
- if ( isset( $wgGrammarForms['kk-kz'][$case][$word] ) ) {
- return $wgGrammarForms['kk-kz'][$case][$word];
- }
- if ( isset( $wgGrammarForms['kk-cyrl'][$case][$word] ) ) {
- return $wgGrammarForms['kk-cyrl'][$case][$word];
- }
- // Set up some constants...
- // Vowels in last syllable
- $frontVowels = [ "е", "ө", "ү", "і", "ә", "э", "я", "ё", "и" ];
- $backVowels = [ "а", "о", "ұ", "ы" ];
- $allVowels = [ "е", "ө", "ү", "і", "ә", "э", "а", "о", "ұ", "ы", "я", "ё", "и" ];
- // Preceding letters
- $Nasals = [ "м", "н", "ң" ];
- $Sonants = [ "и", "й", "л", "р", "у", "ю" ];
- $Consonants = [ "п", "ф", "к", "қ", "т", "ш", "с", "х", "ц", "ч", "щ", "б", "в", "г", "д" ];
- $Sibilants = [ "ж", "з" ];
- $Sonorants = [ "и", "й", "л", "р", "у", "ю", "м", "н", "ң", "ж", "з" ];
- // Possessives
- $firstPerson = [ "м", "ң" ]; // 1st singular, 2nd unformal
- $secondPerson = [ "з" ]; // 1st plural, 2nd formal
- $thirdPerson = [ "ы", "і" ]; // 3rd
- $lastLetter = $this->lastLetter( $word, $allVowels );
- $wordEnding =& $lastLetter[0];
- $wordLastVowel =& $lastLetter[1];
- // Now convert the word
- switch ( $case ) {
- case "dc1":
- case "genitive": # ilik
- if ( in_array( $wordEnding, $Consonants ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "тің";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "тың";
- }
- } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Nasals ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "нің";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "ның";
- }
- } elseif ( in_array( $wordEnding, $Sonants ) || in_array( $wordEnding, $Sibilants ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "дің";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "дың";
- }
- }
- break;
- case "dc2":
- case "dative": # barıs
- if ( in_array( $wordEnding, $Consonants ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "ке";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "қа";
- }
- } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Sonorants ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "ге";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "ға";
- }
- }
- break;
- case "dc21":
- case "possessive dative": # täweldık + barıs
- if ( in_array( $wordEnding, $firstPerson ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "е";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "а";
- }
- } elseif ( in_array( $wordEnding, $secondPerson ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "ге";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "ға";
- }
- } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "не";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "на";
- }
- }
- break;
- case "dc3":
- case "accusative": # tabıs
- if ( in_array( $wordEnding, $Consonants ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "ті";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "ты";
- }
- } elseif ( in_array( $wordEnding, $allVowels ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "ні";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "ны";
- }
- } elseif ( in_array( $wordEnding, $Sonorants ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "ді";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "ды";
- }
- }
- break;
- case "dc31":
- case "possessive accusative": # täweldık + tabıs
- if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "ді";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "ды";
- }
- } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
- $word = $word . "н";
- }
- break;
- case "dc4":
- case "locative": # jatıs
- if ( in_array( $wordEnding, $Consonants ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "те";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "та";
- }
- } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Sonorants ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "де";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "да";
- }
- }
- break;
- case "dc41":
- case "possessive locative": # täweldık + jatıs
- if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "де";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "да";
- }
- } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "нде";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "нда";
- }
- }
- break;
- case "dc5":
- case "ablative": # şığıs
- if ( in_array( $wordEnding, $Consonants ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "тен";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "тан";
- }
- } elseif ( in_array( $wordEnding, $allVowels )
- || in_array( $wordEnding, $Sonants )
- || in_array( $wordEnding, $Sibilants )
- ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "ден";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "дан";
- }
- } elseif ( in_array( $wordEnding, $Nasals ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "нен";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "нан";
- }
- }
- break;
- case "dc51":
- case "possessive ablative": # täweldık + şığıs
- if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $thirdPerson ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "нен";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "нан";
- }
- } elseif ( in_array( $wordEnding, $secondPerson ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "ден";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "дан";
- }
- }
- break;
- case "dc6":
- case "comitative": # kömektes
- if ( in_array( $wordEnding, $Consonants ) ) {
- $word = $word . "пен";
- } elseif ( in_array( $wordEnding, $allVowels )
- || in_array( $wordEnding, $Nasals )
- || in_array( $wordEnding, $Sonants )
- ) {
- $word = $word . "мен";
- } elseif ( in_array( $wordEnding, $Sibilants ) ) {
- $word = $word . "бен";
- }
- break;
- case "dc61":
- case "possessive comitative": # täweldık + kömektes
- if ( in_array( $wordEnding, $Consonants ) ) {
- $word = $word . "пенен";
- } elseif ( in_array( $wordEnding, $allVowels )
- || in_array( $wordEnding, $Nasals )
- || in_array( $wordEnding, $Sonants )
- ) {
- $word = $word . "менен";
- } elseif ( in_array( $wordEnding, $Sibilants ) ) {
- $word = $word . "бенен";
- }
- break;
- default: # dc0 #nominative #ataw
- }
- return $word;
- }
- /**
- * @param string $word
- * @param string $case
- * @return string
- */
- function convertGrammarKk_latn( $word, $case ) {
- global $wgGrammarForms;
- if ( isset( $wgGrammarForms['kk-tr'][$case][$word] ) ) {
- return $wgGrammarForms['kk-tr'][$case][$word];
- }
- if ( isset( $wgGrammarForms['kk-latn'][$case][$word] ) ) {
- return $wgGrammarForms['kk-latn'][$case][$word];
- }
- // Set up some constants...
- // Vowels in last syllable
- $frontVowels = [ "e", "ö", "ü", "i", "ä", "é" ];
- $backVowels = [ "a", "o", "u", "ı" ];
- $allVowels = [ "e", "ö", "ü", "i", "ä", "é", "a", "o", "u", "ı" ];
- // Preceding letters
- $Nasals = [ "m", "n", "ñ" ];
- $Sonants = [ "ï", "y", "ý", "l", "r", "w" ];
- $Consonants = [ "p", "f", "k", "q", "t", "ş", "s", "x", "c", "ç", "b", "v", "g", "d" ];
- $Sibilants = [ "j", "z" ];
- $Sonorants = [ "ï", "y", "ý", "l", "r", "w", "m", "n", "ñ", "j", "z" ];
- // Possessives
- $firstPerson = [ "m", "ñ" ]; // 1st singular, 2nd unformal
- $secondPerson = [ "z" ]; // 1st plural, 2nd formal
- $thirdPerson = [ "ı", "i" ]; // 3rd
- $lastLetter = $this->lastLetter( $word, $allVowels );
- $wordEnding =& $lastLetter[0];
- $wordLastVowel =& $lastLetter[1];
- // Now convert the word
- switch ( $case ) {
- case "dc1":
- case "genitive": # ilik
- if ( in_array( $wordEnding, $Consonants ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "tiñ";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "tıñ";
- }
- } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Nasals ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "niñ";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "nıñ";
- }
- } elseif ( in_array( $wordEnding, $Sonants ) || in_array( $wordEnding, $Sibilants ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "diñ";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "dıñ";
- }
- }
- break;
- case "dc2":
- case "dative": # barıs
- if ( in_array( $wordEnding, $Consonants ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "ke";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "qa";
- }
- } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Sonorants ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "ge";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "ğa";
- }
- }
- break;
- case "dc21":
- case "possessive dative": # täweldık + barıs
- if ( in_array( $wordEnding, $firstPerson ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "e";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "a";
- }
- } elseif ( in_array( $wordEnding, $secondPerson ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "ge";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "ğa";
- }
- } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "ne";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "na";
- }
- }
- break;
- case "dc3":
- case "accusative": # tabıs
- if ( in_array( $wordEnding, $Consonants ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "ti";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "tı";
- }
- } elseif ( in_array( $wordEnding, $allVowels ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "ni";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "nı";
- }
- } elseif ( in_array( $wordEnding, $Sonorants ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "di";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "dı";
- }
- }
- break;
- case "dc31":
- case "possessive accusative": # täweldık + tabıs
- if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "di";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "dı";
- }
- } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
- $word = $word . "n";
- }
- break;
- case "dc4":
- case "locative": # jatıs
- if ( in_array( $wordEnding, $Consonants ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "te";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "ta";
- }
- } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Sonorants ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "de";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "da";
- }
- }
- break;
- case "dc41":
- case "possessive locative": # täweldık + jatıs
- if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "de";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "da";
- }
- } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "nde";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "nda";
- }
- }
- break;
- case "dc5":
- case "ablative": # şığıs
- if ( in_array( $wordEnding, $Consonants ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "ten";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "tan";
- }
- } elseif ( in_array( $wordEnding, $allVowels )
- || in_array( $wordEnding, $Sonants )
- || in_array( $wordEnding, $Sibilants )
- ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "den";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "dan";
- }
- } elseif ( in_array( $wordEnding, $Nasals ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "nen";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "nan";
- }
- }
- break;
- case "dc51":
- case "possessive ablative": # täweldık + şığıs
- if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $thirdPerson ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "nen";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "nan";
- }
- } elseif ( in_array( $wordEnding, $secondPerson ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "den";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "dan";
- }
- }
- break;
- case "dc6":
- case "comitative": # kömektes
- if ( in_array( $wordEnding, $Consonants ) ) {
- $word = $word . "pen";
- } elseif ( in_array( $wordEnding, $allVowels )
- || in_array( $wordEnding, $Nasals )
- || in_array( $wordEnding, $Sonants )
- ) {
- $word = $word . "men";
- } elseif ( in_array( $wordEnding, $Sibilants ) ) {
- $word = $word . "ben";
- }
- break;
- case "dc61":
- case "possessive comitative": # täweldık + kömektes
- if ( in_array( $wordEnding, $Consonants ) ) {
- $word = $word . "penen";
- } elseif ( in_array( $wordEnding, $allVowels )
- || in_array( $wordEnding, $Nasals )
- || in_array( $wordEnding, $Sonants )
- ) {
- $word = $word . "menen";
- } elseif ( in_array( $wordEnding, $Sibilants ) ) {
- $word = $word . "benen";
- }
- break;
- default: # dc0 #nominative #ataw
- }
- return $word;
- }
- /**
- * @param string $word
- * @param string $case
- * @return string
- */
- function convertGrammarKk_arab( $word, $case ) {
- global $wgGrammarForms;
- if ( isset( $wgGrammarForms['kk-cn'][$case][$word] ) ) {
- return $wgGrammarForms['kk-cn'][$case][$word];
- }
- if ( isset( $wgGrammarForms['kk-arab'][$case][$word] ) ) {
- return $wgGrammarForms['kk-arab'][$case][$word];
- }
- // Set up some constants...
- // Vowels in last syllable
- $frontVowels = [ "ە", "ٶ", "ٷ", "ٸ", "ٵ", "ە" ];
- $backVowels = [ "ا", "و", "ۇ", "ى" ];
- $allVowels = [ "ە", "ٶ", "ٷ", "ٸ", "ٵ", "ە", "ا", "و", "ۇ", "ى" ];
- // Preceding letters
- $Nasals = [ "م", "ن", "ڭ" ];
- $Sonants = [ "ي", "ي", "ل", "ر", "ۋ" ];
- $Consonants = [ "پ", "ف", "ك", "ق", "ت", "ش", "س", "ح", "تس", "چ", "ب", "ۆ", "گ", "د" ];
- $Sibilants = [ "ج", "ز" ];
- $Sonorants = [ "ي", "ي", "ل", "ر", "ۋ", "م", "ن", "ڭ", "ج", "ز" ];
- // Possessives
- $firstPerson = [ "م", "ڭ" ]; // 1st singular, 2nd unformal
- $secondPerson = [ "ز" ]; // 1st plural, 2nd formal
- $thirdPerson = [ "ى", "ٸ" ]; // 3rd
- $lastLetter = $this->lastLetter( $word, $allVowels );
- $wordEnding = $lastLetter[0];
- $wordLastVowel = $lastLetter[1];
- // Now convert the word
- switch ( $case ) {
- case "dc1":
- case "genitive": # ilik
- if ( in_array( $wordEnding, $Consonants ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "تٸڭ";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "تىڭ";
- }
- } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Nasals ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "نٸڭ";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "نىڭ";
- }
- } elseif ( in_array( $wordEnding, $Sonants ) || in_array( $wordEnding, $Sibilants ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "دٸڭ";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "دىڭ";
- }
- }
- break;
- case "dc2":
- case "dative": # barıs
- if ( in_array( $wordEnding, $Consonants ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "كە";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "قا";
- }
- } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Sonorants ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "گە";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "عا";
- }
- }
- break;
- case "dc21":
- case "possessive dative": # täweldık + barıs
- if ( in_array( $wordEnding, $firstPerson ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "ە";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "ا";
- }
- } elseif ( in_array( $wordEnding, $secondPerson ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "گە";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "عا";
- }
- } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "نە";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "نا";
- }
- }
- break;
- case "dc3":
- case "accusative": # tabıs
- if ( in_array( $wordEnding, $Consonants ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "تٸ";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "تى";
- }
- } elseif ( in_array( $wordEnding, $allVowels ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "نٸ";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "نى";
- }
- } elseif ( in_array( $wordEnding, $Sonorants ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "دٸ";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "دى";
- }
- }
- break;
- case "dc31":
- case "possessive accusative": # täweldık + tabıs
- if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "دٸ";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "دى";
- }
- } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
- $word = $word . "ن";
- }
- break;
- case "dc4":
- case "locative": # jatıs
- if ( in_array( $wordEnding, $Consonants ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "تە";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "تا";
- }
- } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Sonorants ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "دە";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "دا";
- }
- }
- break;
- case "dc41":
- case "possessive locative": # täweldık + jatıs
- if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "دە";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "دا";
- }
- } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "ندە";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "ندا";
- }
- }
- break;
- case "dc5":
- case "ablative": # şığıs
- if ( in_array( $wordEnding, $Consonants ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "تەن";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "تان";
- }
- } elseif ( in_array( $wordEnding, $allVowels )
- || in_array( $wordEnding, $Sonants )
- || in_array( $wordEnding, $Sibilants )
- ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "دەن";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "دان";
- }
- } elseif ( in_array( $wordEnding, $Nasals ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "نەن";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "نان";
- }
- }
- break;
- case "dc51":
- case "possessive ablative": # täweldık + şığıs
- if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $thirdPerson ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "نەن";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "نان";
- }
- } elseif ( in_array( $wordEnding, $secondPerson ) ) {
- if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "دەن";
- } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "دان";
- }
- }
- break;
- case "dc6":
- case "comitative": # kömektes
- if ( in_array( $wordEnding, $Consonants ) ) {
- $word = $word . "پەن";
- } elseif ( in_array( $wordEnding, $allVowels )
- || in_array( $wordEnding, $Nasals )
- || in_array( $wordEnding, $Sonants )
- ) {
- $word = $word . "مەن";
- } elseif ( in_array( $wordEnding, $Sibilants ) ) {
- $word = $word . "بەن";
- }
- break;
- case "dc61":
- case "possessive comitative": # täweldık + kömektes
- if ( in_array( $wordEnding, $Consonants ) ) {
- $word = $word . "پەنەن";
- } elseif ( in_array( $wordEnding, $allVowels )
- || in_array( $wordEnding, $Nasals )
- || in_array( $wordEnding, $Sonants )
- ) {
- $word = $word . "مەنەن";
- } elseif ( in_array( $wordEnding, $Sibilants ) ) {
- $word = $word . "بەنەن";
- }
- break;
- default: # dc0 #nominative #ataw
- }
- return $word;
- }
- /**
- * @param string $word
- * @param array $allVowels
- * @return array
- */
- function lastLetter( $word, $allVowels ) {
- $lastLetter = [];
- // Put the word in a form we can play with since we're using UTF-8
- $ar = preg_split( '//u', parent::lc( $word ), -1, PREG_SPLIT_NO_EMPTY );
- // Here's an array with the order of the letters in the word reversed
- // so we can find a match quicker *shrug*
- $wordReversed = array_reverse( $ar );
- // Here's the last letter in the word
- $lastLetter[0] = $ar[count( $ar ) - 1];
- // Find the last vowel in the word
- $lastLetter[1] = null;
- foreach ( $wordReversed as $xvalue ) {
- foreach ( $allVowels as $yvalue ) {
- if ( strcmp( $xvalue, $yvalue ) == 0 ) {
- $lastLetter[1] = $xvalue;
- break;
- } else {
- continue;
- }
- }
- if ( $lastLetter[1] !== null ) {
- break;
- } else {
- continue;
- }
- }
- return $lastLetter;
- }
- }
|