Module:siwa-noun/data: Difference between revisions

From Linguifex
Jump to navigation Jump to search
No edit summary
No edit summary
Line 3: Line 3:
local sub = mw.ustring.sub
local sub = mw.ustring.sub
local match = mw.ustring.match
local match = mw.ustring.match
local v = "[aeiouyůõảẻỉỏủỷę]"
local function lenition(word)
local lenited
for regex, repl in pairs(require("Module:siwa-noun/common").lenition_patterns) do
lenited = gsub(c, regex, repl, 1)
end
return word
end


data["a"] = {
data["a"] = {
Line 11: Line 21:
setmetatable(data["a"], {__call = function(self, args, data)
setmetatable(data["a"], {__call = function(self, args, data)
local stem = data.head
local stem = data.head
local s2, s3 = sub(stem, 1, -3), sub(stem, 1, -4)
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 inanimate nouns")
table.insert(data.categories, "Siwa a-declension nouns")
table.insert(data.categories, "Siwa a-declension nouns")
data.forms["u"] = {stem}
data.forms["u"] = {stem}
if stem:match("mm.$") then
if stem:match(v.."mm.$") then
data.forms["m"] = {s3 .. (data.q == "s" and "mġa" or data.q == "l" and "mka" or "kka")}
data.forms["m"] = {s3 .. (data.q == "s" and "mġa" or data.q == "l" and "mka" or "kka")}
elseif stem:match("nn.$") then
elseif stem:match(v.."nn.$") then
data.forms["m"] = {s3 .. (data.q == "s" and "nka" or "kka")}
data.forms["m"] = {s3 .. (data.q == "s" and "nka" or "kka")}
elseif stem:match("vv.$") then
elseif stem:match(v.."vv.$") then
data.forms["m"] = {s3 .. "gga"}
data.forms["m"] = {s3 .. "gga"}
elseif stem:match("[lrs]k.$") then
elseif stem:match(v.."[lrs]k.$") then
data.forms["m"] = {s2 .. "kka"}
data.forms["m"] = {s2 .. "kka"}
elseif stem:match("m.$") then
elseif stem:match(v.."m.$") then
data.forms["m"] = {s2 .. (data.q == "s" and "mġa" or data.q == "l" and "mka" or "kka")}
data.forms["m"] = {s2 .. (data.q == "s" and "mġa" or data.q == "l" and "mka" or "kka")}
elseif stem:match("n.$") then
elseif stem:match(v.."n.$") then
data.forms["m"] = {s2 .. (data.q == "s" and "nka" or "kka")}
data.forms["m"] = {s2 .. (data.q == "s" and "nka" or "kka")}
elseif stem:match("[pb].$") then
elseif stem:match(v.."[pb].$") then
data.forms["m"] = {s2 .. (data.q == "s" and "pra" or "ḍga")}
data.forms["m"] = {s2 .. (data.q == "s" and "pra" or "ḍga")}
elseif stem:match("t.$") then
elseif stem:match(v.."t.$") then
data.forms["m"] = {s2 .. (data.q == "s" and "tra" or "rka")}
data.forms["m"] = {s2 .. (data.q == "s" and "tra" or "rka")}
elseif stem:match("r.$") then
elseif stem:match(v.."r.$") then
data.forms["m"] = {s3 .. "hka"}
data.forms["m"] = {s3 .. "hka"}
else
else

Revision as of 19:16, 24 July 2021



local data = {}

local sub = mw.ustring.sub
local match = mw.ustring.match
local v = "[aeiouyůõảẻỉỏủỷę]"

local function lenition(word)
	local lenited
	for regex, repl in pairs(require("Module:siwa-noun/common").lenition_patterns) do
		lenited = gsub(c, regex, repl, 1)
	end
	
	return word
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"] = {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"] = {s3 .. "hka"}
	else
		data.forms["m"] = {stem .. "ka"}
	end
end
})





return data