29 of 126 tests failed. (refresh)

TextExpectedActual
test_to_phonemic:
Passedcàneˈka.neˈka.ne
Passedbèneˈbɛ.neˈbɛ.ne
Passedsónoˈso.noˈso.no
Passedsònoˈsɔ.noˈsɔ.no
Passedhooo
English letter sequences
Passedsmokingˈzmo.kiŋˈzmo.kiŋ
Failedgangsterˈgaŋ.sterˈɡan.ɡster
Passedhòckeyˈɔ.ke.iˈɔ.ke.i
Passedhockeìsticoo.keˈis.ti.koo.keˈis.ti.ko
Passedcrawlkrɔlkrɔl
Failedshòckʃɔkˈʃɔk
PassedOahuoˈa.uoˈa.u
y
Passedyo-yoˈjo.joˈjo.jo
Passedwhiskyˈwis.kiˈwis.ki
x
PassedCraxiˈkrak.siˈkrak.si
-izzare
Passedanalizzarea.na.lidˈd͡za.rea.na.lidˈd͡za.re
Passednazionalizzarenat.t͡sjo.na.lidˈd͡za.renat.t͡sjo.na.lidˈd͡za.re
Passedzonizzare (all z sequences are voiced)d͡zo.nidˈd͡za.red͡zo.nidˈd͡za.re
Passedrizzareritˈt͡sa.reritˈt͡sa.re
c, g, sc
Passedcèloˈt͡ʃɛ.loˈt͡ʃɛ.lo
Passedciaccònat͡ʃakˈkɔ.nat͡ʃakˈkɔ.na
Passedfàccioˈfat.t͡ʃoˈfat.t͡ʃo
Passedchekeke
Passedòcchioˈɔk.kjoˈɔk.kjo
Passedòcchiˈɔk.kiˈɔk.ki
Passedòggiˈɔd.d͡ʒiˈɔd.d͡ʒi
PassedSciàlpiˈʃal.piˈʃal.pi
Passedlasciàrelaʃˈʃa.relaʃˈʃa.re
Passedscleràreskleˈra.reskleˈra.re
Passedùscioˈuʃ.ʃoˈuʃ.ʃo
gn, gl
Passedógniˈoɲ.ɲiˈoɲ.ɲi
Passedgnòccoˈɲɔk.koˈɲɔk.ko
Passedgnagnàɲaɲˈɲaɲaɲˈɲa
Passedvòglioˈvɔʎ.ʎoˈvɔʎ.ʎo
Passedgliʎiʎi
Passedingléseinˈɡle.zeinˈɡle.ze
ng, nq, nch
Passedancheˈan.keˈan.ke
Passeddúnqueˈdun.kweˈdun.kwe
Passedvóngolaˈvon.ɡo.laˈvon.ɡo.la
s
Passedsguardoˈzɡwar.doˈzɡwar.do
Passedsregolatozre.ɡoˈla.tozre.ɡoˈla.to
Passedgira-soled͡ʒi.raˈso.led͡ʒi.raˈso.le
Passeddesìderodeˈzi.de.rodeˈzi.de.ro
z, zz
Passedfòrzaˈfɔr.t͡saˈfɔr.t͡sa
Passedragàzzaraˈɡat.t͡saraˈɡat.t͡sa
Passedmèzzoˈmɛt.t͡soˈmɛt.t͡so
Passedmèzzo (z sequence 1 is voiced)ˈmɛd.d͡zoˈmɛd.d͡zo
Passedzanzara (all z sequences are voiced)d͡zanˈd͡za.rad͡zanˈd͡za.ra
Passednazionenatˈt͡sjo.nenatˈt͡sjo.ne
Passedspazziˈspat.t͡siˈspat.t͡si
Passedzìoˈt͡si.oˈt͡si.o
Passedagenzìaa.d͡ʒenˈt͡si.aa.d͡ʒenˈt͡si.a
Passedgrazieˈɡrat.t͡sjeˈɡrat.t͡sje
Passedazienda (z sequence 1 is voiced)adˈd͡zjen.daadˈd͡zjen.da
Passedromanzière (z sequence 1 is voiced)ro.manˈd͡zjɛ.rero.manˈd͡zjɛ.re
PassedAnzioˈan.t͡sjoˈan.t͡sjo
Failedzàinoˈd͡zai.noˈd͡za.i.no
Passedzampaˈt͡sam.paˈt͡sam.pa
Passedzòccoloˈt͡sɔk.ko.loˈt͡sɔk.ko.lo
Passedzùfoloˈt͡su.fo.loˈt͡su.fo.lo
Passedzàffiro (z sequence 1 is voiced)ˈd͡zaf.fi.roˈd͡zaf.fi.ro
Failedzèbraˈd͡zɛ.braˈt͡sɛb.ra
Failedzuzzurelloned͡zud.d͡zu.relˈlo.net͡sut.t͡su.relˈlo.ne
Passedzannaˈt͡san.naˈt͡san.na
Passedziganot͡siˈɡa.not͡siˈɡa.no
Passedspazîˈspat.t͡siˈspat.t͡si
Passedozòno (all z sequences are voiced)odˈd͡zɔ.noodˈd͡zɔ.no
semivowels
Passedquélloˈkwel.loˈkwel.lo
Passedgrànchioˈɡran.kjoˈɡran.kjo
Failedcapiènzakaˈpjɛn.t͡sakapˈjɛn.t͡sa
Passedniènteˈnjɛn.teˈnjɛn.te
Passedsùoˈsu.oˈsu.o
Passedpuòˈpwɔˈpwɔ
Passednuòvoˈnwɔ.voˈnwɔ.vo
Passeddevi-arede.viˈa.rede.viˈa.re
Handling of words without accents
Passedsonoˈso.noˈso.no
Passedcaneˈka.neˈka.ne
Passedcartaˈkar.taˈkar.ta
Syllabification
Failedsottosvilluposot.to.zvilˈlu.posot.toz.vilˈlu.po
Failedmanùbriomaˈnu.brjomaˈnub.rjo
TextExpectedActual
test_to_phonetic:
Failedcàneˈkäː.n̺e̞ˈkäː.n̺e
Passedbèneˈbɛː.n̺eˈbɛː.n̺e
Failedsónoˈs̪oː.n̺oˈsoː.n̺o
Failedsònoˈs̪ɔː.n̺oˈsɔː.n̺o
English letter sequences
y
x
-izzare
c, g, sc
Passedcèloˈt͡ʃɛː.loˈt͡ʃɛː.lo
Passedciaccònat͡ʃäkˈkɔː.n̺ät͡ʃäkˈkɔː.n̺ä
Failedfàccioˈfät͡ʃ.t͡ʃoˈfät.t͡ʃo
Passedchek̟ek̟e
Failedòcchioˈɔk̟.k̟joˈɔk.k̟jo
Failedòcchiˈɔk̟.k̟iˈɔk.k̟i
Failedòggiˈɔd͡ʒ.d͡ʒiˈɔd.d͡ʒi
PassedSciàlpiˈʃäl.piˈʃäl.pi
Failedlasciàreläʃˈʃäː.r̺e̞läʃˈʃäː.re
Failedscleràres̪kleˈr̺äː.r̺e̞skleˈräː.re
Passedùscioˈuʃ.ʃoˈuʃ.ʃo
gn, gl
Passedógniˈoɲ.ɲiˈoɲ.ɲi
Passedgnòccoˈɲɔk.koˈɲɔk.ko
Passedgnagnàɲäɲˈɲäɲäɲˈɲä
Passedvòglioˈvɔʎ.ʎoˈvɔʎ.ʎo
Passedgliʎiʎi
Failedingléseiŋˈɡleː.z̪eiŋˈɡleː.ze
ng, nq, nch
Passedancheˈäŋ.k̟eˈäŋ.k̟e
Passeddúnqueˈduŋ.kweˈduŋ.kwe
Passedvóngolaˈvoŋ.ɡo.läˈvoŋ.ɡo.lä
s
Passedsguardoˈzɡwär.doˈzɡwär.do
Passedsregolatozre.ɡoˈläː.tozre.ɡoˈläː.to
z, zz
Failedfòrzaˈfɔr̺.t̪͡s̪äˈfɔr.t͡sä
Failedragàzzar̺äˈɡät̪͡s̪.t̪͡s̪äräˈɡät.t͡sä
Failedmèzzoˈmɛt̪͡s̪.t̪͡s̪oˈmɛt.t͡so
Failedmèzzo (z sequence 1 is voiced)ˈmɛd̪͡z̪.d̪͡z̪oˈmɛd.d͡zo
Failedzanzara (all z sequences are voiced)d̪͡z̪änˈd̪͡z̪äː.r̺äd͡zän̺ˈd͡zäː.rä
Passednazionen̺ätˈt͡sjoː.n̺en̺ätˈt͡sjoː.n̺e
Passedspazziˈspät.t͡siˈspät.t͡si
Passedspazîˈspät.t͡siˈspät.t͡si
semivowels
Passedquélloˈkwel.loˈkwel.lo
Passedgrànchioˈɡräŋ.k̟joˈɡräŋ.k̟jo
Failedcapiènzakäˈpjɛn̺.t͡säkäpˈjɛn̺.t͡sä
Failedniènteˈnjɛn̪.t̪eˈn̺jɛn̺.te
Passedsùoˈsuː.oˈsuː.o
Passedpuòˈpwɔˈpwɔ
Passednuòvoˈn̺wɔː.voˈn̺wɔː.vo
Handling of words without accents
Passedsonoˈsoː.n̺oˈsoː.n̺o
Failedcaneˈkäː.n̺e̞ˈkäː.n̺e
Failedcartaˈkär̺.t̪äˈkär.tä
Syllabification
Failedsottosvilluposot.to.zvilˈluː.posot.toz.vilˈluː.po
Failedmanùbriomäˈn̺u.brjomäˈn̺ub.rjo

