Module:tl-pronunciation/testcases

From Wiktionary, the free dictionary
Jump to navigation Jump to search

All tests passed. (refresh)

TextExpectedActual
test_phonetic_pron:
Passedalambre (respelled alambre)ʔɐˈlam.bɾɛʔɐˈlam.bɾɛ
Passedasamblea (respelled asamblea)ʔɐ.sɐmˈblɛː.ɐʔɐ.sɐmˈblɛː.ɐ
Passedaso (respelled aso)ˈʔaː.soˈʔaː.so
Passedatras (respelled atrás)ʔɐt̪ˈɾasʔɐt̪ˈɾas
Passedbaboy (respelled baboy)ˈbaː.boɪ̯ˈbaː.boɪ̯
Passedbaga (respelled bagá)bɐˈɣabɐˈɣa
Passedbaka (respelled baka)ˈbaː.xɐˈbaː.xɐ
Passedbakante (respelled bakante)bɐˈxan̪.t̪ɛbɐˈxan̪.t̪ɛ
Passedbakla (respelled baklá7)bɐkˈlaʔbɐkˈlaʔ
Passedbanyo (respelled banyo)ˈbaː.ɲoˈbaː.ɲo
Passedbanyera (respelled banyera)bɐˈɲɛː.ɾɐbɐˈɲɛː.ɾɐ
PassedCarlos (respelled Carlos)ˈkaɾ.losˈkaɾ.los
PassedCebu (respelled Cebú)sɛˈbusɛˈbu
PassedCharlie (respelled Charli)ˈt͡ʃaɾ.lɪˈt͡ʃaɾ.lɪ
Passeddating (respelled datíng)d̪ɐˈt̪iŋd̪ɐˈt̪iŋ
Passeddaw (respelled daw)d̪aʊ̯d̪aʊ̯
Passeddela Cruz (respelled delá Cruz)d̪ɛˌla ˈkɾusd̪ɛˌla ˈkɾus
Passeddigmaan (respelled digma7an)d̪ɪɡˈmaː.ʔɐn̪d̪ɪɡˈmaː.ʔɐn̪
Passeddila (respelled dilà)ˈd̪iː.lɐʔˈd̪iː.lɐʔ
Passeddiyaryo (respelled diyaryo)ˈd͡ʒaɾ.joˈd͡ʒaɾ.jo
PassedDomingo (respelled Domin.go)d̪oˈmiŋ.ɡod̪oˈmiŋ.ɡo
PassedFabian (respelled fabyán)fɐbˈjan̪fɐbˈjan̪
Passedfutbol (respelled futbol)ˈfut̪.bolˈfut̪.bol
Passedhawla (respelled hawla)ˈhaʊ̯.lɐˈhaʊ̯.lɐ
Passedhingal (respelled hingal)ˈhiː.ŋɐlˈhiː.ŋɐl
Passedhingal (respelled hingál)hɪˈŋalhɪˈŋal
Passedkongreso (respelled kon.greso)koŋˈɡɾɛː.sokoŋˈɡɾɛː.so
Passedkontra (respelled kontra)ˈkon̪.t̪ɾɐˈkon̪.t̪ɾɐ
Passedkontrata (respelled kontrata)kon̪ˈt̪ɾaː.t̪ɐkon̪ˈt̪ɾaː.t̪ɐ
Passedkutsara (respelled kutsara)kʊˈt͡ʃaː.ɾɐkʊˈt͡ʃaː.ɾɐ
Passedlayko (respelled layko)ˈlaɪ̯.xoˈlaɪ̯.xo
Passedligalig (respelled ligalig)lɪˈɣaː.lɪɡ̚lɪˈɣaː.lɪɡ̚
Passedluto (respelled lutò)ˈluː.t̪oʔˈluː.t̪oʔ
Passedluto (respelled lutô)lʊˈt̪oʔlʊˈt̪oʔ
PassedNiña (respelled Niña)ˈn̪iː.ɲɐˈn̪iː.ɲɐ
Passedpakla (respelled paklá)pɐkˈlapɐkˈla
Passedpinto (respelled pintô)pɪn̪ˈt̪oʔpɪn̪ˈt̪oʔ
Passedsilindro (respelled silindro)sɪˈlin̪.d̪ɾosɪˈlin̪.d̪ɾo
Passedsino ka (respelled sino ka)ˈsiː.n̪o xɐˈsiː.n̪o xɐ
Passedsuklay (respelled sukláy)sʊkˈlaɪ̯sʊkˈlaɪ̯
Passedtatsulok (respelled tat.sulók)t̪ɐt̪.sʊˈlok̚t̪ɐt̪.sʊˈlok̚
Passedteka (respelled teka)ˈt̪ɛː.xɐˈt̪ɛː.xɐ
Passedtiyak (respelled tiyák)ˈt͡ʃak̚ˈt͡ʃak̚
Passedtransportasyon (respelled transportasyón)t̪ɾɐn̪s.poɾ.t̪ɐˈʃon̪t̪ɾɐn̪s.poɾ.t̪ɐˈʃon̪
Passedtsiko (respelled tsiko)ˈt͡ʃiː.xoˈt͡ʃiː.xo
Passedulam (respelled ulam)ˈʔuː.lɐmˈʔuː.lɐm
Passeduminom (respelled uminóm)ʔʊ.mɪˈn̪omʔʊ.mɪˈn̪om
Passeduwak (respelled uwák)ʔʊˈak̚ʔʊˈak̚
Passedyakap (respelled yakap)ˈjaː.xɐp̚ˈjaː.xɐp̚
Passedzigzag (respelled zigzag)ˈziɡ.zɐɡ̚ˈziɡ.zɐɡ̚
Passedkibitser (respelled kíbit.ser)ˌkiː.bɪt̪ˈsɛɾˌkiː.bɪt̪ˈsɛɾ
PassedHatsuko (respelled Hat_suko)hɐˈt͡suː.xohɐˈt͡suː.xo
TextExpectedActual
test_syllabification:
PassedAllan (respelled Alan)A.llanA.llan
PassedMallig (respelled Mal.líg)Mal.ligMal.lig
PassedMallig (respelled Malíg)Ma.lligMa.llig
PassedAllahu akbar (respelled Alahu akbár)A.lla.hu ak.barA.lla.hu ak.bar
PassedAthanasia (respelled Atanasya)A.tha.nas.iaA.tha.nas.ia
Passedassalamu alaikum (respelled asalamu alaikum)a.ssa.la.mu a.lai.kuma.ssa.la.mu a.lai.kum
Passedbarangay (respelled baranggáy)ba.ran.gayba.ran.gay
PassedEvangelista (respelled Evanghelista)E.van.ge.lis.taE.van.ge.lis.ta
PassedBay (respelled Ba7ý)Ba.yBa.y
PassedCabiao (respelled Cabyáo)Cab.iaoCab.iao
PassedCaguiat (respelled Caguiát)Cag.uiatCag.uiat
PassedCynthia (respelled Cýntiya)Cyn.thi.aCyn.thi.a
PassedHermogenes (respelled Ermóhenes)Her.mo.ge.nesHer.mo.ge.nes
PassedAbdurahman (respelled Abduramán)Ab.du.rah.manAb.du.rah.man
Passedadhan (respelled adán)a.dhana.dhan
PassedAgatha (respelled Ágata)A.ga.thaA.ga.tha
PassedKho (respelled )KhoKho
PassedZulueta (respelled Zulweta)Zul.ue.taZul.ue.ta
PassedAguado (respelled Agwado)Ag.ua.doAg.ua.do
PassedBuendia (respelled Buendía)Bu.en.di.aBu.en.di.a
PassedMaria (respelled María)Ma.ri.aMa.ri.a
PassedArguelles (respelled Argu.elles)Ar.gu.el.lesAr.gu.el.les
PassedJefferson (respelled Jéferson)Je.ffer.sonJe.ffer.son
PassedGaffud (respelled Gafud)Ga.ffudGa.ffud
PassedGemma (respelled Jema)Ge.mmaGe.mma
Passedummah (respelled uma)u.mmahu.mmah
Passednagko-comment (respelled nagko-coment)nag.ko-co.mmentnag.ko-co.mment
Passedsunna (respelled suna)su.nnasu.nna
PassedHannah (respelled Hana)Ha.nnahHa.nnah
PassedJumu'ah (respelled Jumu7á)Ju.mu.'ahJu.mu.'ah
PassedLhuillier (respelled Lu.ilyér)Lhu.ill.ierLhu.ill.ier
Passedngaun (respelled ngayún)nga.unnga.un
PassedPascual (respelled Pascuwál)Pas.cu.alPas.cu.al
PassedWilliam (respelled William)Will.iamWill.iam
PassedAbby (respelled Aby)A.bbyA.bby
PassedKaaba (respelled Kaba)Kaa.baKaa.ba
PassedFujii (respelled Fuji)Fu.jiiFu.jii
Passedgaan (respelled ga7án)ga.anga.an
Passedkibitser (respelled kíbit.ser)ki.bit.serki.bit.ser
PassedHatsuko (respelled Hat_suko)Ha.tsu.koHa.tsu.ko
PassedKonggo (respelled Konggo)Kong.goKong.go
Passedpag-ibig (respelled pag7ibig)pag-i.bigpag-i.big
Passedbawian ng buhay (respelled bawi7an ng buhay)ba.wi.an ng bu.hayba.wi.an ng bu.hay
Passedbentsingko (respelled bentsingko)ben.tsing.koben.tsing.ko

