Module:siwa-noun/data: Difference between revisions

From Linguifex
Jump to navigation Jump to search
No edit summary
No edit summary
Line 281: Line 281:
all, abl = stem, stem
all, abl = stem, stem
table.insert(data.forms["ine"], s1 .. "ỉa")
table.insert(data.forms["ine"], s1 .. "ỉa")
table.insert(data.forms["all"], s1 .. "iddįibma")
if sub(stem, -1, -1) == "ỉ" then
table.insert(data.forms["abl"], s1 .. "iddįiska")
table.insert(data.forms["all"], s1 .. "iddįibma")
table.insert(data.forms["abl"], s1 .. "iddįiska")
end
na = true
na = true
else
else

Revision as of 14:50, 24 August 2021



local sub = mw.ustring.sub
local match = mw.ustring.match
local v = "([aeiouyůõảẻỉỏủỷęo̊])"
local nv = "([^aeiouyůõảẻỉỏủỷę])"
local PAGENAME = mw.title.getCurrentTitle().text
local na = false -- does Not Apocopate

local ine, ill, ela, ade, all, abl, loc
local cases = {"ine", "ill", "ela", "ade", "all", "abl"}
local ce = {"a", "ta", "ka", "ma", "bma", "ska"} -- Case Endings

local m_com = require('Module:siwa-noun/common')

local function exactly(source, pattern)
	return source:match("^" .. pattern .. "$")
end

local data = {}

data["a"] = {
	params = {
		["nolen"] = {type = "boolean"}, -- No LENition
		["ld"] = {type = "boolean"}, -- Lenition Declension
		["d"] = {type = "boolean"}, -- vowel Deletion
		["s"] = {type = "boolean"}, -- Stressed
	},
}
setmetatable(data["a"], {__call = function(self, args, data)
	local stem = args.nolen and data.head or m_com.coalescence(m_com.lenition(data.head), args.s)
	local s1, s2, s3 = sub(stem, 1, -2), sub(stem, 1, -3), sub(stem, 1, -4)
	table.insert(data.categories, "Siwa a-declension " .. data.pos)
	
	data.forms["u"] = {PAGENAME}
	
	if args.ld then
		data.forms["m"] = {(args.d and s1 or stem) .. "ka"}
		loc = (args.d and s1 or stem) .. "ki"
		na = true
	elseif stem:match(v.."mm.$") then
		data.forms["m"] = {s3 .. (data.q == "s" and "mġa" or data.q == "l" and "mka" or "kka")}
		loc = s3 .. (data.q == "s" and "mṡi" or data.q == "l" and "mki" or "kki")
	elseif stem:match(v.."nn.$") then
		data.forms["m"] = {s3 .. (data.q == "s" and "nka" or "kka")}
		loc = s3 .. (data.q == "s" and "nki" or "kki")
	elseif stem:match(v.."vv.$") then
		data.forms["m"] = {s3 .. "gga"}
		loc = s3 .. "ggi"
	elseif stem:match(v.."[lrs]k.$") then
		data.forms["m"] = {s2 .. "kka"}
		loc = s2 .. "kki"
	elseif stem:match(v.."m.$") then
		data.forms["m"] = {s2 .. (data.q == "s" and "mġa" or data.q == "l" and "mka" or "kka")}
		loc = s2 .. (data.q == "s" and "mṡi" or data.q == "l" and "mki" or "kki")
	elseif stem:match(v.."n.$") then
		data.forms["m"] = {s2 .. (data.q == "s" and "nka" or "kka")}
		loc = s2 .. (data.q == "s" and "nki" or "kki")
	elseif stem:match(v.."[pb].$") then
		data.forms["m"] = {s2 .. (data.q == "s" and "pra" or "ḍga")}
		loc = s2 .. (data.q == "s" and "pri" or "ḍgi")
	elseif stem:match(v.."[td].$") then
		data.forms["m"] = {s2 .. (data.q == "s" and "tra" or "rka")}
		loc = s2 .. (data.q == "s" and "tri" or "tṡi")
	elseif stem:match(v.."r.$") then
		data.forms["m"] = {s2 .. "hka"}
		loc = s2 .. "hki"
	elseif stem:match(v.."ṡṡ.$") then
		data.forms["m"] = {s2 .. "ka"}
		loc = s2 .. "ki"
	else
		data.forms["m"] = {(args.d and s1 or stem) .. "ka"}
		loc = (args.d and s1 or stem) .. "ki"
		na = true
	end
	
	data.forms["ine"] = {(ine or loc) .. ce[1]}
	data.forms["ill"] = {(ill or loc) .. ce[2]}
	data.forms["ela"] = {(ela or loc) .. ce[3]}
	data.forms["ade"] = {(ade or loc) .. ce[4]}
	data.forms["all"] = {(all or loc) .. ce[5]}
	data.forms["abl"] = {(abl or loc) .. ce[6]}
	
	for n, case in pairs(cases) do
		if stem:match(v.."nn.$") and data.q == "s" and not na then
			table.insert(data.forms[case], s3 .. "nṡi" .. ce[n])
		elseif stem:match(v.."n.$") and data.q == "s" and not na then
			table.insert(data.forms[case], s2 .. "nṡi" .. ce[n])
		elseif stem:match(v.."[pb].$") and data.q == "s" and not na then
			table.insert(data.forms[case], s2 .. "pṡi" .. ce[n])
		end
	end
end
})