local tests = require "Module:UnitTests"

setmetatable(_G, { __index = require "Module:it-pronunciation/sandbox" })

local function tag_IPA(transcription)
	if transcription:find "^Error" then
		return transcription
	else
		return '<span class="IPA">' .. transcription .. '</span>'
	end
end

local examples = {
	{ "càne", "ˈka.ne", "ˈkäː.n̺e̞" },
	{ "bène", "ˈbɛ.ne", "ˈbɛː.n̺e" },
	{ "sóno", "ˈso.no", "ˈs̪oː.n̺o" },
	{ "sòno", "ˈsɔ.no", "ˈs̪ɔː.n̺o" },
	{ "ho", "o", "" },
	"English letter sequences",
	{ "smoking", "ˈzmo.kiŋ", "" },
	{ "gangster", "ˈgaŋ.ster", "" },
	{ "hòckey", "ˈɔ.ke.i", "" },
	{ "hockeìstico", "o.keˈis.ti.ko", "" },
	{ "crawl", "krɔl", "" },
	{ "shòck", "ʃɔk", "" },
	{"Oahu", "oˈa.u", ""},
	"y",
	{ "yo-yo", "ˈjo.jo", "" },
	{ "whisky", "ˈwis.ki", "" },
	"x",
	{ "Craxi", "ˈkrak.si", "" },
	"-izzare",
	{ "analizzare", "a.na.lidˈd͡za.re", ""},
	{ "nazionalizzare", "nat.t͡sjo.na.lidˈd͡za.re", "" },
	{ "zonizzare", "d͡zo.nidˈd͡za.re", "", true },
	{ "rizzare", "ritˈt͡sa.re", ""},
	"c, g, sc",
	{ "cèlo", "ˈt͡ʃɛ.lo", "ˈt͡ʃɛː.lo" },
	{ "ciaccòna", "t͡ʃakˈkɔ.na", "t͡ʃäkˈkɔː.n̺ä" },
	{ "fàccio", "ˈfat.t͡ʃo", "ˈfät͡ʃ.t͡ʃo" }, -- ˈfat.t͡ʃo is too phonetic; other alternative, ˈfa.t͡ʃːo
	{ "che", "ke", "k̟e" },
	{ "òcchio", "ˈɔk.kjo", "ˈɔk̟.k̟jo" }, -- Good test for syllabification.
	{ "òcchi", "ˈɔk.ki", "ˈɔk̟.k̟i" },
	{ "òggi", "ˈɔd.d͡ʒi", "ˈɔd͡ʒ.d͡ʒi" }, -- ˈɔd.d͡ʒi is too phonetic; other alternative, ˈɔ.d͡ʒːi 
	{ "Sciàlpi", "ˈʃal.pi", "ˈʃäl.pi" },
	{ "lasciàre", "laʃˈʃa.re", "läʃˈʃäː.r̺e̞" },
	{ "scleràre", "skleˈra.re", "s̪kleˈr̺äː.r̺e̞" },
	{ "ùscio", "ˈuʃ.ʃo", "ˈuʃ.ʃo" },
	"gn, gl",
	{ "ógni", "ˈoɲ.ɲi", "ˈoɲ.ɲi" },
	{ "gnòcco", "ˈɲɔk.ko", "ˈɲɔk.ko" },
	{ "gnagnà", "ɲaɲˈɲa", "ɲäɲˈɲä" }, -- probably not a real word
	{ "vòglio", "ˈvɔʎ.ʎo", "ˈvɔʎ.ʎo" },
	{ "gli", "ʎi", "ʎi" },
	{ "inglése", "inˈɡle.ze", "iŋˈɡleː.z̪e" },
	"ng, nq, nch",
	{ "anche", "ˈan.ke", "ˈäŋ.k̟e" },
	{ "dúnque", "ˈdun.kwe", "ˈduŋ.kwe"  },
	{ "vóngola", "ˈvon.ɡo.la", "ˈvoŋ.ɡo.lä" }, 
	"s",
	{ "sguardo", "ˈzɡwar.do", "ˈzɡwär.do" },
	{ "sregolato", "zre.ɡoˈla.to", "zre.ɡoˈläː.to" },
	{ "gira-sole", "d͡ʒi.raˈso.le", "" },
	{ "desìdero", "deˈzi.de.ro", "" },
	"z, zz",
	{ "fòrza", "ˈfɔr.t͡sa", "ˈfɔr̺.t̪͡s̪ä" },
	{ "ragàzza", "raˈɡat.t͡sa", "r̺äˈɡät̪͡s̪.t̪͡s̪ä" },
	{ "mèzzo", "ˈmɛt.t͡so", "ˈmɛt̪͡s̪.t̪͡s̪o" },
	{ "mèzzo", "ˈmɛd.d͡zo", "ˈmɛd̪͡z̪.d̪͡z̪o", { 1 } },
	{ "zanzara", "d͡zanˈd͡za.ra", "d̪͡z̪änˈd̪͡z̪äː.r̺ä", true },
	-- [[w:Italian orthography]] says the z is geminate, while the English
	-- and Italian Wiktionaries say it isn't. It sounds geminate in the soundfile.
	{ "nazione", "natˈt͡sjo.ne" , "n̺ätˈt͡sjoː.n̺e" },
	{ "spazzi", "ˈspat.t͡si", "ˈspät.t͡si" },
	{ "zìo", "ˈt͡si.o", "" },
	{ "agenzìa", "a.d͡ʒenˈt͡si.a", "" },
	{ "grazie", "ˈɡrat.t͡sje", "" },
	{ "azienda", "adˈd͡zjen.da", "", { 1 } },
	{ "romanzière", "ro.manˈd͡zjɛ.re", "",  { 1 } },
	{ "Anzio", "ˈan.t͡sjo", ""},
	
	-- initial z followed by two vowels is usually voiced
	{ "zàino", "ˈd͡zai.no", "" },
	
	-- initial z followed by syllable beginning in voiceless consonant is usually voiceless
	{ "zampa", "ˈt͡sam.pa", "" },
	{ "zòccolo", "ˈt͡sɔk.ko.lo", "" },
	{ "zùfolo", "ˈt͡su.fo.lo", "" },
	-- exceptions
	{ "zàffiro", "ˈd͡zaf.fi.ro", "", { 1 } },
	
	-- initial z followed by syllable beginning in voiced consonant is usually voiced
	{ "zèbra", "ˈd͡zɛ.bra", "" },
	{ "zuzzurellone", "d͡zud.d͡zu.relˈlo.ne", "" },
	-- exceptions
	{ "zanna", "ˈt͡san.na", "" },
	{ "zigano", "t͡siˈɡa.no", "" },
	
	-- intervocalic "autogeminazione" [[w:it:Autogeminazione]]
	{ "spazî", "ˈspat.t͡si", "ˈspät.t͡si" },
	{ "ozòno", "odˈd͡zɔ.no", "", true },
	"semivowels",
	{ "quéllo", "ˈkwel.lo", "ˈkwel.lo" },
	{ "grànchio", "ˈɡran.kjo", "ˈɡräŋ.k̟jo" },
	{ "capiènza", "kaˈpjɛn.t͡sa", "käˈpjɛn̺.t͡sä" },
	{ "niènte", "ˈnjɛn.te", "ˈnjɛn̪.t̪e" }, -- or [n̺ʲ-]?
	{ "sùo", "ˈsu.o", "ˈsuː.o" },
	{ "può", "ˈpwɔ", "ˈpwɔ" },
	{ "nuòvo", "ˈnwɔ.vo", "ˈn̺wɔː.vo" },
	{ "devi-are", "de.viˈa.re", "" },
	"Handling of words without accents",
	{ "sono", "ˈso.no", "ˈsoː.n̺o" },
	{ "cane", "ˈka.ne", "ˈkäː.n̺e̞" },
	{ "carta", "ˈkar.ta", "ˈkär̺.t̪ä" },
	"Syllabification",
	{ "sottosvillupo", "sot.to.zvilˈlu.po", "sot.to.zvilˈluː.po" },
	{ "manùbrio", "maˈnu.brjo", "mäˈn̺u.brjo" } -- Is u long here?
	
	--[[
	-- For new examples:
	{ "", "", "" },
	-- respelling, phonemic, phonetic
	]]
}

