Module:snon-common: Difference between revisions

From Linguifex
Jump to navigation Jump to search
Melinoë (talk | contribs)
Created page with "local export = {} local eclipsis_prefixes = { ["b"] = "m", ["c"] = "g", ["d"] = "n", ["f"] = "v", ["g"] = "n", ["p"] = "b", ["t"] = "d", ["ph"] = "bh", } function export.mutations(word, tag) local ret = {normal = word, len = word, ecl = word, an = word, hpro = word} local word_l = mw.ustring.lower(word) if tag ~= "nolen" then if mw.ustring.find(word_l, "^[bcdfgmpt]") then ret.len = mw.ustring.gsub(word, "^(.)", "%1h") elseif mw.ustring.find(word_l..."
 
Melinoë (talk | contribs)
No edit summary
Line 10: Line 10:
["t"] = "d",
["t"] = "d",
["ph"] = "bh",
["ph"] = "bh",
["h"] = "nh",
["s"] = "z",
["ch"] = "gh",
}
}



Revision as of 02:19, 23 April 2026

Documentation for this module may be created at Module:snon-common/doc

local export = {}

local eclipsis_prefixes = {
	["b"] = "m",
	["c"] = "g",
	["d"] = "n",
	["f"] = "v",
	["g"] = "n",
	["p"] = "b",
	["t"] = "d",
	["ph"] = "bh",
	["h"] = "nh",
	["s"] = "z",
	["ch"] = "gh",
}

function export.mutations(word, tag)
	local ret = {normal = word, len = word, ecl = word, an = word, hpro = word}
	
	local word_l = mw.ustring.lower(word)
	
	if tag ~= "nolen" then
		if mw.ustring.find(word_l, "^[bcdfgmpt]") then
			ret.len = mw.ustring.gsub(word, "^(.)", "%1h")
		elseif mw.ustring.find(word_l, "^s[aeiouàèìòùlnr]") then
			ret.len = mw.ustring.gsub(word, "^(.)", "%1h")
			ret.an = "t" .. word
		elseif mw.ustring.find(word_l, "^[h]") then
			ret.len = mw.ustring.gsub(word, "^(.)", "g%1")
		end
	end
	
	if eclipsis_prefixes[mw.ustring.sub(word_l, 1, 1)] then
		ret.ecl = eclipsis_prefixes[mw.ustring.sub(word_l, 1, 1)] .. word
	end
	
	if mw.ustring.find(word, "^[aeiouàèìòù]") then
		ret.ecl  = "n-" .. word
		ret.hpro = "h-" .. word
		
	elseif mw.ustring.find(word, "^[AEIOUÀÈÌÒÙ]") then
		ret.ecl  = "n" .. word
		ret.hpro = "h" .. word
	end
	
	return ret
end

return export