data["e"] = {
	params = {
		["nolen"] = {type = "boolean"},
		["ld"] = {type = "boolean"},
		["d"] = {type = "boolean"},
		["s"] = {type = "boolean"},
	},
}
setmetatable(data["e"], {__call = function(self, args, data)
	local stem = args.nolen and data.head or m_com.coalescence(m_com.lenition(data.head), args.s)
	local s1, s2, s3 = sub(stem, 1, -2), sub(stem, 1, -3), sub(stem, 1, -4)
	table.insert(data.categories, "Siwa e-declension " .. data.pos)
	
	data.forms["u"] = {PAGENAME}
	
	if stem:match("[aeẻ]$") then
		if args.ld then
			data.forms["m"] = {(args.d and s1 or stem) .. "ri"}
			loc = (args.d and s1 or stem) .. "ri"
			na = true
		elseif stem:match(v.."ts.$") then
			data.forms["m"] = {s3 .. "tsġi"}
			loc = s3 .. "tsġi"
		elseif stem:match(v.."ss.$") then
			data.forms["m"] = {s3 .. "sġi"}
			loc = s3 .. "sġi"
		elseif stem:match(v.."n.$") then
			data.forms["m"] = {s2 .. "di"}
			ill, ela, ade = s2 .. "h", s2 .. "h", s2 .. "h"
			all, abl = s2 .. "i", s2 .. "i"
			ine = s2 .. "di"
		elseif stem:match(v.."b.$") then
			data.forms["m"] = {s2 .. "pri", s2 .. "bġi"}
			loc = s2 .. "pṡi"
		elseif stem:match(v.."k.$") then
			data.forms["m"] = {s2 .. "ġi"}
			loc = s2 .. "ṡi"
		elseif stem:match(v.."m.$") then
			data.forms["m"] = {s2 .. "mmi"}
			loc = s2 .. "mmi"
		elseif stem:match(v.."v.$") then
			data.forms["m"] = {s2 .. "rri"}
			loc = s2 .. "rri"
		elseif stem:match(v.."t.$") then
			data.forms["m"] = {s2 .. "tri"}
			loc = s2 .. "tri"
		elseif stem:match(v.."s.$") then
			data.forms["m"] = {s2 .. "sġi"}
			loc = s2 .. "sġi"
		elseif stem:match(v.."l.$") then
			data.forms["m"] = {s2 .. "lli"}
			loc = s2 .. "lli"
		elseif stem:match(v.."[hġ].$") then
			data.forms["m"] = {s2 .. "ġgi"}
			loc = s2 .. "ġġi"
		else
			data.forms["m"] = {(args.d and s1 or stem) .. "ri"}
			loc = (args.d and s1 or stem) .. "ri"
			na = true
		end
	elseif stem:match("[io]$") then
		if args.ld then
			if stem:match("o$") then
				data.forms["m"] = {s1 .. "ue", s1 .. "obi"}
				loc = s1 .. "uei"
				na = true
			else
				data.forms["m"] = {s1 .. "ie"}
				loc = s1 .. "iei"
				na = true
			end
		elseif stem:match(v.."mm.$") then
			data.forms["m"] = {s3 .. "mme"}
			loc = s3 .. "mmei"
		elseif stem:match(v.."[mpbvnrlkg].$") then
			local stl = sub(stem, -2, -2)
			stl = stl:gsub("p", "b"); stl = stl:gsub("k", "g")
			data.forms["m"] = {s2 .. stl .. stl .. "e"}
			loc = s2 .. stl .. stl .. "ei"
		elseif stem:match("o$") then
			data.forms["m"] = {s1 .. "ue", s1 .. "obi"}
			loc = s1 .. "uei"
			na = true
		else
			data.forms["m"] = {s1 .. "ie"}
			loc = s1 .. "iei"
			na = true
		end
	elseif stem:match("[uyů]$") then
		if args.ld then
			data.forms["m"] = {(args.d and s1 or stem) .. "me"}
			loc = (args.d and s1 or stem) .. "mei"
			na = true
		elseif stem:match(v.."mm.$") then
			data.forms["m"] = {s3 .. "mme"}
			loc = s3 .. "mme"
		elseif stem:match(v.."[mn].$") then
			data.forms["m"] = {s2 .. "mme"}
			loc = s2 .. "mme"
		elseif stem:match(v.."k.$") then
			data.forms["m"] = {s2 .. (data.q == "s" and "gme" or "hme")}
			loc = s2 .. (data.q == "s" and "gme" or "hme")
		else
			data.forms["m"] = {(args.d and s1 or stem) .. "me"}
			loc = (args.d and s1 or stem) .. "mei"
			na = true
		end
	end
	
	data.forms["ine"] = {(ine or loc) .. ce[1]}
	data.forms["ill"] = {(ill or loc) .. ce[2]}
	data.forms["ela"] = {(ela or loc) .. ce[3]}
	data.forms["ade"] = {(ade or loc) .. ce[4]}
	data.forms["all"] = {(all or loc) .. ce[5]}
	data.forms["abl"] = {(abl or loc) .. ce[6]}
	
	for n, case in pairs(cases) do
		if stem:match("o$") and na then
			table.insert(data.forms[case], s1 .. "obi" .. ce[n])
		elseif stem:match("[ae]$") and na then
			table.insert(data.forms[case], stem .. "h" .. ce[n])
		end
	end
end
})

data["i"] = {
	params = {
		["nolen"] = {type = "boolean"},
		["ld"] = {type = "boolean"},
		["s"] = {type = "boolean"},
	},
}
setmetatable(data["i"], {__call = function(self, args, data)
	local stem = args.nolen and data.head or m_com.coalescence(m_com.lenition(data.head), args.s)
	local s1, s2, s3 = sub(stem, 1, -2), sub(stem, 1, -3), sub(stem, 1, -4)
	table.insert(data.categories, "Siwa i-declension " .. data.pos)
	data.forms["ine"], data.forms["all"], data.forms["abl"] = {}, {}, {}
	
	data.forms["u"] = {PAGENAME}
	
	if args.ld then
		if stem:match("[iỉ]$") then
			data.forms["m"] = {stem .. "d"}
			ill, ela, ade = stem .. "h", stem .. "h", stem .. "h"
			ine = stem .. "di"
			all, abl = stem, stem
			table.insert(data.forms["ine"], s1 .. "ỉa")
			if sub(stem, -1, -1) == "ỉ" then
				table.insert(data.forms["all"], s1 .. "iddįibma")
				table.insert(data.forms["abl"], s1 .. "iddįiska")
			end
			na = true
		else
			data.forms["m"] = {stem .. "di"}
			ill, ela, ade = stem .. "h", stem .. "h", stem .. "h"
			all, abl = stem .. "i", stem .. "i"
			ine = stem .. "di"
			na = true
		end
	elseif stem:match(v.."[mn][mn].$") then
		data.forms["m"] = {s3 .. "ndi"}
		loc = s3 .. "ndi"
	elseif stem:match(nv.."[uo][mn].$") then
		data.forms["m"] = {s3 .. "õdi"}
		loc = s3 .. "õdi"
	elseif stem:match(v.."[mn].$") then
		data.forms["m"] = {s2 .. "ndi"}
		loc = s2 .. "ndi"
	elseif stem:match(v.."[vg].$") then
		data.forms["m"] = {s2 .. "ḍḍi"}
		if sub(stem, -2, -2) == "g" then table.insert(data.forms["m"], s2 .. "hdi") end
		ela, ade = s2 .. "ḍ", s2 .. "ḍ"
		ine, ill, all, abl = s2 .. "ḍḍi", s2 .. "ḍḍi", s2 .. "ḍḍi", s2 .. "ḍḍi"
	elseif stem:match(v.."s.$") then
		data.forms["m"] = {s2 .. "sti"}
		loc = s2 .. "sti"
	elseif stem:match(v.."[rhk].$") then
		data.forms["m"] = {s2 .. "hdi"}
		loc = s2 .. "hdi"
	elseif stem:match(v.."l.$") then
		data.forms["m"] = {s2 .. "ldi"}
		loc = s2 .. "ldi"
	elseif stem:match("[iỉ]$") then
		data.forms["m"] = {stem .. "d"}
		ill, ela, ade = stem .. "h", stem .. "h", stem .. "h"
		ine = stem .. "di"
		all, abl = stem, stem
		table.insert(data.forms["ine"], s1 .. "ỉa")
		if sub(stem, -1, -1) == "ỉ" then
				table.insert(data.forms["all"], s1 .. "iddįibma")
				table.insert(data.forms["abl"], s1 .. "iddįiska")
			end
		na = true
	else
		data.forms["m"] = {stem .. "di"}
		ill, ela, ade = stem .. "h", stem .. "h", stem .. "h"
		all, abl = stem .. "i", stem .. "i"
		ine = stem .. "di"
		na = true
	end
	
	table.insert(data.forms["ine"], (ine or loc) .. ce[1])
	data.forms["ill"] = {(ill or loc) .. ce[2]}
	data.forms["ela"] = {(ela or loc) .. ce[3]}
	data.forms["ade"] = {(ade or loc) .. ce[4]}
	table.insert(data.forms["all"], (all or loc) .. ce[5])
	table.insert(data.forms["abl"], (abl or loc) .. ce[6])
	
end
})

