Module:urj-fin-verbs

local m_utilities = require("Module:utilities") local m_links = require("Module:links") local m_common = require("Module:urj-fin-common")

local export = {}

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

-- The main entry point. -- This is the only function that can be invoked from a template. function export.show(frame) local args = frame:getParent.args local data = {forms = {}, title = nil, categories = {}} -- Generate the forms inflect(args, data) -- Apply gradation for key, forms in pairs(data.forms) do		for i, form in ipairs(forms) do			forms[i] = m_common.apply_gradation(form) end end -- Check if the lemma form matches the page name if data.forms["inf1"] and (lang:makeEntryName(data.forms["inf1"][1])) ~= mw.title.getCurrentTitle.subpageText then table.insert(data.categories, lang:getCanonicalName .. " entries with inflection not matching pagename") end return make_table(data) .. m_utilities.format_categories(data.categories, lang) end

function inflect(args, data) local stem = args[1]; if stem == "" then stem = nil end if not stem then if mw.title.getCurrentTitle.nsText == "Template" then stem = "-" else error("Parameter 1 (stem) must be provided") end end local overrides = {} if mw.ustring.find(stem, "da$") or mw.ustring.find(stem, "dä$") then overrides.da_stem = mw.ustring.sub(stem, -1) stem = mw.ustring.sub(stem, 1, -3) .. "t" elseif mw.ustring.find(stem, "d[eë]$") then stem = mw.ustring.sub(stem, 1, -3) .. "t" elseif mw.ustring.find(stem, "n[eë]$") and #m_common.split_syllables(stem) > 2 then overrides.ne_t_stem = true end if args["e"] or #m_common.split_syllables(stem) < 3 then overrides.inf_e = true end local stems = m_common.make_stems(stem, overrides) local vowels = m_common.detect_harmony(stem .. (args["v"] or "")) for _, t in ipairs(stems.types) do table.insert(data.categories, "Proto-Finnic verbs by type/" .. t)	end -- Make forms data.forms["pres_1sg"] = {stems.normal .. "n"} data.forms["pres_2sg"] = {stems.normal .. "t"} data.forms["pres_3sg"] = {stems.normal .. "pi", stems.final} data.forms["pres_1pl"] = {stems.normal .. "km" .. vowels.e .. "k", stems.normal .. "km" .. vowels.a .. "k"} data.forms["pres_2pl"] = {stems.normal .. "kt" .. vowels.e .. "k", stems.normal .. "kt" .. vowels.a .. "k"} data.forms["pres_3pl"] = {stems.normal .. "p" .. vowels.a .. "t", stems.final} data.forms["pres_pasv"] = {stems.normal .. "ks" .. vowels.e .. "n", stems.normal .. "tt" .. vowels.a .. "ks" .. vowels.e .. "n"} data.forms["pres_conn"] = {stems.normal .. "k"} data.forms["pres_pasv_conn"] = {stems.normal .. "kt" .. vowels.a .. "k"} data.forms["past_1sg"] = {stems.i .. "n"} data.forms["past_2sg"] = {stems.i .. "t"} data.forms["past_3sg"] = {stems.i} data.forms["past_1pl"] = {stems.i .. "m" .. vowels.e .. "k", stems.i .. "m" .. vowels.a .. "k"} data.forms["past_2pl"] = {stems.i .. "t" .. vowels.e .. "k", stems.i .. "t" .. vowels.a .. "k"} data.forms["past_3pl"] = {stems.i} data.forms["past_pasv"] = {stems.t .. "is" .. vowels.e .. "n", stems.normal .. "ttis" .. vowels.e .. "n"} data.forms["impr_2sg"] = {stems.normal .. "k"} data.forms["impr_3sg"] = {stems.k .. vowels.a .. "s" .. vowels.e .. "n"} data.forms["impr_1pl"] = {stems.k .. vowels.a .. "t" .. vowels.e .. "m" .. vowels.e .. "k", stems.k .. vowels.a .. "t" .. vowels.a .. "m" .. vowels.a .. "k"} data.forms["impr_2pl"] = {stems.k .. vowels.a .. "t" .. vowels.e, stems.k .. vowels.a .. "t" .. vowels.a} data.forms["impr_3pl"] = {stems.k .. vowels.a .. "s" .. vowels.e .. "n"} data.forms["impr_pasv"] = {stems.t .. vowels.a .. "k" .. vowels.a .. "s" .. vowels.e .. "n", stems.normal .. "tt" .. vowels.a .. "k" .. vowels.a .. "s" .. vowels.e .. "n"} data.forms["impr_conn"] = {stems.k .. vowels.a .. "k"} data.forms["impr_pasv_conn"] = {stems.t .. vowels.a .. "k" .. vowels.a .. "k", stems.normal .. "tt" .. vowels.a .. "k" .. vowels.a .. "k"} data.forms["opta_1sg"] = {stems.k .. "on"} data.forms["opta_2sg"] = {stems.k .. "os"} data.forms["opta_3sg"] = {stems.k .. "os" .. vowels.e .. "n"} data.forms["opta_1pl"] = {stems.k .. "ot" .. vowels.e .. "m" .. vowels.e .. "k", stems.k .. "ot" .. vowels.a .. "m" .. vowels.a .. "k"} data.forms["opta_2pl"] = {stems.k .. "ott" .. vowels.e .. "k", stems.k .. "ot" .. vowels.a .. "t" .. vowels.a .. "k"} data.forms["opta_3pl"] = {stems.k .. "os" .. vowels.e .. "n"} data.forms["opta_pasv"] = {stems.t .. vowels.a .. "kos" .. vowels.e .. "n", stems.normal .. "tt" .. vowels.a .. "kos" .. vowels.e .. "n"} data.forms["opta_conn"] = {stems.k .. "ok"} data.forms["opta_pasv_conn"] = {stems.t .. vowels.a .. "kok", stems.normal .. "tt" .. vowels.a .. "kok"} data.forms["cond1_1sg"] = {stems.normal .. "kcin"} data.forms["cond1_2sg"] = {stems.normal .. "kcit"} data.forms["cond1_3sg"] = {stems.normal .. "kci"} data.forms["cond1_1pl"] = {stems.normal .. "kcim" .. vowels.e .. "k", stems.normal .. "kcim" .. vowels.a .. "k"} data.forms["cond1_2pl"] = {stems.normal .. "kcit" .. vowels.e .. "k", stems.normal .. "kcit" .. vowels.a .. "k"} data.forms["cond1_3pl"] = {stems.normal .. "kci"} data.forms["cond1_pasv"] = {stems.t .. vowels.a .. "kcis" .. vowels.e .. "n", stems.normal .. "tt" .. vowels.a .. "kcis" .. vowels.e .. "n"} data.forms["cond1_conn"] = {stems.normal .. "kcik"} data.forms["cond1_pasv_conn"] = {stems.t .. vowels.a .. "kcik", stems.normal .. "tt" .. vowels.a .. "kcik"} data.forms["cond2_1sg"] = {stems.i .. "cin"} data.forms["cond2_2sg"] = {stems.i .. "cit"} data.forms["cond2_3sg"] = {stems.i .. "ci"} data.forms["cond2_1pl"] = {stems.i .. "cim" .. vowels.e .. "k", stems.i .. "cim" .. vowels.a .. "k"} data.forms["cond2_2pl"] = {stems.i .. "cit" .. vowels.e .. "k", stems.i .. "cit" .. vowels.a .. "k"} data.forms["cond2_3pl"] = {stems.i .. "ci"} data.forms["cond2_pasv"] = {stems.t .. "icis" .. vowels.e .. "n", stems.normal .. "tticis" .. vowels.e .. "n"} data.forms["cond2_conn"] = {stems.i .. "cik"} data.forms["cond2_pasv_conn"] = {stems.t .. "icik", stems.normal .. "tticik"} data.forms["potn_1sg"] = {stems.n .. vowels.e .. "n"} data.forms["potn_2sg"] = {stems.n .. vowels.e .. "t"} data.forms["potn_3sg"] = {stems.n .. "i"} data.forms["potn_1pl"] = {stems.n .. vowels.e .. "m" .. vowels.e .. "k", stems.n .. vowels.e .. "m" .. vowels.a .. "k"} data.forms["potn_2pl"] = {stems.n .. vowels.e .. "t" .. vowels.e .. "k", stems.n .. vowels.e .. "t" .. vowels.a .. "k"} data.forms["potn_3pl"] = {stems.n .. "i"} data.forms["potn_pasv"] = {stems.t .. vowels.a .. "n" .. vowels.e .. "s" .. vowels.e .. "n", stems.normal .. "tt" .. vowels.a .. "n" .. vowels.e .. "s" .. vowels.e .. "n"} data.forms["potn_conn"] = {stems.n .. vowels.e .. "k"} data.forms["potn_pasv_conn"] = {stems.t .. vowels.a .. "n" .. vowels.e .. "k", stems.normal .. "tt" .. vowels.a .. "n" .. vowels.e .. "k"} data.forms["inf1"] = {stems.t .. vowels.a .. "k"} data.forms["inf2"] = {stems.t .. vowels.e .. "-"}	data.forms["grnd"] = {stems.normal .. "m" .. vowels.a} data.forms["actn"] = {stems.normal .. "minen"} data.forms["pres_actv_ptc"] = {stems.normal .. "p" .. vowels.a} data.forms["pres_pasv_ptc"] = {stems.t .. vowels.a .. "p" .. vowels.a, stems.normal .. "tt" .. vowels.a .. "p" .. vowels.a} data.forms["past_actv_ptc"] = {stems.n .. vowels.u .. "t"} data.forms["past_pasv_ptc"] = {stems.t .. vowels.u, stems.normal .. "tt" .. vowels.u}	if stems.normal == "ole" then data.forms["pres_3sg"] = {"omi", "on"} data.forms["pres_3pl"] = {"omat"} end end

-- Functions for generating the inflection table

function show_form(form) if not form then return "&mdash;" elseif type(form) ~= "table" then error("a non-table value was given in the list of inflected forms.") end local ret = {} for key, subform in ipairs(form) do table.insert(ret, m_links.full_link({lang = lang, alt = "*" .. subform})) end return table.concat(ret, " ") end

-- Make the table function make_table(data) return [=[ Inflection of ]=] .. m_links.full_link({lang = lang, alt = "*" .. mw.title.getCurrentTitle.subpageText}, "term") .. (data.title and " (" .. data.title .. ")" or "") .. [=[ ]=]

end

return export