local tests = require("Module:UnitTests")
local m_tl_pron = require("Module:tl-pronunciation")

local function tag_IPA(IPA)
	return "<span class='IPA'>" .. IPA .. "</span>"
end

local function tag_spelling(spelling)
	return "<code>" .. spelling .. "</code>"
end

local function display_text_and_respelling(text, respelling)
	return ("[[%s#Tagalog|%s]] (respelled %s)"):format(text, text, tag_spelling(respelling))
end

function tests:check_phonetic_ipa(text, expected, respelling)
	self:equals(
		display_text_and_respelling(text, respelling),
		m_tl_pron.IPA(respelling)["phonetic"],
		expected,
		{ display = tag_IPA }
	)
end

function tests:test_phonetic_pron()
	local examples = {
        { "alambre", "ʔɐˈlam.bɾɛ", "alambre" },
        { "asamblea", "ʔɐ.sɐmˈblɛː.ɐ", "asamblea" },
        { "aso", "ˈʔaː.so", "aso" },
        { "atras", "ʔɐt̪ˈɾas", "atrás" },
        { "baboy","ˈbaː.boɪ̯", "baboy" },
		{ "baga","bɐˈɣa", "bagá" },
		{ "baka","ˈbaː.xɐ", "baka" },
		{ "bakante","bɐˈxan̪.t̪ɛ", "bakante" },
        { "bakla","bɐkˈlaʔ", "baklá7" },
        { "banyo","ˈbaː.ɲo", "banyo" },
        { "banyera","bɐˈɲɛː.ɾɐ", "banyera" },
        { "Carlos","ˈkaɾ.los","Carlos"},
        { "Cebu","sɛˈbu","Cebú"}, 
        { "Charlie","ˈt͡ʃaɾ.lɪ", "Charli"},
		{ "dating","d̪ɐˈt̪iŋ", "datíng" },
        { "daw","d̪aʊ̯", "daw" },
		{ "dela Cruz", "d̪ɛˌla ˈkɾus", "delá Cruz" },
		{ "digmaan", "d̪ɪɡˈmaː.ʔɐn̪", "digma7an" }, 
		{ "dila", "ˈd̪iː.lɐʔ", "dilà" }, 
		{ "diyaryo","ˈd͡ʒaɾ.jo", "diyaryo" }, 
		{ "Domingo", "d̪oˈmiŋ.ɡo", "Domin.go"},
        { "Fabian","fɐbˈjan̪", "fabyán" },
        { "futbol", "ˈfut̪.bol", "futbol" },
		{ "hawla","ˈhaʊ̯.lɐ", "hawla" },
		{ "hingal","ˈhiː.ŋɐl", "hingal" }, 
		{ "hingal","hɪˈŋal", "hingál" },
		{ "kongreso", "koŋˈɡɾɛː.so", "kon.greso"},
        { "kontra", "ˈkon̪.t̪ɾɐ", "kontra" },
        { "kontrata", "kon̪ˈt̪ɾaː.t̪ɐ", "kontrata" },
        { "kutsara","kʊˈt͡ʃaː.ɾɐ","kutsara"}, 
		{ "layko","ˈlaɪ̯.xo", "layko" },
		{ "ligalig","lɪˈɣaː.lɪɡ̚","ligalig"},
		{ "luto","ˈluː.t̪oʔ","lutò"},
		{ "luto","lʊˈt̪oʔ","lutô"},
        { "Niña","ˈn̪iː.ɲɐ","Niña"},
        { "pakla","pɐkˈla", "paklá" },
		{ "pinto","pɪn̪ˈt̪oʔ","pintô"},
        { "silindro", "sɪˈlin̪.d̪ɾo", "silindro" },
        { "sino ka", "ˈsiː.n̪o xɐ", "sino ka" },
        { "suklay","sʊkˈlaɪ̯", "sukláy" },
        { "tatsulok","t̪ɐt̪.sʊˈlok̚","tat.sulók"},
		{ "teka","ˈt̪ɛː.xɐ", "teka" },
		{ "tiyak","ˈt͡ʃak̚","tiyák"},
        { "transportasyon", "t̪ɾɐn̪s.poɾ.t̪ɐˈʃon̪", "transportasyón" },
        { "tsiko","ˈt͡ʃiː.xo","tsiko"},
		{ "ulam","ˈʔuː.lɐm","ulam"},
		{ "uminom","ʔʊ.mɪˈn̪om", "uminóm" },
		{ "uwak","ʔʊˈak̚","uwák"},
		{ "yakap", "ˈjaː.xɐp̚", "yakap"},
        { "zigzag","ˈziɡ.zɐɡ̚", "zigzag" },
		{ "kibitser", "ˌkiː.bɪt̪ˈsɛɾ", "kíbit.ser" },
		{ "Hatsuko", "hɐˈt͡suː.xo", "Hat_suko" },
	}
	self:iterate(examples, "check_phonetic_ipa")