data["o"] = {
	params = {
		["nolen"] = {type = "boolean"},
		["ld"] = {type = "boolean"},
		["s"] = {type = "boolean"},
	},
}
setmetatable(data["o"], {__call = function(self, args, data)
	local stem = args.nolen and data.head or m_com.coalescence(m_com.lenition(data.head), args.s)
	local s1, s2, s3 = sub(stem, 1, -2), sub(stem, 1, -3), sub(stem, 1, -4)
	table.insert(data.categories, "Siwa o-declension " .. data.pos)
	
	data.forms["u"] = {PAGENAME}
	
	if stem:match("[ae]$") then
		if args.ld then
			data.forms["m"] = {stem .. "mo"}
			loc = stem .. "moi"
			na = true
		elseif stem:match(v.."[mn][mn].$") then
			data.forms["m"] = {s3 .. "mmo"}
			loc = s3 .. "mmoi"
		elseif stem:match(v.."[bt].$") then
			data.forms["m"] = {s2 .. "bmo"}
			loc = s2 .. "bmoi"
		elseif stem:match(v.."[mvn].$") then
			data.forms["m"] = {s2 .. "mmo"}
			loc = s2 .. "mmoi"
		elseif stem:match(v.."[rhg].$") then
			data.forms["m"] = {s2 .. "hmo"}
			loc = s2 .. "hmoi"
		elseif stem:match(v.."k.$") then
			data.forms["m"] = {s2 .. (data.q == "s" and "gmo" or "hmo")}
			loc = s2 .. (data.q == "s" and "gmoi" or "hmoi")
		elseif stem:match(v.."l.$") then
			data.forms["m"] = {s2 .. "lmo"}
			loc = s2 .. "lmoi"
		else
			data.forms["m"] = {stem .. "mo"}
			loc = stem .. "moi"
			na = true
		end
	elseif stem:match("i$") then
		if args.ld then
			data.forms["m"] = {stem .. "ko"}
			loc = stem .. "koi"
			na = true
		elseif stem:match(v.."hhį.$") then
			data.forms["m"] = {sub(stem, 1, -5) .. "ṡko"}
			loc = sub(stem, 1, -5) .. "ṡkoi"
		elseif stem:match(v.."[mn][mn].$") then
			data.forms["m"] = {(sub(stem, -4, -4) == "o" and sub(stem, 1, -5) .. "õ" or s3) .. "kko"}
			loc = (sub(stem, -4, -4) == "o" and sub(stem, 1, -5) .. "õ" or s3) .. "kkoi"
		elseif stem:match(v.."[mnkg].$") then
			data.forms["m"] = {(sub(stem, -3, -3) == "o" and s3 .. "õ" or s2) .. "kko"}
			loc = (sub(stem, -3, -3) == "o" and s3 .. "õ" or s2) .. "kkoi"
		elseif stem:match(v.."[lrs]k.$") or stem:match(v.."sġ.$") then
			data.forms["m"] = {s2 .. "kko"}
			loc = s2 .. "kkoi"
		elseif stem:match(v.."l.$") then
			data.forms["m"] = {s2 .. "lko"}
			loc = s2 .. "lkoi"
		elseif stem:match(v.."[rh].$") then
			data.forms["m"] = {s2 .. "hko"}
			loc = s2 .. "hkoi"
		elseif stem:match(v.."ṡ.$") then
			data.forms["m"] = {s2 .. "ṡko"}
			loc = s2 .. "ṡkoi"
		else
			data.forms["m"] = {stem .. "ko"}
			loc = stem .. "koi"
			na = true
		end
	elseif stem:match("[ouyů]$") then
		if args.ld then
			data.forms["m"] = {stem .. "ma"}
			ill, ela = stem .. "n", stem .. "n"
			ine, ade, all, abl = stem .. "mi", stem .. "mi", stem .. "mi", stem .. "mi"
			na = true
		elseif stem:match(v.."[mn][mn].$") then
			data.forms["m"] = {s3 .. "mma"}
			loc = s3 .. "mmi"
		elseif stem:match(v.."[mnv].$") then
			data.forms["m"] = {s2 .. "mma"}
			loc = s2 .. "mmi"
		elseif stem:match(v.."[rhgk].$") then
			data.forms["m"] = {s2 .. "hma"}
			loc = s2 .. "hmi"
		elseif stem:match(v.."l.$") then
			data.forms["m"] = {s2 .. "lma"}
			loc = s2 .. "lmi"
		else
			data.forms["m"] = {stem .. "ma"}
			ill, ela = stem .. "n", stem .. "n"
			ine, ade, all, abl = stem .. "mi", stem .. "mi", stem .. "mi", stem .. "mi"
			na = true
		end
	end
	
	data.forms["ine"] = {(ine or loc) .. ce[1]}
	data.forms["ill"] = {(ill or loc) .. ce[2]}
	data.forms["ela"] = {(ela or loc) .. ce[3]}
	data.forms["ade"] = {(ade or loc) .. ce[4]}
	data.forms["all"] = {(all or loc) .. ce[5]}
	data.forms["abl"] = {(abl or loc) .. ce[6]}
	
	for n, case in pairs(cases) do
		if stem:match(v.."[mnkg]i$") and not na then
			table.insert(data.forms[case], (sub(stem, -3, -3) == "o" and s3 .. "õ" or s2) .. "kki" .. ce[n])
		elseif (stem:match(v.."[lrs]ki$") or stem:match(v.."sġi$")) and not na then
			table.insert(data.forms[case], s2 .. "kki" .. ce[n])
		end
	end
end
})

