Module:siwa-noun/data: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 61: | Line 61: | ||
end | end | ||
local locative | local locative = "" | ||
if stem:match(v.."mm.$") then | if stem:match(v.."mm.$") then |
Revision as of 21:03, 24 July 2021
- 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 sub = mw.ustring.sub
local match = mw.ustring.match
local v = "([aeiouyůõảẻỉỏủỷę])"
local function lenition(word)
local lenition_patterns = {
[v.."[vųbhḥg]"..v] = "%1%2", ["bb"] = "b", ["dd"] = "d", ["gg"] = "g", ["ɟ"] = "į", ["mm"] = "m", ["ll"] = "l", ["nn"] = "n",
["rr"] = "r", ["bġ"] = "p", ["pr"] = "p", ["dġ"] = "t", ["tr"] = "t", ["ḍb"] = "p", ["ð"] = "hh",
["ḍg"] = "k", ["bm"] = "m", ["dn"] = "n", ["kn"] = "ng", ["([lr])pp"] = "%1p", ["([lr])tt"] = "%1t", ["([lrms])kk"] = "%1k",
["k([lvs])"] = "g%1", ["ps"] = "bs", ["d[aou]"] = "l", ["ġ[aou]"] = "vv", ["[dġ][eůy]"] = "", ["[rġ]i"] = "ṡi",
["di"] = "", ["ɲi"] = "ɟi", ["ħį"] = "ṡ", ["[ou]ų"] = "ů", ["ɬ"] = "l",
}
for regex, repl in ipairs(lenition_patterns) do
word = mw.ustring.gsub(word, regex, repl)
end
--word = mw.ustring.gsub(word, v.."[vųbhḥg]"..v, "%1%2")
return word
end
local data = {}
data["a"] = {
params = {
[1] = {},
},
}
setmetatable(data["a"], {__call = function(self, args, data)
local stem = data.head; local lenited = lenition(stem)
local s2, s3 = sub(lenited, 1, -3), sub(lenited, 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"] = {s3 .. "gga"}
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"] = {s2 .. "hka"}
else
data.forms["m"] = {stem .. "ka"}
end
local locative = ""
if stem:match(v.."mm.$") then
locative = {s3 .. (data.q == "s" and "mṡi" or data.q == "l" and "mki" or "kki")}
end
data.forms["ine"] = locative .. "a"
end
})
return data