Module:snon-common: Difference between revisions

From Linguifex
Jump to navigation Jump to search
Melinoë (talk | contribs)
No edit summary
Melinoë (talk | contribs)
No edit summary
 
(23 intermediate revisions by the same user not shown)
Line 22: Line 22:
if mw.ustring.find(word_l, "^[bcdfgmptsnlrv]") then
if mw.ustring.find(word_l, "^[bcdfgmptsnlrv]") then
ret.len = mw.ustring.gsub(word, "^(.)", "%1h")
ret.len = mw.ustring.gsub(word, "^(.)", "%1h")
elseif mw.ustring.find(word_l, "^ghi[aeiouàèìòù]") then
ret.len = mw.ustring.gsub(word, "^chi", "%1")
elseif mw.ustring.find(word_l, "^[h]") then
elseif mw.ustring.find(word_l, "^[h]") then
ret.len = mw.ustring.gsub(word, "^(.)", "g%1")
ret.len = mw.ustring.gsub(word, "^(.)", "g%1")
elseif mw.ustring.find(word_l, "^-[bcdfgmptsnlrv]") then
elseif mw.ustring.find(word_l, "^-[bcdfgmptsnlrv]") then
ret.len = mw.ustring.gsub(word, "^(.)", "%1h")
ret.len = mw.ustring.gsub(word, "^(..)", "%1h")
end
end
end
Line 43: Line 40:
ret.hpro = "gh" .. word
ret.hpro = "gh" .. word
elseif mw.ustring.find(word_l, "^[ghi]") then
elseif mw.ustring.find(word, "^ghi[aeiouàèìòù]") then
ret.ecl = mw.ustring.gsub(word, "^(.)", "ni")
ret.ecl = mw.ustring.gsub(word, "^(...)", "ni")
ret.len = mw.ustring.gsub(word, "^(...)", "chi")
end
if mw.ustring.find(word_l, "^-[f]") then
ret.ecl = mw.ustring.gsub(word, "^(..)", "-vf")
--ret.len = mw.ustring.gsub(word, "^(..)", "-h")
elseif mw.ustring.find(word_l, "^-[v]") then
ret.ecl = mw.ustring.gsub(word, "^(..)", "-vb")
--ret.len = mw.ustring.gsub(word, "^(..)","-gh")
elseif mw.ustring.find(word_l, "-^[p]") then
ret.ecl = mw.ustring.gsub(word, "^(..)", "-bp")
--ret.len = mw.ustring.gsub(word, "^(..)", "-f")
elseif mw.ustring.find(word_l, "^-[b]") then
ret.ecl = mw.ustring.gsub(word, "^(..)", "-mb")
--ret.len = mw.ustring.gsub(word, "^(..)", "-v")
elseif mw.ustring.find(word_l, "^-[s]") then
ret.ecl = mw.ustring.gsub(word, "^(..)", "-zs")
--ret.len = mw.ustring.gsub(word, "^(..)", "-h")
elseif mw.ustring.find(word_l, "^-[z]") then
ret.ecl = mw.ustring.gsub(word, "^(..)", "-dz")
elseif mw.ustring.find(word_l, "^-[t]") then
ret.ecl = mw.ustring.gsub(word, "^(..)", "-dt")
elseif mw.ustring.find(word_l, "^-[d]") then
ret.ecl = mw.ustring.gsub(word, "^(..)", "-nd")
elseif mw.ustring.find(word_l, "^-[g]") then
ret.ecl = mw.ustring.gsub(word, "^(..)", "-ng")
elseif mw.ustring.find(word_l, "^-[h]") then
ret.ecl = mw.ustring.gsub(word, "^(..)", "-nh")
elseif mw.ustring.find(word_l, "^-[c]") then
ret.ecl = mw.ustring.gsub(word, "^(..)", "-gc")
end
end
end

Latest revision as of 22:26, 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",
	["h"] = "n",
	["s"] = "z",
	["v"] = "b",
}

function export.mutations(word, tag)
	local ret = {normal = word, len = word, ecl = word, hpro = word}
	
	local word_l = mw.ustring.lower(word)
	
	if tag ~= "nolen" then
		if mw.ustring.find(word_l, "^[bcdfgmptsnlrv]") then
			ret.len = mw.ustring.gsub(word, "^(.)", "%1h")
		elseif mw.ustring.find(word_l, "^[h]") then
			ret.len = mw.ustring.gsub(word, "^(.)", "g%1")
		elseif mw.ustring.find(word_l, "^-[bcdfgmptsnlrv]") then
			ret.len = mw.ustring.gsub(word, "^(..)", "%1h")
	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 = "gh'" .. word
		
	elseif mw.ustring.find(word, "^[AEIOUÀÈÌÒÙ]") then
		ret.ecl  = "n" .. word
		ret.hpro = "gh" .. word
		
	 elseif mw.ustring.find(word, "^ghi[aeiouàèìòù]") then
		ret.ecl = mw.ustring.gsub(word, "^(...)", "ni")
		ret.len = mw.ustring.gsub(word, "^(...)", "chi")
		end
			
	 	if mw.ustring.find(word_l, "^-[f]") then
	 		ret.ecl = mw.ustring.gsub(word, "^(..)", "-vf")
	 		--ret.len = mw.ustring.gsub(word, "^(..)", "-h")
	 	elseif mw.ustring.find(word_l, "^-[v]") then
	 		ret.ecl = mw.ustring.gsub(word, "^(..)", "-vb")
	 		--ret.len = mw.ustring.gsub(word, "^(..)","-gh")
	 	elseif mw.ustring.find(word_l, "-^[p]") then
	 		ret.ecl = mw.ustring.gsub(word, "^(..)", "-bp")
	 		--ret.len = mw.ustring.gsub(word, "^(..)", "-f")
	 	elseif mw.ustring.find(word_l, "^-[b]") then
	 		ret.ecl = mw.ustring.gsub(word, "^(..)", "-mb")
	 		--ret.len = mw.ustring.gsub(word, "^(..)", "-v")
	 	elseif mw.ustring.find(word_l, "^-[s]") then
	 		ret.ecl = mw.ustring.gsub(word, "^(..)", "-zs")
	 		--ret.len = mw.ustring.gsub(word, "^(..)", "-h")
	 	elseif mw.ustring.find(word_l, "^-[z]") then
	 		ret.ecl = mw.ustring.gsub(word, "^(..)", "-dz")
	 	elseif mw.ustring.find(word_l, "^-[t]") then
	 		ret.ecl = mw.ustring.gsub(word, "^(..)", "-dt")
	 	elseif mw.ustring.find(word_l, "^-[d]") then
	 		ret.ecl = mw.ustring.gsub(word, "^(..)", "-nd")
	 	elseif mw.ustring.find(word_l, "^-[g]") then
	 		ret.ecl = mw.ustring.gsub(word, "^(..)", "-ng")
	 	elseif mw.ustring.find(word_l, "^-[h]") then
	 		ret.ecl = mw.ustring.gsub(word, "^(..)", "-nh")
	 	elseif mw.ustring.find(word_l, "^-[c]") then
	 		ret.ecl = mw.ustring.gsub(word, "^(..)", "-gc")
	 		end
	end
	
	return ret
end

return export