data["u"] = {
	params = {
		["nolen"] = {type = "boolean"},
		["ld"] = {type = "boolean"},
		["s"] = {type = "boolean"},
	},
}
setmetatable(data["u"], {__call = function(self, args, data)
	local stem = args.nolen and data.head or m_com.coalescence(m_com.lenition(data.head), args.s)
	local s1, s2, s3 = sub(stem, 1, -2), sub(stem, 1, -3), sub(stem, 1, -4)
	table.insert(data.categories, "Siwa u-declension " .. data.pos)
	
	data.forms["u"] = {PAGENAME}
	
	if stem:match("[aei]$") then
		if args.ld then
			data.forms["m"] = {stem .. "mo"}
			loc = stem .. "moi"
			na = true
		elseif stem:match(v.."[mn][mn].$") then
			data.forms["m"] = {s3 .. "mmo"}
			loc = s3 .. "mmoi"
		elseif stem:match(v.."[btpd].$") then
			data.forms["m"] = {s2 .. "bmo"}
			loc = s2 .. "bmoi"
		elseif stem:match(v.."[mvn].$") then
			data.forms["m"] = {s2 .. "mmo"}
			loc = s2 .. "mmoi"
		elseif stem:match(v.."[rhgk].$") then
			data.forms["m"] = {s2 .. "hmo"}
			loc = s2 .. "hmoi"
		elseif stem:match(v.."l.$") then
			data.forms["m"] = {s2 .. "lmo"}
			loc = s2 .. "lmoi"
		else
			data.forms["m"] = {stem .. "mo"}
			loc = stem .. "moi"
			na = true
		end
	elseif stem:match("[ouyů]$") then
		if args.ld then
			data.forms["m"] = {stem .. "ma"}
			ill, ela = stem .. "n", stem .. "n"
			ine, ade, all, abl = stem .. "mi", stem .. "mi", stem .. "mi", stem .. "mi"
			na = true
		elseif stem:match(v.."[mn][mn].$") then
			data.forms["m"] = {s3 .. "mma", s3 .. "mmo"}
			loc = s3 .. "mma"
		elseif stem:match(v.."[mnv].$") then
			data.forms["m"] = {s2 .. "mma", s2 .. "mmo"}
			loc = s2 .. "mmi"
		elseif stem:match(v.."[bptd].$") then
			data.forms["m"] = {s2 .. "bma"}
			loc = s2 .. "bmi"
		elseif stem:match(v.."[rhgk].$") then
			data.forms["m"] = {s2 .. "hma"}
			loc = s2 .. "hmi"
		elseif stem:match(v.."l.$") then
			data.forms["m"] = {s2 .. "lma"}
			loc = s2 .. "lmi"
		else
			data.forms["m"] = {stem .. "ma"}
			ill, ela = stem .. "n", stem .. "n"
			ine, ade, all, abl = stem .. "mi", stem .. "mi", stem .. "mi", stem .. "mi"
			na = true
		end
	end
	
	data.forms["ine"] = {(ine or loc) .. ce[1]}
	data.forms["ill"] = {(ill or loc) .. ce[2]}
	data.forms["ela"] = {(ela or loc) .. ce[3]}
	data.forms["ade"] = {(ade or loc) .. ce[4]}
	data.forms["all"] = {(all or loc) .. ce[5]}
	data.forms["abl"] = {(abl or loc) .. ce[6]}
	
	for n, case in pairs(cases) do
		if stem:match(v.."[mn][mn][oyuů]$") and not na then
			table.insert(data.forms[case], s3 .. "mmoi" .. ce[n])
		elseif (stem:match(v.."[mn][oyuů]$") or stem:match(v.."sġi$")) and not na then
			table.insert(data.forms[case], s2 .. "mmoi" .. ce[n])
		end
	end
end
})