end

function tests:check_syllabification(text, expected, respelling)
	self:equals(
		display_text_and_respelling(text, respelling),
		m_tl_pron.syllabify_and_align(respelling, text),
		expected,
		{ display = tag_spelling }
	)
end

function tests:test_syllabification()
	local examples = {
		{ "Allan", "A.llan", "Alan" },
		{ "Mallig", "Mal.lig", "Mal.líg" },
		{ "Mallig", "Ma.llig", "Malíg" },
		{ "Allahu akbar", "A.lla.hu ak.bar", "Alahu akbár" },
		{ "Athanasia", "A.tha.nas.ia", "Atanasya" },
		{ "assalamu alaikum", "a.ssa.la.mu a.lai.kum", "asalamu alaikum" },
		{ "barangay", "ba.ran.gay", "baranggáy" },
		{ "Evangelista", "E.van.ge.lis.ta", "Evanghelista" },
		{ "Bay", "Ba.y", "Ba7ý" },
		{ "Cabiao", "Cab.iao", "Cabyáo" },
		{ "Caguiat", "Cag.uiat", "Caguiát" },
		{ "Cynthia", "Cyn.thi.a", "Cýntiya" },
		{ "Hermogenes", "Her.mo.ge.nes", "Ermóhenes" },
		{ "Abdurahman", "Ab.du.rah.man", "Abduramán" },
		{ "adhan", "a.dhan", "adán" },
		{ "Agatha", "A.ga.tha", "Ágata" },
		{ "Kho", "Kho", "Kó" },
		{ "Zulueta", "Zul.ue.ta", "Zulweta" },
		{ "Aguado", "Ag.ua.do", "Agwado" },
		{ "Buendia", "Bu.en.di.a", "Buendía" },
		{ "Maria", "Ma.ri.a", "María" },
		{ "Arguelles", "Ar.gu.el.les", "Argu.elles" },
		{ "Jefferson", "Je.ffer.son", "Jéferson" },
		{ "Gaffud", "Ga.ffud", "Gafud" },
		{ "Gemma", "Ge.mma", "Jema" },
		{ "ummah", "u.mmah", "uma" },
		{ "nagko-comment", "nag.ko-co.mment", "nagko-coment" },
		{ "sunna", "su.nna", "suna" },
		{ "Hannah", "Ha.nnah", "Hana" },
		{ "Jumu'ah", "Ju.mu.'ah", "Jumu7á" },
		{ "Lhuillier", "Lhu.ill.ier", "Lu.ilyér" },
		{ "ngaun", "nga.un", "ngayún" },
		{ "Pascual", "Pas.cu.al", "Pascuwál" },
		{ "William", "Will.iam", "William" },
		{ "Abby", "A.bby", "Aby" },
		{ "Kaaba", "Kaa.ba", "Kaba" },
		{ "Fujii", "Fu.jii", "Fuji" },
		{ "gaan", "ga.an", "ga7án" },
		{ "kibitser", "ki.bit.ser", "kíbit.ser" },
		{ "Hatsuko", "Ha.tsu.ko", "Hat_suko" },
		{ "Konggo", "Kong.go", "Konggo" },
		{ "pag-ibig", "pag-i.big", "pag7ibig" },
		{ "bawian ng buhay", "ba.wi.an ng bu.hay", "bawi7an ng buhay" },
		{ "bentsingko", "ben.tsing.ko", "bentsingko" },
}
	self:iterate(examples, "check_syllabification")
end

return tests