local tests = require('Module:UnitTests')
local m_pron = require('Module:uk-pronunciation')
local Ukrainian = require("Module:languages").getByCode("uk")
local Cyrillic = require("Module:scripts").getByCode("Cyrl")
local function tag_IPA(IPA)
return '<span class="IPA">' .. IPA .. '</span>'
end
function tests:check_pronunc(uk, ipa)
self:equals(require("Module:links").full_link{ term = uk, lang = Ukrainian, sc = Cyrillic }, m_pron.pronunciation(uk), ipa, { display = tag_IPA })
end
function tests:check_pronunc_noaccent(uk, ipa)
self:equals(require("Module:links").full_link{ term = uk, lang = Ukrainian, sc = Cyrillic }, m_pron.pronunciation(uk, "1"), ipa, { display = tag_IPA })
end
function tests:test_pronunciation_secondary_stress()
self:check_pronunc("а̀віаполі́т", "ˌaʋʲiɐpoˈlʲit")
self:check_pronunc("нѐйробіоло́гія", "ˌnɛi̯rɔbʲiɔˈɫɔɦʲijɐ")
end
function tests:test_pronunciation_monosyllabic()
self:check_pronunc("бік", "bʲik")
self:check_pronunc("нема́ за́ що", "neˈma ˈza ʃt͡ʃɔ")
end
function tests:test_pronunciation_allophones_e_i()
self:check_pronunc("мене́", "meˈnɛ")
self:check_pronunc("мине́", "meˈnɛ")
end
function tests:test_pronunciation_allophones_j()
self:check_pronunc("хай", "xai̯")
self:check_pronunc("зна́йте", "ˈznai̯te")
self:check_pronunc("ча́йка", "ˈt͡ʃai̯kɐ")
self:check_pronunc("мій", "mʲii̯")
self:check_pronunc("йня́ти", "ˈi̯nʲate")
self:check_pronunc("йод", "jɔd")
self:check_pronunc("моя́", "mɔˈja")
self:check_pronunc("мою́", "mɔˈju")
self:check_pronunc("моє́", "mɔˈjɛ")
self:check_pronunc("мої́", "mɔˈji")
end
function tests:test_pronunciation_allophones_v()
self:check_pronunc("мав", "mau̯")
self:check_pronunc("був", "buu̯")
self:check_pronunc("ма́впа", "ˈmau̯pɐ")
self:check_pronunc("шовк", "ʃɔu̯k")
self:check_pronunc("вниз", "wnɪz")
self:check_pronunc("вона́", "wɔˈna")
self:check_pronunc("ву́хо", "ˈwuxɔ")
self:check_pronunc("впе́рше", "ˈʍpɛrʃe")
self:check_pronunc("він", "ʋʲin")
end
function tests:test_pronunciation_voicing_slovnik_no10()
self:check_pronunc("відділи́ти", "ʋʲidʲːiˈɫɪte")
self:check_pronunc("надті́сувати", "nɐdʲˈtʲisʊʋɐte")
end
function tests:test_pronunciation_voicing_slovnik_no6()
self:check_pronunc("боротьба́", "bɔrɔdʲˈba")
end
function tests:test_pronunciation_assimilations_slovnik()
self:check_pronunc("ви́рісши", "ˈʋɪrʲiʃːe")
self:check_pronunc("ви́візши", "ˈʋɪʋʲiʒʃe")
self:check_pronunc("зши́ти", "ˈʃːɪte")
self:check_pronunc("зжо́вкнути", "ˈʒːɔu̯knʊte")
self:check_pronunc("безжа́лісний", "beˈʒːalʲisnei̯")
self:check_pronunc("безче́сний", "beʒˈt͡ʃɛsnei̯")
self:check_pronunc("зчи́стити", "ˈʃt͡ʃɪstete")
end
function tests:test_pronunciation_assimilations_norm()
self:check_pronunc("відсі́ль", "ʋʲid͡zʲˈsʲilʲ")
self:check_pronunc("два́дцять", "ˈdʋad͡zʲt͡sʲɐtʲ")
self:check_pronunc("ро́биться", "ˈrɔbet͡sʲːɐ")
self:check_pronunc("кори́тця", "kɔˈrɪt͡sʲːɐ")
end
function tests:test_pronunciation_phonetic_lengthened_consonants()
self:check_pronunc("знання́", "znɐˈnʲːa")
self:check_pronunc("рілля́", "rʲiˈlʲːa")
self:check_pronunc("ті́нню", "ˈtʲinʲːʊ")
self:check_pronunc("ллю", "lʲːu")
self:check_pronunc("обби́ти", "ɔˈbːɪte")
self:check_pronunc("зако́нний", "zɐˈkɔnːei̯")
self:check_pronunc("вітчи́зна", "ʋʲiˈt͡ʃːɪznɐ")
self:check_pronunc("болі́тце", "boˈlʲit͡sːe")
self:check_pronunc("ви́нісши", "ˈʋɪnʲiʃːe")
self:check_pronunc("зжува́ти", "ʒːʊˈʋate")
self:check_pronunc("бере́шся", "beˈrɛsʲːɐ")
self:check_pronunc("бері́ться", "beˈrʲit͡sʲːɐ")
end
function tests:test_pronunciation_phonetic_simplification()
self:check_pronunc("студе́нтський", "stʊˈdɛnʲsʲkei̯")
self:check_pronunc("тури́стський", "tʊˈrɪsʲkei̯")
self:check_pronunc("аге́нтство", "ɐˈɦɛnstwɔ")
self:check_pronunc("солі́стці", "soˈlʲisʲt͡sʲ(ː)i")
self:check_pronunc("шістдеся́т", "ʃʲizdeˈsʲat")
self:check_pronunc("шістсо́т", "ʃʲiˈsːɔt")
end
function tests:test_pronunciation_phonetic_consonant_assimilations_Pugh_p36_37_38()
self:check_pronunc("кни́жка", "ˈknɪʒkɐ")
self:check_pronunc("кни́жці", "ˈknɪzʲt͡sʲi")
self:check_pronunc("дочка́", "dɔt͡ʃˈka")
self:check_pronunc("дочці́", "dɔˈt͡sʲːi")
self:check_pronunc("чита́єш", "t͡ʃeˈtajeʃ")
self:check_pronunc("сміє́шся", "sʲmʲiˈjɛsʲːɐ")
self:check_pronunc("до́шка", "ˈdɔʃkɐ")
self:check_pronunc("до́шці", "ˈdɔsʲt͡sʲi")
self:check_pronunc("безжа́лісний", "beˈʒːalʲisnei̯")
self:check_pronunc("підрі́сши", "pʲiˈdʲrʲiʃːe")
self:check_pronunc("кімна́тці", "kʲimˈnat͡sʲːi")
self:check_pronunc("крава́тці", "krɐˈʋat͡sʲːi")
self:check_pronunc("неві́стці", "neˈʋʲisʲt͡sʲ(ː)i")
self:check_pronunc("борі́дці", "boˈrʲid͡zʲt͡sʲi")
self:check_pronunc("лю́дський", "ˈlʲud͡zʲsʲkei̯")
-- Pugh p. 37 claims that it should be sɔlˈdat͡sʲsʲkɪj, but Орфоепскі словник p. 97 claims otherwise
self:check_pronunc("солда́тський", "sɔɫˈdat͡sʲkei̯")
end
function tests:test_pronunciation_phonetic_apostrophe_Pugh_p32()
self:check_pronunc("від'ї́зд", "ʋʲiˈdjizd")
self:check_pronunc("п'ю", "pju")
self:check_pronunc("ф'ю́кати", "ˈfjukɐte")
self:check_pronunc("об'є́кт", "ɔˈbjɛkt")
self:check_pronunc("п'ять", "pjatʲ")
self:check_pronunc("здоро́в'я", "zdɔˈrɔʋjɐ")
self:check_pronunc("м'яки́й", "mjɐˈkɪi̯")
end
function tests:test_pronunciation_phonetic_Pugh_p29_p30()
self:check_pronunc("ти", "tɪ")
self:check_pronunc("ті", "tʲi")
self:check_pronunc("дя́кую", "ˈdʲakʊjʊ")
self:check_pronunc("сад", "sad")
self:check_pronunc("сядь", "sʲadʲ")
self:check_pronunc("пала́ц", "pɐˈɫat͡s")
self:check_pronunc("хло́пець", "ˈxɫɔpet͡sʲ")
self:check_pronunc("дзвін", "d͡zʲʋʲin")
self:check_pronunc("дзво́на", "ˈd͡zwɔnɐ")
self:check_pronunc("ра́са", "ˈrasɐ")
self:check_pronunc("ря́са", "ˈrʲasɐ")
self:check_pronunc("бі́лий", "ˈbʲiɫei̯")
self:check_pronunc("вів", "ʋʲiu̯")
self:check_pronunc("кінь", "kʲinʲ")
self:check_pronunc("шість", "ʃʲisʲtʲ")
self:check_pronunc("ножі́", "noˈʒʲi")
self:check_pronunc("уночі́", "ʊnoˈt͡ʃʲi")
self:check_pronunc("мі́сті", "ˈmʲisʲtʲi")
self:check_pronunc("одні́й", "odʲˈnʲii̯")
self:check_pronunc("сніг", "sʲnʲiɦ")
self:check_pronunc("люблю́", "lʲʊˈblʲu")
self:check_pronunc("коно́плі", "kɔˈnɔplʲi")
self:check_pronunc("графля́ть", "ɦrɐˈflʲatʲ")
self:check_pronunc("ко́рмлять", "ˈkɔrmlʲɐtʲ")
end
-- If a vowel, an apostrophe, or nothing precedes я, є, ю, then they represent [j] + [a, ɛ, u].
function tests:test_pronunciation_phonetic_ja_je_ju()
self:check_pronunc("а́я", "ˈajɐ")
self:check_pronunc("ея́", "eˈja")
self:check_pronunc("і́я", "ˈijɐ")
self:check_pronunc("ия́", "eˈja")
self:check_pronunc("о́я", "ˈɔjɐ")
self:check_pronunc("уя́", "ʊˈja")
self:check_pronunc("а́є", "ˈaje")
self:check_pronunc("еє́", "eˈjɛ")
self:check_pronunc("і́є", "ˈije")
self:check_pronunc("иє́", "eˈjɛ")
self:check_pronunc("о́є", "ˈɔje")
self:check_pronunc("ую́", "ʊˈju")
self:check_pronunc("а́ю", "ˈajʊ")
self:check_pronunc("ею́", "eˈju")
self:check_pronunc("і́ю", "ˈijʊ")
self:check_pronunc("ию́", "eˈju")
self:check_pronunc("о́ю", "ˈɔjʊ")
self:check_pronunc("ую́", "ʊˈju")
self:check_pronunc_noaccent("'я", "jɐ")
self:check_pronunc_noaccent("'є", "je")
self:check_pronunc_noaccent("'ю", "jʊ")
self:check_pronunc_noaccent("я", "jɐ")
self:check_pronunc_noaccent("є", "je")
self:check_pronunc_noaccent("ю", "jʊ")
end
-- phonemic and subphonemic weak palatalization.
function tests:test_pronunciation_phonetic_softening_ja_je_ji_ju()
-- first 12 subphonemic: б п в ф м к г х ж ш ч щ дж ждж
self:check_pronunc("б", "b")
self:check_pronunc_noaccent("бі", "bʲi")
self:check_pronunc_noaccent("бя", "bʲɐ")
self:check_pronunc_noaccent("бє", "bʲe")
self:check_pronunc_noaccent("бю", "bʲʊ")
self:check_pronunc("п", "p")
self:check_pronunc_noaccent("пі", "pʲi")
self:check_pronunc_noaccent("пя", "pʲɐ")
self:check_pronunc_noaccent("пє", "pʲe")
self:check_pronunc_noaccent("пю", "pʲʊ")
self:check_pronunc("в", "ʋ")
self:check_pronunc_noaccent("ві", "ʋʲi")
self:check_pronunc_noaccent("вя", "ʋʲɐ")
self:check_pronunc_noaccent("вє", "ʋʲe")
self:check_pronunc_noaccent("вю", "ʋʲʊ")
self:check_pronunc("ф", "f")
self:check_pronunc_noaccent("фі", "fʲi")
self:check_pronunc_noaccent("фя", "fʲɐ")
self:check_pronunc_noaccent("фє", "fʲe")
self:check_pronunc_noaccent("фю", "fʲʊ")
self:check_pronunc("м", "m")
self:check_pronunc_noaccent("мі", "mʲi")
self:check_pronunc_noaccent("мя", "mʲɐ")
self:check_pronunc_noaccent("мє", "mʲe")
self:check_pronunc_noaccent("мю", "mʲʊ")
self:check_pronunc("к", "k")
self:check_pronunc_noaccent("кі", "kʲi")
self:check_pronunc_noaccent("кя", "kʲɐ")
self:check_pronunc_noaccent("кє", "kʲe")
self:check_pronunc_noaccent("кю", "kʲʊ")
self:check_pronunc("г", "ɦ")
self:check_pronunc_noaccent("гі", "ɦʲi")
self:check_pronunc_noaccent("гя", "ɦʲɐ")
self:check_pronunc_noaccent("гє", "ɦʲe")
self:check_pronunc_noaccent("гю", "ɦʲʊ")
self:check_pronunc("х", "x")
self:check_pronunc_noaccent("хі", "xʲi")
self:check_pronunc_noaccent("хя", "xʲɐ")
self:check_pronunc_noaccent("хє", "xʲe")
self:check_pronunc_noaccent("хю", "xʲʊ")
self:check_pronunc("ж", "ʒ")
self:check_pronunc_noaccent("жі", "ʒʲi")
self:check_pronunc_noaccent("жя", "ʒʲɐ")
self:check_pronunc_noaccent("жє", "ʒʲe")
self:check_pronunc_noaccent("жю", "ʒʲʊ")
self:check_pronunc("ш", "ʃ")
self:check_pronunc_noaccent("ші", "ʃʲi")
self:check_pronunc_noaccent("шя", "ʃʲɐ")
self:check_pronunc_noaccent("шє", "ʃʲe")
self:check_pronunc_noaccent("шю", "ʃʲʊ")
self:check_pronunc("ч", "t͡ʃ")
self:check_pronunc_noaccent("чі", "t͡ʃʲi")
self:check_pronunc_noaccent("чя", "t͡ʃʲɐ")
self:check_pronunc_noaccent("чє", "t͡ʃʲe")
self:check_pronunc_noaccent("чю", "t͡ʃʲʊ")
self:check_pronunc("щ", "ʃt͡ʃ")
self:check_pronunc_noaccent("щі", "ʃt͡ʃʲi")
self:check_pronunc_noaccent("щя", "ʃt͡ʃʲɐ")
self:check_pronunc_noaccent("щє", "ʃt͡ʃʲe")
self:check_pronunc_noaccent("щю", "ʃt͡ʃʲʊ")
self:check_pronunc("дж", "d͡ʒ")
self:check_pronunc_noaccent("джі", "d͡ʒʲi")
self:check_pronunc_noaccent("джя",
"d͡ʒʲɐ")
self:check_pronunc_noaccent("джє", "d͡ʒʲe")
self:check_pronunc_noaccent("джю", "d͡ʒʲʊ")
self:check_pronunc("ждж", "ʒd͡ʒ")
self:check_pronunc_noaccent("жджі", "ʒd͡ʒʲi")
self:check_pronunc_noaccent("жджя", "ʒd͡ʒʲɐ")
self:check_pronunc_noaccent("жджє", "ʒd͡ʒʲe")
self:check_pronunc_noaccent("жджю", "ʒd͡ʒʲʊ")
---- 9 phonemic softenings: т д с з ц дз н л
self:check_pronunc("т", "t")
self:check_pronunc_noaccent("ті", "tʲi")
self:check_pronunc_noaccent("тя", "tʲɐ")
self:check_pronunc_noaccent("тє", "tʲe")
self:check_pronunc_noaccent("тю", "tʲʊ")
self:check_pronunc("д", "d")
self:check_pronunc_noaccent("ді", "dʲi")
self:check_pronunc_noaccent("дя", "dʲɐ")
self:check_pronunc_noaccent("дє", "dʲe")
self:check_pronunc_noaccent("дю", "dʲʊ")
self:check_pronunc("с", "s")
self:check_pronunc_noaccent("сі", "sʲi")
self:check_pronunc_noaccent("ся", "sʲɐ")
self:check_pronunc_noaccent("сє", "sʲe")
self:check_pronunc_noaccent("сю", "sʲʊ")
self:check_pronunc("з", "z")
self:check_pronunc_noaccent("зі", "zʲi")
self:check_pronunc_noaccent("зя", "zʲɐ")
self:check_pronunc_noaccent("зє", "zʲe")
self:check_pronunc_noaccent("зю", "zʲʊ")
self:check_pronunc("ц", "t͡s")
self:check_pronunc_noaccent("ці", "t͡sʲi")
self:check_pronunc_noaccent("ця", "t͡sʲɐ")
self:check_pronunc_noaccent("цє", "t͡sʲe")
self:check_pronunc_noaccent("цю", "t͡sʲʊ")
self:check_pronunc("дз", "d͡z")
self:check_pronunc_noaccent("дзі", "d͡zʲi")
self:check_pronunc_noaccent("дзя", "d͡zʲɐ")
self:check_pronunc_noaccent("дзє", "d͡zʲe")
self:check_pronunc_noaccent("дзю", "d͡zʲʊ")
self:check_pronunc("н", "n")
self:check_pronunc_noaccent("ні", "nʲi")
self:check_pronunc_noaccent("ня", "nʲɐ")
self:check_pronunc_noaccent("нє", "nʲe")
self:check_pronunc_noaccent("ню", "nʲʊ")
self:check_pronunc("л", "ɫ")
self:check_pronunc_noaccent("лі", "lʲi")
self:check_pronunc_noaccent("ля", "lʲɐ")
self:check_pronunc_noaccent("лє", "lʲe")
self:check_pronunc_noaccent("лю", "lʲʊ")
self:check_pronunc("р", "r")
self:check_pronunc_noaccent("рі", "rʲi")
self:check_pronunc_noaccent("ря", "rʲɐ")
self:check_pronunc_noaccent("рє", "rʲe")
self:check_pronunc_noaccent("рю", "rʲʊ")
end
function tests:test_pronunciation_phonetic_hard_soft_sign()
self:check_pronunc("т", "t")
self:check_pronunc("ть", "tʲ")
self:check_pronunc("д", "d")
self:check_pronunc("дь", "dʲ")
self:check_pronunc("с", "s")
self:check_pronunc("сь", "sʲ")
self:check_pronunc("з", "z")
self:check_pronunc("зь", "zʲ")
self:check_pronunc("ц", "t͡s")
self:check_pronunc("ць", "t͡sʲ")
self:check_pronunc("дз", "d͡z")
self:check_pronunc("дзь", "d͡zʲ")
self:check_pronunc("н", "n")
self:check_pronunc("нь", "nʲ")
self:check_pronunc("л", "ɫ")
self:check_pronunc("ль", "lʲ")
self:check_pronunc("п", "p")
self:check_pronunc("пь", "pʲ")
end
function tests:test_pronunciation_phonetic_dual_pronunciation_prefix_bez_roz()
self:check_pronunc("розписа́ти", "rɔzpeˈsate")
self:check_pronunc("росписа́ти", "rɔspeˈsate")
self:check_pronunc("безпла́тний", "bezˈpɫatnei̯")
self:check_pronunc("беспла́тний", "beˈspɫatnei̯")
end
function tests:test_pronunciation_phonetic_assimilation_voiceless_voiced()
self:check_pronunc("вокза́л", "wɔɡˈzaɫ")
self:check_pronunc("якби́", "jɐɡˈbɪ")
self:check_pronunc("молотьба́", "mɔɫɔdʲˈba")
self:check_pronunc("анекдо́т", "ɐneɡˈdɔt")
self:check_pronunc("при", "prɪ")
end
function tests:test_pronunciation_phonetic_basic()
self:check_pronunc("ходжу́", "xoˈd͡ʒu")
self:check_pronunc("джи́нси", "ˈd͡ʒɪnse")
self:check_pronunc("дзе́ркало", "ˈd͡zɛrkɐɫɔ")
self:check_pronunc("дзво́ник", "ˈd͡zwɔnek")
self:check_pronunc("дзьоб", "d͡zʲɔb")
self:check_pronunc("агре́сія", "ɐˈɦrɛsʲijɐ")
self:check_pronunc("шви́дше", "ˈʃʋɪd͡ʒʃe")
self:check_pronunc("ї́жте", "ˈjiʒte")
self:check_pronunc("ро́зталь", "ˈrɔztɐlʲ")
self:check_pronunc("шви́дко", "ˈʃʋɪdkɔ")
self:check_pronunc("ніж", "nʲiʒ")
self:check_pronunc("ри́бка", "ˈrɪbkɐ")
self:check_pronunc("ка́зка", "ˈkazkɐ")
self:check_pronunc("ка́ска", "ˈkaskɐ")
self:check_pronunc("залюбки́", "zɐlʲʊbˈkɪ")
self:check_pronunc("мед", "mɛd")
-- must be rʲ, error in the book p. 26
self:check_pronunc("скрізь", "skrʲizʲ")
-- word-initial stressed vowel; formerly not handled correctly
self:check_pronunc("О́сло", "ˈɔsɫɔ")
end
function tests:test_pronunciation_phonetic_diphonemic_dz_dzh_dsh_dch()
self:check_pronunc("піджжива́ти", "pʲid͡ʒʒeˈʋate")
self:check_pronunc("віджжи́лий", "ʋʲid͡ʒˈʒɪɫei̯")
self:check_pronunc("підззе́мний", "pʲid͡zˈzɛmnei̯")
self:check_pronunc("підззира́ти", "pʲid͡zzeˈrate")
self:check_pronunc("відшу́кувати", "ʋʲid͡ʒˈʃukʊʋɐte")
self:check_pronunc("відчуття́", "ʋʲid͡ʒt͡ʃʊˈtʲːa")
self:check_pronunc("відці́джувати", "ʋʲid͡zʲˈt͡sʲid͡ʒʊʋɐte")
self:check_pronunc("відцвіта́ти", "ʋʲid͡zt͡sʲʋʲiˈtate")
end
function tests:test_pronunciation_multiword_expressions()
-- initial stress in a medial word formerly not handled correctly
self:check_pronunc("Сполу́чені Шта́ти Аме́рики", "spoˈɫut͡ʃenʲi ˈʃtate ɐˈmɛreke")
end
return tests