data["y"] = {
	params = {
		["nolen"] = {type = "boolean"},
		["ld"] = {type = "boolean"},
		["s"] = {type = "boolean"},
	},
}
setmetatable(data["y"], {__call = function(self, args, data)
	local stem = args.nolen and data.head or m_com.coalescence(m_com.lenition(data.head), args.s)
	local s1, s2, s3 = sub(stem, 1, -2), sub(stem, 1, -3), sub(stem, 1, -4)
	table.insert(data.categories, "Siwa y-declension " .. data.pos)
	
	data.forms["ine"] = {}
	data.forms["all"] = {}
	data.forms["abl"] = {}
	
	data.forms["u"] = {PAGENAME}
	
	if stem:match("a$") then
		if args.ld then
			data.forms["m"] = {stem .. "mo"}
			loc = stem .. "moi"
			na = true
		elseif stem:match(v.."[mn][mn].$") then
			data.forms["m"] = {s3 .. "mmo"}
			loc = s3 .. "mmoi"
		elseif stem:match(v.."[mvn].$") then
			data.forms["m"] = {s2 .. "mmo"}
			loc = s2 .. "mmoi"
		elseif stem:match(v.."[rhgk].$") then
			data.forms["m"] = {s2 .. "hmo"}
			loc = s2 .. "hmoi"
		elseif stem:match(v.."l.$") then
			data.forms["m"] = {s2 .. "lmo"}
			loc = s2 .. "lmoi"
		else
			data.forms["m"] = {stem .. "mo"}
			loc = stem .. "moi"
			na = true
		end
	elseif stem:match("[ie]$") then
		if args.ld then
			if stem:match("i$") then
				data.forms["m"] = {stem .. "d"}
				ill, ela, ade = stem .. "h", stem .. "h", stem .. "h"
				ine = stem .. "di"
				all, abl = stem, stem
				table.insert(data.forms["ine"], s1 .. "ỉa")
				table.insert(data.forms["all"], s1 .. "iddįibma")
				table.insert(data.forms["abl"], s1 .. "iddįiska")
				na = true
			else
				data.forms["m"] = {stem .. "di"}
				ill, ela, ade = stem .. "h", stem .. "h", stem .. "h"
				all, abl = stem .. "i", stem .. "i"
				ine = stem .. "di"
				na = true
			end
		elseif stem:match(v.."[mn][mn].$") then
			data.forms["m"] = {s3 .. "ndi"}
			loc = s3 .. "ndi"
		elseif stem:match("[uo][mn].$") then
			data.forms["m"] = {s3 .. "õdi"}
			loc = s3 .. "õdi"
		elseif stem:match(v.."[mn].$") then
			data.forms["m"] = {s2 .. "ndi"}
			loc = s2 .. "ndi"
		elseif stem:match(v.."[vg].$") then
			data.forms["m"] = {s2 .. "ḍḍi"}
			if sub(stem, -2, -2) == "g" then table.insert(data.forms["m"], s2 .. "hdi") end
			ela, ade = s2 .. "ḍ", s2 .. "ḍ"
			ine, ill, all, abl = s2 .. "ḍḍi", s2 .. "ḍḍi", s2 .. "ḍḍi", s2 .. "ḍḍi"
		elseif stem:match(v.."s.$") then
			data.forms["m"] = {s2 .. "sti"}
			loc = s2 .. "sti"
		elseif stem:match(v.."[rhk].$") then
			data.forms["m"] = {s2 .. "hdi"}
			loc = s2 .. "hdi"
		elseif stem:match(v.."l.$") then
			data.forms["m"] = {s2 .. "ldi"}
			loc = s2 .. "ldi"
		elseif stem:match("i$") then
			data.forms["m"] = {stem .. "d"}
			ill, ela, ade = stem .. "h", stem .. "h", stem .. "h"
			ine = stem .. "di"
			all, abl = stem, stem
			table.insert(data.forms["ine"], s1 .. "ỉa")
			table.insert(data.forms["all"], s1 .. "iddįibma")
			table.insert(data.forms["abl"], s1 .. "iddįiska")
			na = true
		else
			data.forms["m"] = {stem .. "di"}
			ill, ela, ade = stem .. "h", stem .. "h", stem .. "h"
			all, abl = stem .. "i", stem .. "i"
			ine = stem .. "di"
			na = true
		end
	elseif stem:match("[ouyů]$") then
		if args.ld then
			data.forms["m"] = {stem .. "ma"}
			ill, ela = stem .. "n", stem .. "n"
			ine, ade, all, abl = stem .. "mi", stem .. "mi", stem .. "mi", stem .. "mi"
		elseif stem:match(v.."[mn][mn].$") then
			data.forms["m"] = {s3 .. "mma"}
			loc = s3 .. "mmi"
		elseif stem:match(v.."[mvn].$") then
			data.forms["m"] = {s2 .. "mma"}
			loc = s2 .. "mmi"
		elseif stem:match(v.."[rhg].$") then
			data.forms["m"] = {s2 .. "hma"}
			loc = s2 .. "hmi"
		elseif stem:match(v.."l.$") then
			data.forms["m"] = {s2 .. "lma"}
			loc = s2 .. "lmi"
		else
			data.forms["m"] = {stem .. "ma"}
			ill, ela = stem .. "n", stem .. "n"
			ine, ade, all, abl = stem .. "mi", stem .. "mi", stem .. "mi", stem .. "mi"
		end
	end
	
	table.insert(data.forms["ine"], (ine or loc) .. ce[1])
	data.forms["ill"] = {(ill or loc) .. ce[2]}
	data.forms["ela"] = {(ela or loc) .. ce[3]}
	data.forms["ade"] = {(ade or loc) .. ce[4]}
	table.insert(data.forms["all"], (all or loc) .. ce[5])
	table.insert(data.forms["abl"], (abl or loc) .. ce[6])
	
end
})

data["s"] = {
	params = {
		["nolen"] = {type = "boolean"},
		["d"] = {type = "boolean"},
		["s"] = {type = "boolean"},
	},
}
setmetatable(data["s"], {__call = function(self, args, data)
	local stem = args.nolen and data.head or m_com.coalescence(m_com.lenition(data.head), args.s)
	local s1, s2, s3 = sub(stem, 1, -2), sub(stem, 1, -3), sub(stem, 1, -4)
	table.insert(data.categories, "Siwa s-declension " .. data.pos)
	
	local s = args.s and "hh" or "h"
	
	data.forms["u"] = {PAGENAME}
	
	if stem:match(v.."d.s$") then
		data.forms["m"] = {s3 .. "lhi"}
		ill, ela, ade = s3 .. "lh", s3 .. "lh", s3 .. "lh"
		ine, all, abl = s3 .. "lhi", s3 .. "lhi", s3 .. "lhi"
	elseif stem:match(v.."k.s$") then
		data.forms["m"] = {s1 .. "hi", s3 .. "hki"}
		ill, ela, ade = s1 .. "h", s1 .. "h", s1 .. "h"
		ine, all, abl = s1 .. "hi", s1 .. "hi", s1 .. "hi"
	else
		data.forms["m"] = {(args.d and s2 or s1) .. s .. "i"}
		ill, ela, ade = (args.d and s2 or s1) .. "h", (args.d and s2 or s1) .. "h", (args.d and s2 or s1) .. "h"
		ine, all, abl = (args.d and s2 or s1) .. s .. "i", (args.d and s2 or s1) .. s .. "i", (args.d and s2 or s1) .. s .. "i"
	end
	
	data.forms["ine"] = {(ine or loc) .. ce[1]}
	data.forms["ill"] = {(ill or loc) .. ce[2]}
	data.forms["ela"] = {(ela or loc) .. ce[3]}
	data.forms["ade"] = {(ade or loc) .. ce[4]}
	data.forms["all"] = {(all or loc) .. ce[5]}
	data.forms["abl"] = {(abl or loc) .. ce[6]}
end
})

