Module:smi-pro-nouns

local lang = require("Module:languages").getByCode("smi-pro")

local export = {}

function export.even(frame) local params = { [1] = {required = true, default = ""}, }	local args = require("Module:parameters").process(frame:getParent.args, params) local data = {forms = {}, info = "even", categories = {lang:getCanonicalName .. " even nouns"}} local umlaut_j = args[1] local umlaut_e = args[1] local umlaut_je = args[1] if mw.ustring.find(args[1], "[aeiouāēōë]$") then local vowel = mw.ustring.match(args[1], "[aeiouāēōë]+$") table.insert(data.categories, lang:getCanonicalName .. " even " .. vowel .. "-stem nouns") umlaut_j = mw.ustring.gsub(args[1], "ē$", "i") umlaut_je = mw.ustring.gsub(umlaut_j, "ō$", "u") umlaut_e = mw.ustring.gsub(umlaut_e, "ē$", "ā") umlaut_e = mw.ustring.gsub(umlaut_e, "ō$", "u") else table.insert(data.categories, lang:getCanonicalName .. " even consonant-stem nouns") end data.forms["nom_sg"] = {args[1]} data.forms["acc_sg"] = {args[1] .. "m"} data.forms["par_sg"] = {args[1] .. "tē"} data.forms["gen_sg"] = {args[1] .. "n"} data.forms["ess_sg"] = {args[1] .. "nē"} data.forms["ine_sg"] = {args[1] .. "snē"} data.forms["ela_sg"] = {args[1] .. "stē"} data.forms["ill_sg"] = {umlaut_e .. "sën"} data.forms["com_sg"] = {umlaut_j .. "jnē", umlaut_je .. "jnë"} data.forms["abe_sg"] = {args[1] .. "ptākëk"} data.forms["nom_pl"] = {args[1] .. "k"} data.forms["acc_pl"] = {umlaut_j .. "jtē"} data.forms["gen_pl"] = {umlaut_j .. "j"} data.forms["ine_pl"] = {umlaut_j .. "jnē"} data.forms["ela_pl"] = {umlaut_j .. "jstē"} -- Apply gradation for key, forms in pairs(data.forms) do		for i, form in ipairs(forms) do			forms[i] = require("Module:smi-pro-common").apply_gradation(form) end end return make_table(data) .. require("Module:utilities").format_categories(data.categories, lang) end

function export.odd(frame) local params = { [1] = {required = true, default = ""}, }	local args = require("Module:parameters").process(frame:getParent.args, params) local data = {forms = {}, info = "odd", categories = {lang:getCanonicalName .. " odd nouns"}} local xstem = args[1] local umlaut_j = args[1] local umlaut_e = args[1] if mw.ustring.find(args[1], "[aeiouāēōë]$") then local vowel = mw.ustring.match(args[1], "[aeiouāēōë]+$") table.insert(data.categories, lang:getCanonicalName .. " odd " .. vowel .. "-stem nouns") umlaut_j = mw.ustring.gsub(args[1], "ē$", "i") umlaut_e = mw.ustring.gsub(umlaut_e, "ē$", "ā") umlaut_e = mw.ustring.gsub(umlaut_e, "ō$", "u") else table.insert(data.categories, lang:getCanonicalName .. " odd consonant-stem nouns") umlaut_e = mw.ustring.gsub(umlaut_e, "ē([^aeiouāēōë])$", "ā%1") umlaut_e = mw.ustring.gsub(umlaut_e, "ō([^aeiouāēōë])$", "u%1") xstem = umlaut_e .. "ë" end data.forms["nom_sg"] = {args[1]} data.forms["acc_sg"] = {xstem .. "m"} data.forms["par_sg"] = {args[1] .. "tē"} data.forms["gen_sg"] = {xstem .. "n"} data.forms["ess_sg"] = {args[1] .. "nē"} data.forms["ine_sg"] = {xstem .. "snē"} data.forms["ela_sg"] = {xstem .. "stē"} data.forms["ill_sg"] = {umlaut_e .. "sën"} data.forms["com_sg"] = {xstem .. "jnē", xstem .. "jnë"} data.forms["abe_sg"] = {xstem .. "ptākëk"} data.forms["nom_pl"] = {xstem .. "k"} data.forms["acc_pl"] = {xstem .. "jtē"} data.forms["gen_pl"] = {xstem .. "j"} data.forms["ine_pl"] = {xstem .. "jnē"} data.forms["ela_pl"] = {xstem .. "jstē"} -- Apply gradation for key, forms in pairs(data.forms) do		for i, form in ipairs(forms) do			forms[i] = require("Module:smi-pro-common").apply_gradation(form) end end return make_table(data) .. require("Module:utilities").format_categories(data.categories, lang) end

-- Make the table function make_table(data) local function repl(param) if param == "info" then return mw.getContentLanguage:ucfirst(data.info or "") end local form = data.forms[param] if not form then return "&mdash;" end local ret = {} for key, subform in ipairs(form) do table.insert(ret, require("Module:links").full_link({lang = lang, alt = "*" .. subform})) end return table.concat(ret, " ") end local wikicode = [=[ return mw.ustring.gsub(wikicode, "", repl) end

return export