function tests:test_to_phonemic()
	self:iterate(examples,
		function (self, example, expected, _, voiced_z)
			local success, result = pcall(to_phonemic, example, voiced_z)
			if not success then
				result = ("Error: %s"):format(result)
			end
			
			local voiced_text
			if not voiced_z then
				voiced_text = ""
			elseif type(voiced_z) == "boolean" then
				if voiced_z then
					voiced_text = " (all z sequences are voiced)"
				else
					voiced_text = " (no z sequences are voiced)"
				end
			else
				voiced_text = (" (z sequence%s %s %s voiced)"):format(
					voiced_z[2] and "s" or "",
					table.concat(voiced_z, ", "),
					voiced_z[2] and "are" or "is")
			end
			
			self:equals(example .. voiced_text, result, expected, { display = tag_IPA })
		end)
end

function tests:test_to_phonetic()
	self:iterate(examples,
		function (self, example, _, expected, voiced_z)
			if expected == "" then
				return
			end
			
			local success, result = pcall(to_phonetic, example, voiced_z)
			if not success then
				result = ("Error: %s"):format(result)
			end
			
			local voiced_text
			if not voiced_z then
				voiced_text = ""
			elseif type(voiced_z) == "boolean" then
				if voiced_z then
					voiced_text = " (all z sequences are voiced)"
				else
					voiced_text = " (no z sequences are voiced)"
				end
			else
				mw.logObject(voiced_z, "voiced_z")
				voiced_text = (" (z sequence%s %s %s voiced)"):format(
					voiced_z[2] and "s" or "",
					table.concat(voiced_z, ", "),
					voiced_z[2] and "are" or "is")
			end
			
			self:equals(example .. voiced_text, result, expected, { display = tag_IPA })
		end)
end

return tests
"https://si.wiktionary.org/w/index.php?title=Module:it-pronunciation/sandbox/testcases&oldid=168740" වෙතින් සම්ප්‍රවේශනය කෙරිණි