La documentation pour ce module peut être créée à Module:cy-mutation/Documentation

local p={}

function p.mutations(mot)
	local lns = { -- lénition, nasalisation, spirantisation
		['b'] = {"f", "m", "b"},
		['c'] = {"g", "ngh", "ch",},
		['ch'] = {"ch", "ch", "ch"},
		['d'] = {"dd", "n", "d"},
		['f'] = {"f", "f", "f"},
		['g'] = {"", "ng", "g"},
		['h'] = {"h", "h", "h"},
		['j'] = {"j", "j", "j"},
		['l'] = {"l", "l", "l"},
		['ll'] = {"l", "ll", "ll"},
		['m'] = {"f", "m", "m"},
		['n'] = {"n", "n", "n"},
		['p'] = {"b", "mh", "ph"},
		['r'] = {"r", "r", "r"},
		['rh'] = {"r", "rh", "rh"},
		['s'] = {"s", "s", "s"},
		['t'] = {"d", "nh", "th"},
		['-'] = {"-", "-", "-"}
	}
	initiale = mw.ustring.sub(mot,1,1)
	estMajuscule = mw.ustring.lower(initiale) ~= initiale
	initiale = mw.ustring.lower(initiale)
	fin = mw.ustring.sub(mot,2)
	local lenition       = ""
	local nasalisation   = ""
	local spirantisation = ""
	local protheseH      = ""
	if mw.ustring.match(initiale,'[aâeêiîoôuûwŵyŷ]') then
		lenition       = initiale .. fin
		nasalisation   = initiale .. fin
		spirantisation = initiale .. fin
		protheseH      = 'h' .. initiale .. fin
	else
		deuxPremieres = initiale .. mw.ustring.sub(mot,2,2)
		if deuxPremieres=='ll' or deuxPremieres=='rh' or deuxPremieres=='ch' then
			initiale = deuxPremieres
			fin = mw.ustring.sub(mot,3)
		end	
		lenition       = lns[initiale][1] .. fin
		nasalisation   = lns[initiale][2] .. fin
		spirantisation = lns[initiale][3] .. fin
		protheseH      = initiale .. fin
    end
	if estMajuscule then
		lenition = mw.ustring.upper(mw.ustring.sub(lenition,1,1)) .. mw.ustring.sub(lenition,2)
		nasalisation = mw.ustring.upper(mw.ustring.sub(nasalisation,1,1)) .. mw.ustring.sub(nasalisation,2)
		spirantisation = mw.ustring.upper(mw.ustring.sub(spirantisation,1,1)) .. mw.ustring.sub(spirantisation,2)
		protheseH = mw.ustring.upper(mw.ustring.sub(protheseH,1,1)) .. mw.ustring.sub(protheseH,2)
	end
	return lenition, nasalisation, spirantisation, protheseH
end

return p