Module:snon-common: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| Line 48: | Line 48: | ||
ret.ecl = mw.ustring.gsub(word, "^(..)", "-v") | ret.ecl = mw.ustring.gsub(word, "^(..)", "-v") | ||
ret.len = mw.ustring.gsub(word, "^(..)", "-h") | ret.len = mw.ustring.gsub(word, "^(..)", "-h") | ||
elseif mw.ustring.find(word_l, "^-[ | elseif mw.ustring.find(word_l, "^-[v]") then | ||
ret.ecl = mw.ustring.gsub(word, "^(..)", "-b") | ret.ecl = mw.ustring.gsub(word, "^(..)", "-b") | ||
ret.len = mw.ustring.gsub(word, "^(..)","-gh") | ret.len = mw.ustring.gsub(word, "^(..)","-gh") | ||
elseif mw.ustring.find(word_l, "-^[p]") then | |||
ret.ecl = mw.ustring.gsub(word, "^(..)", "-b") | |||
ret.len = mw.ustring.gsub(word, "^(..)", "-f") | |||
elseif mw.ustring.find(word_l, "^-[b]") then | elseif mw.ustring.find(word_l, "^-[b]") then | ||
ret.ecl = mw.ustring.gsub(word, "^(..)", "-m") | ret.ecl = mw.ustring.gsub(word, "^(..)", "-m") | ||
| Line 57: | Line 60: | ||
ret.ecl = mw.ustring.gsub(word, "^(..)", "-z") | ret.ecl = mw.ustring.gsub(word, "^(..)", "-z") | ||
ret.len = mw.ustring.gsub(word, "^(..)", "-h") | ret.len = mw.ustring.gsub(word, "^(..)", "-h") | ||
elseif mw.ustring.find(word_l, "^-[ | elseif mw.ustring.find(word_l, "^-[z]") then | ||
ret.ecl = mw.ustring.gsub(word, "^(..)", "-d") | |||
elseif mw.ustring.find(word_l, "^-[t]") then | |||
ret.ecl = mw.ustring.gsub(word, "^(..)", "-d") | ret.ecl = mw.ustring.gsub(word, "^(..)", "-d") | ||
elseif mw.ustring.find(word_l, "^-[d]") then | elseif mw.ustring.find(word_l, "^-[d]") then | ||
Revision as of 22:23, 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, "^(..)", "-v")
ret.len = mw.ustring.gsub(word, "^(..)", "-h")
elseif mw.ustring.find(word_l, "^-[v]") then
ret.ecl = mw.ustring.gsub(word, "^(..)", "-b")
ret.len = mw.ustring.gsub(word, "^(..)","-gh")
elseif mw.ustring.find(word_l, "-^[p]") then
ret.ecl = mw.ustring.gsub(word, "^(..)", "-b")
ret.len = mw.ustring.gsub(word, "^(..)", "-f")
elseif mw.ustring.find(word_l, "^-[b]") then
ret.ecl = mw.ustring.gsub(word, "^(..)", "-m")
ret.len = mw.ustring.gsub(word, "^(..)", "-v")
elseif mw.ustring.find(word_l, "^-[s]") then
ret.ecl = mw.ustring.gsub(word, "^(..)", "-z")
ret.len = mw.ustring.gsub(word, "^(..)", "-h")
elseif mw.ustring.find(word_l, "^-[z]") then
ret.ecl = mw.ustring.gsub(word, "^(..)", "-d")
elseif mw.ustring.find(word_l, "^-[t]") then
ret.ecl = mw.ustring.gsub(word, "^(..)", "-d")
elseif mw.ustring.find(word_l, "^-[d]") then
ret.ecl = mw.ustring.gsub(word, "^(..)", "-n")
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, "^-[k]") then
ret.ecl = mw.ustring.gsub(word, "^(..)", "-g")
end
end
return ret
end
return export