Jump to content

Module:id-pronunciation/testcases

From Wiktionary, the free dictionary

4 of 36 tests failed. (refresh)

TextExpectedActual
test_phonetic_pron:
Passedair (respelled air)ˈa.ɪrˈa.ɪr
PassedAlqur'an (respelled Alkur.ān)al.kurˈanal.kurˈan
Passedanjing (respelled anjing)ˈan.d͡ʒɪŋˈan.d͡ʒɪŋ
PassedCileunyi (respelled Cilenyi)ˈt͡ʃi.lə.ɲiˈt͡ʃi.lə.ɲi
Passedcuci (respelled cuci)ˈt͡ʃu.t͡ʃiˈt͡ʃu.t͡ʃi
Passeddaerah (respelled daèrah)daˈɛ.rahdaˈɛ.rah
Passeddakwa (respelled daqwa)ˈdaʔ.waˈdaʔ.wa
Passeddatang (respelled datang)ˈda.t̪aŋˈda.t̪aŋ
FailedFebruari (respelled Fèbruari)fɛpruˈa.rifɛp̚.ruˈa.ri
Passedgajah (respelled gajah)ˈɡa.d͡ʒahˈɡa.d͡ʒah
Passedgelak (respelled gelaq)ɡəˈlaʔɡəˈlaʔ
Passedgereja (respelled gerèja)ɡəˈrɛ.d͡ʒaɡəˈrɛ.d͡ʒa
Passedgong (respelled gong)ˈɡoŋˈɡoŋ
Passedgunung (respelled gunung)ˈɡu.nʊŋˈɡu.nʊŋ
Passedhijau (respelled hijau)ˈhi.d͡ʒau̯ˈhi.d͡ʒau̯
Passedkhidmat (respelled khidmat)ˈxit̪̚.mat̪̚ˈxit̪̚.mat̪̚
Failedinstan (respelled instan)in.stanˈins.t̪an
Passedlaut (respelled laut)ˈla.ʊt̪̚ˈla.ʊt̪̚
FailedLhokseumawe (respelled Lòkseumawè)lɔk̚.səˈma.wɛlɔk̚.sə.uˈma.wɛ
Passednasionalisme (respelled nasionalisme)na.si.o.naˈlis.məna.si.o.naˈlis.mə
Passednikmat (respelled niqmat)ˈniʔ.mat̪̚ˈniʔ.mat̪̚
Failed-nya (respelled -nya)ɲaˈɲa
Passedpakaian (respelled pakaian)paˈka.janpaˈka.jan
Passedpantai (respelled pantai)ˈpan.t̪ai̯ˈpan.t̪ai̯
Passedpraktik (respelled praktik)ˈprak̚.t̪ɪk̚ˈprak̚.t̪ɪk̚
Passedpria (respelled pria)ˈpri.aˈpri.a
Passedprovinsi (respelled provinsi)proˈfin.siproˈfin.si
Passedpulau (respelled pulau)ˈpu.lau̯ˈpu.lau̯
Passedrakyat (respelled raqyat)ˈraʔ.jat̪̚ˈraʔ.jat̪̚
Passedselamat (respelled selamat)səˈla.mat̪̚səˈla.mat̪̚
Passedseumpama (respelled seumpama)sə.umˈpa.masə.umˈpa.ma
Passedsiomay (respelled siomay)siˈo.mai̯siˈo.mai̯
Passedsyarat (respelled syarat)ˈʃa.rat̪̚ˈʃa.rat̪̚
Passedtelur (respelled telur)t̪əˈlʊrt̪əˈlʊr
Passedtidak (respelled tidaq)ˈt̪i.daʔˈt̪i.daʔ
PassedTionghoa (respelled Tionghoa)t̪i.oŋˈho.at̪i.oŋˈho.a

local tests = require("Module:UnitTests")
local m_id_pron = require("Module:id-pronunciation")

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

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

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

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

function tests:test_phonetic_pron()
	local examples = {
        { "air", "ˈa.ɪr", "air" },
		{ "Alqur'an", "al.kurˈan", "Alkur.ān"},
        { "anjing", "ˈan.d͡ʒɪŋ", "anjing" },
        { "Cileunyi", "ˈt͡ʃi.lə.ɲi", "Cilenyi" },
        { "cuci","ˈt͡ʃu.t͡ʃi", "cuci"},
		{ "daerah","daˈɛ.rah", "daèrah" },
		{ "dakwa", "ˈdaʔ.wa", "daqwa"},
		{ "datang","ˈda.t̪aŋ", "datang" },
        { "Februari","fɛpruˈa.ri", "Fèbruari" },
        { "gajah", "ˈɡa.d͡ʒah", "gajah" },
		{ "gelak", "ɡəˈlaʔ", "gelaq"},
		{ "gereja","ɡəˈrɛ.d͡ʒa", "gerèja" },
		{ "gong","ˈɡoŋ", "gong" },
		{ "gunung","ˈɡu.nʊŋ", "gunung" },
        { "hijau","ˈhi.d͡ʒau̯", "hijau" },
		{ "khidmat", "ˈxit̪̚.mat̪̚", "khidmat"},
      	{ "instan", "in.stan", "instan"},
        { "laut", "ˈla.ʊt̪̚", "laut" },
        { "Lhokseumawe", "lɔk̚.səˈma.wɛ", "Lòkseumawè" },
        { "nasionalisme", "na.si.o.naˈlis.mə", "nasionalisme" },
        { "nikmat", "ˈniʔ.mat̪̚", "niqmat" },
        { "-nya","ɲa", "-nya" },
        { "pakaian","paˈka.jan", "pakaian" },
        { "pantai", "ˈpan.t̪ai̯", "pantai" },
        { "praktik", "ˈprak̚.t̪ɪk̚",	"praktik" },
		{ "pria", "ˈpri.a", "pria"},
		{ "provinsi", "proˈfin.si", "provinsi"},
        { "pulau", "ˈpu.lau̯", "pulau" },
		{ "rakyat", "ˈraʔ.jat̪̚", "raqyat"},
		{ "selamat", "səˈla.mat̪̚", "selamat"},
		{ "seumpama", "sə.umˈpa.ma", "seumpama"},
	
		{ "siomay", "siˈo.mai̯", "siomay"},
		{ "syarat", "ˈʃa.rat̪̚", "syarat"},
		{ "telur", "t̪əˈlʊr", "telur"},
		{ "tidak", "ˈt̪i.daʔ", "tidaq"},
		{ "Tionghoa", "t̪i.oŋˈho.a", "Tionghoa"},
	}
	self:iterate(examples, "check_phonetic_ipa")
end

return tests