Module:es-pronunc/testcases

local tests = require('Module:UnitTests') local m_es_pron = require('Module:es-pronunc') local m_links = require('Module:links') local es = require('Module:languages').getByCode('es')

local function tag_IPA(IPA) return ' ' .. IPA .. ' ' end

local function link(text) return m_links.full_link{ term = text, lang = es } end

local options = { display = tag_IPA }

local function check_ipa(self, word, phonetic, expected_Cast, expected_Lat, comment) local Castilian = m_es_pron.IPA(word, "distincion-yeismo", phonetic).text local Latin_American = m_es_pron.IPA(word, "seseo-yeismo", phonetic).text local show_both = Latin_American ~= Castilian options.comment = show_both and 'Castilian' .. (comment or '') or comment self:equals(		link(word),		Castilian,		expected_Cast,		options	) if show_both then options.comment = show_both and 'Latin American' .. (comment or '') or comment self:equals(			link(word),			Latin_American,			expected_Lat,			options		) end end

function tests:check_phonetic_ipa(word, expected_Cast, expected_Lat, comment) check_ipa(self, word, true, expected_Cast, expected_Lat, comment) end

function tests:check_phonemic_ipa(word, expected_Cast, expected_Lat, comment) check_ipa(self, word, false, expected_Cast, expected_Lat, comment) end

function tests:test_phonetic_pron local examples = { { 'ununquadio', 'u.nũŋˈkwa.ð̞jo' }, { 'explícale', 'eɣ̞sˈpli.ka.le' }, { 'deshielo', 'd̪ezˈʝe.lo' }, { 'porque', 'ˈpoɾ.ke' }, { 'fármaco', 'ˈfaɾ.ma.ko' }, { 'prorrogado', 'pɾo.roˈɣ̞a.ð̞o'}, { 'cabrerizo', 'ka.β̞ɾeˈɾi.θo', 'ka.β̞ɾeˈɾi.so'}, { 'desmentir', 'd̪ez.mẽn̪ˈt̪iɾ'}, { 'desahucio', 'd̪eˈsau̯.θjo', 'd̪eˈsau̯.sjo'}, { 'estoy', 'esˈt̪oi̯'}, { 'complots', 'kõmˈplot̪s'}, { 'relax', 'reˈlaɣ̞s'}, 'stop–sonorant clusters', { 'cigüeña', 'θiˈɣ̞we.ɲa', 'siˈɣ̞we.ɲa' }, 'voiceless fricatives before voiced consonants', -- sometimes assimilated { 'desde', 'ˈd̪ez.ð̞e' }, { 'rasgo', 'ˈraz.ɣ̞o' }, { 'mismo', 'ˈmiz.mo' }, { 'isla', 'ˈis.la' }, { 'hazlo', 'ˈaθ.lo', 'ˈas.lo' }, { 'hazme', 'ˈaθ̬.me', 'ˈaz.me' }, { 'afluir', 'aˈflwiɾ' }, -- or afluˈiɾ { 'flauta', 'ˈflau̯.t̪a', }, { 'África', 'ˈa.fɾi.ka'}, { 'frígido', 'ˈfɾi.xi.ð̞o'}, 'voiced stop–fricative allophony', { 'baca', 'ˈba.ka' }, { 'la baca', 'la ˈβ̞a.ka' }, { 'enviar', 'ẽmˈbjaɾ' }, { 'dama', 'ˈd̪a.ma' }, { 'la dama', 'la ˈð̞a.ma' }, { 'nada', 'ˈna.ð̞a' }, { 'sabiendo', 'saˈβ̞jẽn̪.d̪o' }, { 'hiena', 'ˈɟ͡ʝe.na' }, { 'la hiena', 'la ˈʝe.na' }, { 'yaca', 'ˈɟ͡ʝa.ka' }, { 'la yaca', 'la ˈʝa.ka' }, { 'cónyuge', 'ˈkõɲ.ɟ͡ʝu.xe' }, { 'guerra', 'ˈɡe.ra' }, { 'la guerra', 'la ˈɣ̞e.ra' }, { 'Domingo', 'd̪oˈmĩŋ.ɡo' }, { 'alba', 'ˈal.β̞a' }, { 'soldado', 'sol̪ˈd̪a.ð̞o' }, { 'algo', 'ˈal.ɣ̞o' }, "l-assimilation", { 'chile', 'ˈt͡ʃi.le' }, { 'el chile', 'elʲ ˈt͡ʃi.le' }, { 'dulce', 'ˈd̪ul̟.θe', 'ˈd̪ul.se' }, { 'vuelta', 'ˈbwel̪.t̪a' }, "n-assimilation", -- example of 'n y', 'n hi', 'n ll'? { 'infierno', 'ĩɱˈfjeɾ.no' }, { 'entonces', 'ẽn̪ˈt̪õn̟.θes', 'ẽn̪ˈt̪õn.ses' }, { 'ancho', 'ˈãnʲ.t͡ʃo' }, { 'tengo', 'ˈt̪ẽŋ.ɡo' }, { 'ángel', 'ˈãŋ.xel' }, { 'nunca', 'ˈnũŋ.ka' }, 'obstruent (stop and fricative) clusters', { 'capturar', 'kaβ̞.t̪uˈɾaɾ' }, { 'abyecto', 'aβ̞ˈʝeɣ̞.t̪o' }, { 'accidental', 'aɣ̞.θi.ð̞ẽn̪ˈt̪al', 'aɣ̞.si.ð̞ẽn̪ˈt̪al' }, { 'susceptible', 'sus.θeβ̞ˈt̪i.β̞le', 'su.seβ̞ˈt̪i.β̞le' }, }

self:iterate(examples, "check_phonetic_ipa") end

return tests