data["n"] = {
	params = {
		[2] = {},
		["nolen"] = {type = "boolean"},
		["s"] = {type = "boolean"},
		["d"] = {type = "boolean"},
	},
}
setmetatable(data["n"], {__call = function(self, args, data)
	local stem = args.nolen and data.head or m_com.coalescence(m_com.lenition(data.head), args.s)
	local s1, s2, s3 = sub(stem, 1, -2), sub(stem, 1, -3), sub(stem, 1, -4)
	local sv = args[2]
	table.insert(data.categories, "Siwa n-declension " .. data.pos)
	
	data.forms["u"] = {PAGENAME}
	
	if sv:match("[aou]$") then
		data.forms["m"] = {stem .. "ta"}
		loc = sv == "o" and s2 .. "õri" or s1 .. "ri"
	elseif sv:match("[eiyůỉ]$") then
		data.forms["m"] = {s1 .. "s"}
		loc = s1 .. "s" .. (args.d and "" or "i")
	end
	
	data.forms["ine"] = {(ine or loc) .. ce[1]}
	data.forms["ill"] = {(ill or loc) .. ce[2]}
	data.forms["ela"] = {(ela or loc) .. ce[3]}
	data.forms["ade"] = {(ade or loc) .. ce[4]}
	data.forms["all"] = {(all or loc) .. ce[5]}
	data.forms["abl"] = {(abl or loc) .. ce[6]}
end
})

data["t"] = {
	params = {
		[2] = {},
		["nolen"] = {type = "boolean"},
		["ut"] = {},
		["s"] = {type = "boolean"},
	},
}
setmetatable(data["t"], {__call = function(self, args, data)
	local stem = args.nolen and data.head or m_com.coalescence(m_com.lenition(data.head), args.s)
	local s1, s2, s3 = sub(stem, 1, -2), sub(stem, 1, -3), sub(stem, 1, -4)
	local sv = args[2]
	table.insert(data.categories, "Siwa t-declension " .. data.pos)
	
	data.forms["u"] = {PAGENAME}
	
	if args.ut then
		data.forms["m"] = {s2 .. "lda", s2 .. "utta"}
	elseif sv:match("[aou]$") then
		data.forms["m"] = {stem .. "ta"}
	elseif sv:match("[eiyů]$") then
		data.forms["m"] = {s1 .. "tsta", s1 .. "ddįa", s1 .. "tsitta"}
	end
end
})

data["l"] = {
	params = {
		[2] = {},
		["nolen"] = {type = "boolean"},
		["str"] = {type = "boolean"},
		["s"] = {type = "boolean"},
	},
}
setmetatable(data["l"], {__call = function(self, args, data)
	local stem = args.nolen and data.head or m_com.coalescence(m_com.lenition(data.head), args.s)
	local s1, s2, s3 = sub(stem, 1, -2), sub(stem, 1, -3), sub(stem, 1, -4)
	table.insert(data.categories, "Siwa l-declension " .. data.pos)
	local sv = args[2]
	
	local lts = {
		["ả"] = "a", ["ẻ"] = "e", ["ỉ"] = "i",
		["ỏ"] = "o", ["ủ"] = "u", ["ỷ"] = "y",
	}
	
	data.forms["u"] = {PAGENAME}
	
	if sv:match("[aou]$") then
		if match("[ảẻỉỏủỷ]", sub(data.head, -1, -1)) then
			data.forms["m"] = {s1 .. lts[sub(stem, -1, -1)] .. "ri"}
		else
			data.forms["m"] = {s1 .. "ri"}
		end
	elseif sv:match("[eiyů]$") then
		if match("[ảẻỉỏủỷ]", sub(data.head, -1, -1)) then
			data.forms["m"] = {s1 .. lts[sub(stem, -1, -1)] .. "la"}
		else
			data.forms["m"] = {s1 .. "la"}
		end
	end
	
end
})

