Module:siwa-noun/data
Jump to navigation
Jump to search
- The following documentation is located at Module:siwa-noun/data/doc.[edit]
- Useful links: root page • root page's subpages • links • transclusions • testcases • sandbox
local data = {}
local sub = mw.ustring.sub
local match = mw.ustring.match
local v = "[aeiouyůõảẻỉỏủỷę]"
local function lenition(word)
for _, pat in ipairs(require("Module:siwa-noun/common").lenition_patterns) do
local lenited = mw.ustring.gsub(word, pat[1], pat[2])
end
return lenited
end
data["a"] = {
params = {
[1] = {},
},
}
setmetatable(data["a"], {__call = function(self, args, data)
local stem = data.head
local s2, s3 = sub(lenition(stem), 1, -3), sub(lenition(stem), 1, -4)
table.insert(data.categories, "Siwa inanimate nouns")
table.insert(data.categories, "Siwa a-declension nouns")
data.forms["u"] = {stem}
if stem:match(v.."mm.$") then
data.forms["m"] = {s3 .. (data.q == "s" and "mġa" or data.q == "l" and "mka" or "kka")}
elseif stem:match(v.."nn.$") then
data.forms["m"] = {s3 .. (data.q == "s" and "nka" or "kka")}
elseif stem:match(v.."vv.$") then
data.forms["m"] = {lenition(stem)}
elseif stem:match(v.."[lrs]k.$") then
data.forms["m"] = {s2 .. "kka"}
elseif stem:match(v.."m.$") then
data.forms["m"] = {s2 .. (data.q == "s" and "mġa" or data.q == "l" and "mka" or "kka")}
elseif stem:match(v.."n.$") then
data.forms["m"] = {s2 .. (data.q == "s" and "nka" or "kka")}
elseif stem:match(v.."[pb].$") then
data.forms["m"] = {s2 .. (data.q == "s" and "pra" or "ḍga")}
elseif stem:match(v.."t.$") then
data.forms["m"] = {s2 .. (data.q == "s" and "tra" or "rka")}
elseif stem:match(v.."r.$") then
data.forms["m"] = {s3 .. "hka"}
else
data.forms["m"] = {stem .. "ka"}
end
end
})
return data