data["animate"] = {
	params = {
		[2] = {}, -- stressed vowel
		["h"] = {type = "boolean"}, -- Human
		["av"] = {type = "boolean"}, -- After Vowel
		["s"] = {type = "boolean"},
	},
}
setmetatable(data["animate"], {__call = function(self, args, data)
	local stem = data.head; local sv = args[2]
	local s1, s2, s3 = sub(stem, 1, -2), sub(stem, 1, -3), sub(stem, 1, -4)
	
	--local av = stem:match(v.."..$") and true or false -- After Vowel
	local av = args.av
	
	data.forms["u_sg"] = {PAGENAME}
	
	if stem:match("m[ao]$") then
		data.forms["m_sg"] = {s2 .. (exactly(sv, "[ou]") and "ṡi" or "ka")}
		data.forms["u_pl"] = {stem .. "gi"}
		data.forms["m_pl"] = {s2 .. (exactly(sv, "[ou]") and "ṡi" or "ka") .. "gi"}
	elseif stem:match("mi$") then
		data.forms["m_sg"] = {s2 .. "ta", s2 .. "tta"}
		data.forms["u_pl"] = {stem .. "gi", s2 .. "mṡi", s2 .. "mhi"}
		data.forms["m_pl"] = {s2 .. "tagi", s2 .. "ttagi"}
	elseif stem:match("[bpv]a$") then
		data.forms["m_sg"] = {s2 .. "u"}
		data.forms["u_pl"] = {stem .. "gi"}
		data.forms["m_pl"] = {s2 .. "ugi"}
	elseif stem:match("[bpv]i$") then
		data.forms["m_sg"] = {s2 .. "umi"}
		data.forms["u_pl"] = {stem .. "gi"}
		if stem:match("[bp].$") then table.insert(data.forms["u_pl"], s2 .. "bṡi") end
		data.forms["m_pl"] = {s2 .. "umṡi"}
	elseif stem:match("[bpv]o$") then
		data.forms["u_pl"] = {stem .. "gi"}
		data.forms["m_sg"] = {s2 .. "oųi"}
		data.forms["m_pl"] = {s2 .. "oṡi"}
	elseif stem:match("[tn][ao]$") then
		data.forms["u_pl"] = {stem .. "gi"}
		if stem:match(nv.."..$") and not stem:match("[tsḍlgġksṡr]..$") then
			data.forms["m_sg"] = {s2 .. "ųa"}
			data.forms["m_pl"] = {s2 .. "ųagi"}
		else
			data.forms["m_sg"] = {s2 .. (args.s and "v" or "") .."va"}
			data.forms["m_pl"] = {s2 .. (args.s and "v" or "") .. "vagi"}
		end
	elseif stem:match("ni$") then
		if av then
			data.forms["u_pl"] = {s1 .. "ṡi", s1 .. "hi"}
		else
			data.forms["u_pl"] = {stem .. "gi"}
		end
		
		data.forms["m_sg"] = {s2 .. "įa"}
		data.forms["m_pl"] = {s2 .. "įagi"}
	elseif stem:match("t[ei]$") then
		data.forms["u_pl"] = {stem .. "gi", s1 .. "si"}
		data.forms["m_sg"] = {s2 .. "ika"}
		data.forms["m_pl"] = {s2 .. "ikagi"}
	elseif stem:match("s[ao]$") then
		data.forms["u_pl"] = {stem .. "gi"}
		
		if args.h then
			data.forms["m_sg"] = {s2 .. "tta"}
			data.forms["m_pl"] = {s2 .. "ttagi"}
		else
			data.forms["m_sg"] = {s2 .. "hi", s2 .. "ḥi"}
			data.forms["m_pl"] = {s2 .. "higi", s2 .. "ḥigi"}
		end
	elseif stem:match("si$") then
		data.forms["u_pl"] = {stem .. "gi", s1 .. "sġi"}
		data.forms["m_sg"] = {s2 .. "tta"}
		data.forms["m_pl"] = {s2 .. "ttagi"}
	elseif stem:match("ṡi$") then
		data.forms["u_pl"] = {stem .. "gi"}
		data.forms["m_sg"] = {s2 .. (av and "hta" or "ohta")}
		data.forms["m_pl"] = {s2 .. (av and "hta" or "ohta") .. "gi"}
	elseif stem:match("[lr][ao]$") then
		data.forms["u_pl"] = {stem .. "gi"}
		data.forms["m_sg"] = {s2 .. "sta"}
		data.forms["m_pl"] = {s2 .. "stagi"}
	elseif stem:match("[lr]i$") then
		data.forms["u_pl"] = {s1 .. (av and "hi" or "igi")}
		data.forms["m_sg"] = {s2 .. "tṡa"}
		data.forms["m_pl"] = {s2 .. "tṡagi"}
	elseif stem:match("lu$") then
		data.forms["u_pl"] = {s1 .. (av and "hi" or "ugi")}
		data.forms["m_sg"] = {s2 .. "da"}
		data.forms["m_pl"] = {s2 .. "dagi"}
	elseif stem:match("k[ao]$") then
		data.forms["u_pl"] = {stem .. "gi"}
		data.forms["m_sg"] = {s2 .. "uni"}
		data.forms["m_pl"] = {s2 .. "unhi"}
	elseif stem:match("ki$") then
		data.forms["u_pl"] = {s1 .. (av and "ṡi" or "igi")}
		data.forms["m_sg"] = {s2 .. "tṡa"}
		data.forms["m_pl"] = {s2 .. "tṡagi"}
	elseif stem:match("g[aoi]$") then
		data.forms["u_pl"] = {stem .. "gi"}
		
		if args.h then
			data.forms["m_sg"] = {s2 .. "tsa"}
			data.forms["m_pl"] = {s2 .. "tsagi"}
		else
			data.forms["m_sg"] = {s2 .. "ubi"}
			data.forms["m_pl"] = {s2 .. "ubigi", s2 .. "ubṡi"}
		end
	elseif stem:match("h[ao]$") then
		data.forms["u_pl"] = {stem .. "gi"}
		data.forms["m_sg"] = {s2 .. "ra"}
		data.forms["m_pl"] = {s2 .. "ragi"}
	elseif stem:match("hi$") then
		data.forms["u_pl"] = {stem .. "gi"}
		data.forms["m_sg"] = {s2 .. "tṡa"}
		data.forms["m_pl"] = {s2 .. "tṡagi"}
	elseif stem:match("[iỉy]$") then
		data.forms["u_pl"] = {stem .. "gi"}
		data.forms["m_sg"] = {s1 .. "itṡa"}
		data.forms["m_pl"] = {s1 .. "itṡagi"}
	end
	
	if match(data.forms["u_pl"][1], "igi$") then
		table.insert(data.forms["u_pl"], s1 .. "ęgi")
	end
	
	if match(data.forms["m_pl"][1], "igi$") then
		table.insert(data.forms["m_pl"], s1 .. "ęgi")
	end
	
end
})

data["aumulhi"] = function(args, data)
	data.forms["u_pl"] = {"aumulhi"}
	data.forms["m_pl"] = {"aumutṡagi"}
end

data["bahhi"] = function(args, data)
	data.decl_type = "irregular"
	table.insert(data.categories, "Siwa irregular nouns")
	data.forms["u"] = {"bahhi"}
	data.forms["m"] = {"baski"}
end

data["bahhįo"] = function(args, data)
	data.decl_type = "dual"
	table.insert(data.categories, "Siwa dual nouns")
	data.forms["u_sg"] = {"bahhįo"}
	data.forms["u_pl"] = {"bahpa"}
	data.forms["m_sg"] = {"baġa"}
	data.forms["m_pl"] = data.forms["m_sg"]
end

data["boġġi"] = function(args, data)
	data.decl_type = "irregular"
	table.insert(data.categories, "Siwa irregular nouns")
	data.forms["u"] = {"boġġi"}
	data.forms["m"] = {"boġġo"}
end

data["bủtni"] = function(args, data)
	data.decl_type = "irregular"
	table.insert(data.categories, "Siwa irregular nouns")
	data.forms["u"] = {"bủtni"}
	data.forms["m"] = {"bủtnỉd"}
	data.forms["ine"] = {"bủtnỉa", "bủtnidia"}
	data.forms["ill"] = {"bủtnihta"}
	data.forms["ela"] = {"bủtnihka"}
	data.forms["ade"] = {"bủtnihma"}
	data.forms["all"] = {"bủtniddįibma", "bủtnibma"}
	data.forms["abl"] = {"bủtniddįiska", "bủtniska"}
end

data["bỷ"] = function(args, data)
	data.decl_type = "irregular"
	table.insert(data.categories, "Siwa irregular nouns")
	data.forms["u"] = {"bỷ"}
	data.forms["m"] = {"bůbů"}
end

data["dapsa"] = function(args, data)
	data.decl_type = "irregular"
	table.insert(data.categories, "Siwa irregular nouns")
	data.forms["u_sg"] = {"dapsa"}
	data.forms["u_pl"] = {"dapsagi"}
	data.forms["m_sg"] = {"daḍḍa"}
	data.forms["m_pl"] = {"daḍḍagi"}
end

data["dirva"] = function(args, data)
	data.decl_type = "i"
	table.insert(data.categories, "Siwa i-declension nouns")
	data.forms["u"] = {"dirva"}
	data.forms["m"] = {"dirdi", "dihdi"}
end

data["ebo"] = function(args, data)
	data.decl_type = "coalescence"
	table.insert(data.categories, "Siwa diphthong-coalescence nouns")
	data.forms["u"] = {"ebo"}
	data.forms["m"] = {"ivve", "iobi"}
	data.forms["ine"] = {"ivveia", "iobia"}
	data.forms["ill"] = {"ivveita", "iobita"}
	data.forms["ela"] = {"ivveika", "iobika"}
	data.forms["ade"] = {"ivveima", "iobima"}
	data.forms["all"] = {"ivveibma", "iobibma"}
	data.forms["abl"] = {"ivveiska", "iobiska"}
end

data["ẻgi"] = function(args, data)
	data.decl_type = "e"
	table.insert(data.categories, "Siwa e-declension nouns")
	data.forms["u"] = {"ẻgi"}
	data.forms["m"] = {"egįegi"}
end

data["ẻu"] = function(args, data)
	data.decl_type = "coalescence"
	table.insert(data.categories, "Siwa diphthong-coalescence nouns")
	data.forms["u"] = {"ẻu"}
	data.forms["m"] = {"ůbů"}
end

data["ẻulbi"] = function(args, data)
	data.decl_type = "y"
	table.insert(data.categories, "Siwa y-declension nouns")
	data.forms["u"] = {"ẻulbi"}
	data.forms["m"] = {"ẻulbimo"}
	data.forms["ill"] = {"ẻulbimoita"}
	data.forms["abl"] = {"ẻulbimoiska"}
	data.forms["ade"] = {"ẻulbimoima"}
	data.forms["all"] = {"ẻulbimoibma"}
	data.forms["ine"] = {"ẻulbimoįa"}
	data.forms["ela"] = {"ẻulbimoika"}
end

data["eulhi"] = function(args, data)
	data.forms["u_pl"] = {"eulhi"}
	data.forms["m_pl"] = {"eultṡagi"}
end

data["gảgi"] = function(args, data)
	data.decl_type = "a"
	table.insert(data.categories, "Siwa a-declension nouns")
	data.forms["u"] = {"gảgi"}
	data.forms["m"] = {"gęįagi"}
end

data["gei"] = function(args, data)
	data.decl_type = "coalescence"
	table.insert(data.categories, "Siwa diphthong-coalescence nouns")
	data.forms["u"] = {"gei"}
	data.forms["m"] = {"geįe"}
end

data["gųesi"] = function(args, data)
	data.decl_type = "e"
	table.insert(data.categories, "Siwa irregular nouns")
	table.insert(data.categories, "Siwa e-declension nouns")
	data.forms["u"] = {"gųesi"}
	data.forms["m"] = {"gųesse"}
	loc = "gųessei"
	data.forms["ine"] = {loc .. ce[1]}
	data.forms["ill"] = {loc .. ce[2]}
	data.forms["ela"] = {loc .. ce[3]}
	data.forms["ade"] = {loc .. ce[4]}
	data.forms["all"] = {loc .. ce[5]}
	data.forms["abl"] = {loc .. ce[6]}
end

data["goi"] = function(args, data)
	data.decl_type = "coalescence"
	table.insert(data.categories, "Siwa diphthong-coalescence nouns")
	data.forms["u"] = {"goi"}
	data.forms["m"] = {"gogįo"}
end

data["ġey"] = function(args, data)
	data.decl_type = "coalescence"
	table.insert(data.categories, "Siwa diphthong-coalescence nouns")
	data.forms["u"] = {"ġey"}
	data.forms["m"] = {"ġůbů"}
end

data["hai"] = function(args, data)
	data.decl_type = "coalescence"
	table.insert(data.categories, "Siwa diphthong-coalescence nouns")
	data.forms["u"] = {"hai"}
	data.forms["m"] = {"hagįa"}
end

data["hie"] = function(args, data)
	data.decl_type = "coalescence"
	table.insert(data.categories, "Siwa diphthong-coalescence nouns")
	data.forms["u"] = {"hie"}
	data.forms["m"] = {"hiddįi"}
end

data["kengi"] = function(args, data)
	data.decl_type = "irregular"
	table.insert(data.categories, "Siwa irregular nouns")
	data.forms["u"] = {"kengi"}
	data.forms["m"] = {"kenda"}
	data.forms["ill"] = {"kendaita"}
	data.forms["abl"] = {"kendaiska"}
	data.forms["ade"] = {"kendaima"}
	data.forms["all"] = {"kendaibma"}
	data.forms["ine"] = {"kendaįa"}
	data.forms["ela"] = {"kendaika"}
	
	data.forms["u_sg"] = {"kengi"}
	data.forms["m_sg"] = {"kegna"}
end

data["netsengųesi"] = function(args, data)
	data.decl_type = "e"
	table.insert(data.categories, "Siwa irregular nouns")
	table.insert(data.categories, "Siwa e-declension nouns")
	data.forms["u"] = {"netsengųesi"}
	data.forms["m"] = {"netsengųesse"}
	loc = "netsengųessei"
	data.forms["ine"] = {loc .. ce[1]}
	data.forms["ill"] = {loc .. ce[2]}
	data.forms["ela"] = {loc .. ce[3]}
	data.forms["ade"] = {loc .. ce[4]}
	data.forms["all"] = {loc .. ce[5]}
	data.forms["abl"] = {loc .. ce[6]}
end

data["totami"] = function(args, data)
	data.decl_type = "irregular"
	table.insert(data.categories, "Siwa irregular nouns")
	data.forms["u_sg"] = {"totami"}
	data.forms["u_pl"] = {"totamṡi"}
	data.forms["m_sg"] = {"todatta"}
	data.forms["m_pl"] = {"todattagi"}
end

return data