Module:fi-nominal

Definition from Wiktionary, the free dictionary
Jump to: navigation, search
The following documentation is located at Module:fi-nominal/documentation. [edit]
See also: subpages of this module.

This module is used for the various Finnish nominal inflection tables.


local m_utilities = require("Module:utilities")
local m_links = require("Module:links")
 
local export = {}
 
local lang = require("Module:languages").getByCode("fi")
 
-- Functions that do the actual inflecting by creating the forms of a basic term.
local inflections = {}
 
-- The main entry point.
-- This is the only function that can be invoked from a template.
function export.show(frame)
	local infl_type = frame.args[1] or error("Inflection type has not been specified. Please pass parameter 1 to the module invocation")
	local args = frame:getParent().args
 
	if not inflections[infl_type] then
		error("Unknown inflection type '" .. infl_type .. "'")
	end
 
	local data = {forms = {}, title = nil, categories = {}}
 
	-- Generate the forms
	inflections[infl_type](args, data)
 
	-- Postprocess
	postprocess(args, data)
 
	if args["apo"] then
		table.insert(data.categories, "fi-decl with apo")
	end
 
	if args["nocheck"] then
		table.insert(data.categories, "fi-decl with nocheck")
	end
 
	if args["nonav"] then
		table.insert(data.categories, "fi-decl with nonav")
	end
 
	if args["nosg"] then
		table.insert(data.categories, "fi-decl with nosg")
	end
 
	if args["nopl"] then
		table.insert(data.categories, "fi-decl with nopl")
	end
 
	if args["type"] then
		table.insert(data.categories, "fi-decl with type")
	end
 
	if args["word"] then
		table.insert(data.categories, "fi-decl with word")
	end
 
	return make_table(data) .. m_utilities.format_categories(data.categories, lang)
end
 
function get_params(args, num, default_2, default_3, default_4)
	local params = {}
 
	if num == 5 then
		params.base = args[1] or (mw.title.getCurrentTitle().nsText == "Template" and "-"); if not params.base or params.base == "" then error("Parameter 1 (base stem) may not be empty.") end
		params.nom_grade = args[2] or (mw.title.getCurrentTitle().nsText == "Template" and default_2); if not params.nom_grade then error("Parameter 2 (nominative grade) may not be omitted.") end
		params.gen_grade = args[3] or (mw.title.getCurrentTitle().nsText == "Template" and default_3); if not params.gen_grade then error("Parameter 3 (genitive grade) may not be omitted.") end
		params.final = args[4] or (mw.title.getCurrentTitle().nsText == "Template" and default_4); if not params.final or params.final == "" then error("Parameter 4 (final letter(s)) may not be empty.") end
		params.a = args[5] or (mw.title.getCurrentTitle().nsText == "Template" and "a"); if params.a ~= "a" and params.a ~= "ä" then error("Parameter 5 must be \"a\" or \"ä\".") end
	elseif num == 4 then
		params.base = args[1] or (mw.title.getCurrentTitle().nsText == "Template" and "-"); if not params.base or params.base == "" then error("Parameter 1 (base stem) may not be empty.") end
		params.nom_grade = args[2] or (mw.title.getCurrentTitle().nsText == "Template" and default_2); if not params.nom_grade then error("Parameter 2 (nominative grade) may not be omitted.") end
		params.gen_grade = args[3] or (mw.title.getCurrentTitle().nsText == "Template" and default_3); if not params.gen_grade then error("Parameter 3 (genitive grade) may not be omitted.") end
		params.a = args[4] or (mw.title.getCurrentTitle().nsText == "Template" and "a"); if params.a ~= "a" and params.a ~= "ä" then error("Parameter 4 must be \"a\" or \"ä\".") end
	elseif num == 2 then
		params.base = args[1] or (mw.title.getCurrentTitle().nsText == "Template" and "-" .. (default_2 or "")); if not params.base or params.base == "" then error("Parameter 1 (base stem) may not be empty.") end
		params.a = args[2] or (mw.title.getCurrentTitle().nsText == "Template" and "a"); if params.a ~= "a" and params.a ~= "ä" then error("Parameter 2 must be \"a\" or \"ä\".") end
	elseif num == 1 then
		params.base = args[1] or ""
	end
 
	if params.a then
		params.o = params.a == "ä" and "ö" or "o"
		params.u = params.a == "ä" and "y" or "u"
	end
 
	return params	
end
 
local make_weak = require("Module:fi-utilities").make_weak
 
--[=[
	Inflection functions
]=]--
 
inflections["valo"] = function(args, data)
	data.title = "[[Kotus]] type 1/[[Appendix:Finnish nominal inflection/valo|valo]]"
	table.insert(data.categories, "Finnish valo-type nominals")
 
	local params = get_params(args, 5, "kk", "k", "o")
 
	make_weak(params.base, params.nom_grade, params.final, params.gen_grade)
 
	if params.nom_grade == params.gen_grade then
		data.title = data.title .. ", no gradation"
	else
		data.title = data.title .. ", ''" .. params.nom_grade .. "-" .. params.gen_grade .. "'' gradation"
	end
 
	local wk_sg = params.gen_grade
	local wk_pl = params.gen_grade
 
	if mw.ustring.sub(params.base, -1) == params.final then
		if wk_sg == "" and (mw.ustring.find(params.base, "[aeiouyäö][iuy]$") or mw.ustring.find(params.base, "[iuy][eoö]$")) then
			wk_sg = "'"
		end
 
		if wk_pl == "" then
			wk_pl = "'"
		end
	end
 
	make_gen_sg_stem_forms(data, params.base .. wk_sg .. params.final, params.a)
	make_ine_pl_stem_forms(data, params.base .. wk_pl .. params.final, params.a)
 
	data.forms["nom_sg"] = {params.base .. params.nom_grade .. params.final}
	data.forms["par_sg"] = {params.base .. params.nom_grade .. params.final .. params.a}
	data.forms["ill_sg"] = {params.base .. params.nom_grade .. params.final .. params.final .. "n"}
	data.forms["ess_sg"] = {params.base .. params.nom_grade .. params.final .. "n" .. params.a}
 
	data.forms["gen_pl"] = {params.base .. params.nom_grade .. params.final .. "jen"}
	data.forms["gen_pl"].obsolete = {params.base .. params.nom_grade .. params.final .. "in"}
	data.forms["par_pl"] = {params.base .. params.nom_grade .. params.final .. "j" .. params.a}
	data.forms["ill_pl"] = {params.base .. params.nom_grade .. params.final .. "ihin"}
	data.forms["ess_pl"] = {params.base .. params.nom_grade .. params.final .. "in" .. params.a}
	data.forms["com_pl"] = {params.base .. params.nom_grade .. params.final .. "ine"}
end
 
inflections["palvelu"] = function(args, data)
	data.title = "[[Kotus]] type 2/[[Appendix:Finnish nominal inflection/palvelu|palvelu]], no gradation"
	table.insert(data.categories, "Finnish palvelu-type nominals")
 
	local params = get_params(args, 2)
	local final = mw.ustring.sub(params.base, -1)
 
	make_gen_sg_stem_forms(data, params.base, params.a)
	make_ine_pl_stem_forms(data, params.base, params.a)
 
	data.forms["nom_sg"] = {params.base}
	data.forms["par_sg"] = {params.base .. params.a}
	data.forms["ill_sg"] = {params.base .. final .. "n"}
	data.forms["ess_sg"] = {params.base .. "n" .. params.a}
 
	data.forms["gen_pl"] = {params.base .. "jen", params.base .. "iden", params.base .. "itten"}
	data.forms["gen_pl"].obsolete = {params.base .. "in"}
	data.forms["par_pl"] = {params.base .. "j" .. params.a, params.base .. "it" .. params.a}
	data.forms["ill_pl"] = {params.base .. "ihin"}
	data.forms["ess_pl"] = {params.base .. "in" .. params.a}
	data.forms["com_pl"] = {params.base .. "ine"}
end
 
inflections["valtio"] = function(args, data)
	data.title = "[[Kotus]] type 3/[[Appendix:Finnish nominal inflection/valtio|valtio]], no gradation"
	table.insert(data.categories, "Finnish valtio-type nominals")
 
	local params = get_params(args, 2)
	local final = mw.ustring.sub(params.base, -1)
 
	make_gen_sg_stem_forms(data, params.base, params.a)
	make_ine_pl_stem_forms(data, params.base, params.a)
 
	data.forms["nom_sg"] = {params.base}
	data.forms["par_sg"] = {params.base .. "t" .. params.a}
	data.forms["par_sg"].obsolete = {params.base .. params.a}
	data.forms["ill_sg"] = {params.base .. final .. "n"}
	data.forms["ess_sg"] = {params.base .. "n" .. params.a}
 
	data.forms["gen_pl"] = {params.base .. "iden", params.base .. "itten"}
	data.forms["gen_pl"].obsolete = {params.base .. "in"}
	data.forms["par_pl"] = {params.base .. "it" .. params.a}
	data.forms["ill_pl"] = {params.base .. "ihin"}
	data.forms["ess_pl"] = {params.base .. "in" .. params.a}
	data.forms["com_pl"] = {params.base .. "ine"}
end
 
inflections["laatikko"] = function(args, data)
	data.title = "[[Kotus]] type 4/[[Appendix:Finnish nominal inflection/laatikko|laatikko]]"
	table.insert(data.categories, "Finnish laatikko-type nominals")
 
	local params = get_params(args, 5, "kk", "k", "o")
 
	make_weak(params.base, params.nom_grade, params.final, params.gen_grade)
 
	if params.nom_grade == params.gen_grade then
		data.title = data.title .. ", no gradation"
	else
		data.title = data.title .. ", ''" .. params.nom_grade .. "-" .. params.gen_grade .. "'' gradation"
	end
 
	make_gen_sg_stem_forms(data, params.base .. params.gen_grade .. params.final, params.a)
	make_ine_pl_stem_forms(data, params.base .. params.gen_grade .. params.final, params.a)
 
	data.forms["nom_sg"] = {params.base .. params.nom_grade .. params.final}
	data.forms["par_sg"] = {params.base .. params.nom_grade .. params.final .. params.a}
	data.forms["ill_sg"] = {params.base .. params.nom_grade .. params.final .. params.final .. "n"}
	data.forms["ess_sg"] = {params.base .. params.nom_grade .. params.final .. "n" .. params.a}
 
	data.forms["gen_pl"] = {params.base .. params.nom_grade .. params.final .. "jen", params.base .. params.gen_grade .. params.final .. "iden", params.base .. params.gen_grade .. params.final .. "itten"}
	data.forms["gen_pl"].obsolete = {params.base .. params.gen_grade .. params.final .. "in"}
	data.forms["par_pl"] = {params.base .. params.nom_grade .. params.final .. "j" .. params.a, params.base .. params.gen_grade .. params.final .. "it" .. params.a}
	data.forms["ill_pl"] = {params.base .. params.nom_grade .. params.final .. "ihin", params.base .. params.gen_grade .. params.final .. "ihin"}
	data.forms["ess_pl"] = {params.base .. params.nom_grade .. params.final .. "in" .. params.a}
	data.forms["com_pl"] = {params.base .. params.nom_grade .. params.final .. "ine"}
end
 
inflections["risti"] = function(args, data)
	data.title = "[[Kotus]] type 5/[[Appendix:Finnish nominal inflection/risti|risti]]"
	table.insert(data.categories, "Finnish risti-type nominals")
 
	local params = get_params(args, 4, "kk", "k")
	local i = args["i"]; if i == "0" then i = "" else i = "i" end
 
	make_weak(params.base, params.nom_grade, "i", params.gen_grade)
 
	if params.nom_grade == params.gen_grade then
		data.title = data.title .. ", no gradation"
	else
		data.title = data.title .. ", ''" .. params.nom_grade .. "-" .. params.gen_grade .. "'' gradation"
	end
 
	make_gen_sg_stem_forms(data, params.base .. params.gen_grade .. "i", params.a)
	make_ine_pl_stem_forms(data, params.base .. params.gen_grade .. "e", params.a)
 
	data.forms["nom_sg"] = {params.base .. params.nom_grade .. i}
	data.forms["par_sg"] = {params.base .. params.nom_grade .. "i" .. params.a}
	data.forms["ill_sg"] = {params.base .. params.nom_grade .. "iin"}
	data.forms["ess_sg"] = {params.base .. params.nom_grade .. "in" .. params.a}
 
	data.forms["gen_pl"] = {params.base .. params.nom_grade .. "ien"}
	data.forms["gen_pl"].obsolete = {params.base .. params.nom_grade .. "ein"}
	data.forms["par_pl"] = {params.base .. params.nom_grade .. "ej" .. params.a}
	data.forms["ill_pl"] = {params.base .. params.nom_grade .. "eihin"}
	data.forms["ess_pl"] = {params.base .. params.nom_grade .. "ein" .. params.a}
	data.forms["com_pl"] = {params.base .. params.nom_grade .. "eine"}
end
 
inflections["paperi"] = function(args, data)
	data.title = "[[Kotus]] type 6/[[Appendix:Finnish nominal inflection/paperi|paperi]], no gradation"
	table.insert(data.categories, "Finnish paperi-type nominals")
 
	local params = get_params(args, 2)
	local i = args["i"]; if i == "0" then i = "" else i = "i" end
 
	make_gen_sg_stem_forms(data, params.base .. "i", params.a)
	make_ine_pl_stem_forms(data, params.base .. "e", params.a)
 
	data.forms["nom_sg"] = {params.base .. i}
	data.forms["par_sg"] = {params.base .. "i" .. params.a}
	data.forms["ill_sg"] = {params.base .. "iin"}
	data.forms["ess_sg"] = {params.base .. "in" .. params.a}
 
	data.forms["gen_pl"] = {params.base .. "ien", params.base .. "eiden", params.base .. "eitten"}
	data.forms["gen_pl"].obsolete = {params.base .. "ein"}
	data.forms["par_pl"] = {params.base .. "eit" .. params.a, params.base .. "ej" .. params.a}
	data.forms["ill_pl"] = {params.base .. "eihin"}
	data.forms["ess_pl"] = {params.base .. "ein" .. params.a}
	data.forms["com_pl"] = {params.base .. "eine"}
end
 
inflections["ovi"] = function(args, data)
	data.title = "[[Kotus]] type 7/[[Appendix:Finnish nominal inflection/ovi|ovi]]"
	table.insert(data.categories, "Finnish ovi-type nominals")
 
	local params = get_params(args, 4, "kk", "k")
	local nom_sg = args["nom_sg"]; if nom_sg == "" then nom_sg = nil end
 
	make_weak(params.base, params.nom_grade, "e", params.gen_grade)
 
	if params.nom_grade == params.gen_grade then
		data.title = data.title .. ", no gradation"
	else
		data.title = data.title .. ", ''" .. params.nom_grade .. "-" .. params.gen_grade .. "'' gradation"
	end
 
	make_gen_sg_stem_forms(data, params.base .. params.gen_grade .. "e", params.a)
	make_ine_pl_stem_forms(data, params.base .. params.gen_grade, params.a)
 
	data.forms["nom_sg"] = {nom_sg or params.base .. params.nom_grade .. "i"}
	data.forms["par_sg"] = {params.base .. params.nom_grade .. "e" .. params.a}
	data.forms["ill_sg"] = {params.base .. params.nom_grade .. "een"}
	data.forms["ess_sg"] = {params.base .. params.nom_grade .. "en" .. params.a}
 
	data.forms["gen_pl"] = {params.base .. params.nom_grade .. "ien"}
	data.forms["gen_pl"].obsolete = {params.base .. params.nom_grade .. "ein"}
	data.forms["par_pl"] = {params.base .. params.nom_grade .. "i" .. params.a}
	data.forms["ill_pl"] = {params.base .. params.nom_grade .. "iin"}
	data.forms["ess_pl"] = {params.base .. params.nom_grade .. "in" .. params.a}
	data.forms["com_pl"] = {params.base .. params.nom_grade .. "ine"}
end
 
inflections["nalle"] = function(args, data)
	data.title = "[[Kotus]] type 8/[[Appendix:Finnish nominal inflection/nalle|nalle]]"
	table.insert(data.categories, "Finnish nalle-type nominals")
 
	local params = get_params(args, 4, "kk", "k")
 
	make_weak(params.base, params.nom_grade, "e", params.gen_grade)
 
	if params.nom_grade == params.gen_grade then
		data.title = data.title .. ", no gradation"
	else
		data.title = data.title .. ", ''" .. params.nom_grade .. "-" .. params.gen_grade .. "'' gradation"
	end
 
	make_gen_sg_stem_forms(data, params.base .. params.gen_grade .. "e", params.a)
	make_ine_pl_stem_forms(data, params.base .. params.gen_grade .. "e", params.a)
 
	data.forms["nom_sg"] = {params.base .. params.nom_grade .. "e"}
	data.forms["par_sg"] = {params.base .. params.nom_grade .. "e" .. params.a}
	data.forms["ill_sg"] = {params.base .. params.nom_grade .. "een"}
	data.forms["ess_sg"] = {params.base .. params.nom_grade .. "en" .. params.a}
 
	data.forms["gen_pl"] = {params.base .. params.nom_grade .. "ejen"}
	data.forms["gen_pl"].rare = {params.base .. params.nom_grade .. "ein"}
	data.forms["par_pl"] = {params.base .. params.nom_grade .. "ej" .. params.a}
	data.forms["ill_pl"] = {params.base .. params.nom_grade .. "eihin"}
	data.forms["ess_pl"] = {params.base .. params.nom_grade .. "ein" .. params.a}
	data.forms["com_pl"] = {params.base .. params.nom_grade .. "eine"}
end
 
inflections["kala"] = function(args, data)
	data.title = "[[Kotus]] type 9/[[Appendix:Finnish nominal inflection/kala|kala]]"
	table.insert(data.categories, "Finnish kala-type nominals")
 
	local params = get_params(args, 4, "kk", "k")
 
	make_weak(params.base, params.nom_grade, params.a, params.gen_grade)
 
	if params.nom_grade == params.gen_grade then
		data.title = data.title .. ", no gradation"
	else
		data.title = data.title .. ", ''" .. params.nom_grade .. "-" .. params.gen_grade .. "'' gradation"
	end
 
	local wk_sg = params.gen_grade
 
	if wk_sg == "" and mw.ustring.sub(params.base, -2) == params.a .. params.a then
		wk_sg = "'"
	end
 
	make_gen_sg_stem_forms(data, params.base .. wk_sg .. params.a, params.a)
	make_ine_pl_stem_forms(data, params.base .. params.gen_grade .. params.o, params.a)
 
	data.forms["nom_sg"] = {params.base .. params.nom_grade .. params.a}
	data.forms["par_sg"] = {params.base .. params.nom_grade .. params.a .. params.a}
	data.forms["ill_sg"] = {params.base .. params.nom_grade .. params.a .. params.a .. "n"}
	data.forms["ess_sg"] = {params.base .. params.nom_grade .. params.a .. "n" .. params.a}
 
	data.forms["gen_pl"] = {params.base .. params.nom_grade .. params.o .. "jen"}
	data.forms["gen_pl"].rare = {params.base .. params.nom_grade .. params.a .. "in"}
	data.forms["par_pl"] = {params.base .. params.nom_grade .. params.o .. "j" .. params.a}
	data.forms["ill_pl"] = {params.base .. params.nom_grade .. params.o .. "ihin"}
	data.forms["ess_pl"] = {params.base .. params.nom_grade .. params.o .. "in" .. params.a}
	data.forms["com_pl"] = {params.base .. params.nom_grade .. params.o .. "ine"}
end
 
inflections["koira"] = function(args, data)
	data.title = "[[Kotus]] type 10/[[Appendix:Finnish nominal inflection/koira|koira]]"
	table.insert(data.categories, "Finnish koira-type nominals")
 
	local params = get_params(args, 4, "kk", "k")
 
	make_weak(params.base, params.nom_grade, params.a, params.gen_grade)
 
	if params.nom_grade == params.gen_grade then
		data.title = data.title .. ", no gradation"
	else
		data.title = data.title .. ", ''" .. params.nom_grade .. "-" .. params.gen_grade .. "'' gradation"
	end
 
	local wk_sg = params.gen_grade
	local wk_pl = params.gen_grade
 
	if wk_sg == "" and mw.ustring.sub(params.base, -2) == params.a .. params.a then
		wk_sg = "'"
	end
 
	if wk_pl == "" and mw.ustring.sub(params.base, -1) == "i" then
		wk_pl = "'"
	end
 
	make_gen_sg_stem_forms(data, params.base .. wk_sg .. params.a, params.a)
	make_ine_pl_stem_forms(data, params.base .. wk_pl, params.a)
 
	data.forms["nom_sg"] = {params.base .. params.nom_grade .. params.a}
	data.forms["par_sg"] = {params.base .. params.nom_grade .. params.a .. params.a}
	data.forms["ill_sg"] = {params.base .. params.nom_grade .. params.a .. params.a .. "n"}
	data.forms["ess_sg"] = {params.base .. params.nom_grade .. params.a .. "n" .. params.a}
 
	data.forms["gen_pl"] = {params.base .. params.nom_grade .. "ien"}
	data.forms["gen_pl"].rare = {params.base .. params.nom_grade .. params.a .. "in"}
	data.forms["par_pl"] = {params.base .. params.nom_grade .. "i" .. params.a}
	data.forms["ill_pl"] = {params.base .. params.nom_grade .. "iin"}
	data.forms["ess_pl"] = {params.base .. params.nom_grade .. "in" .. params.a}
	data.forms["com_pl"] = {params.base .. params.nom_grade .. "ine"}
end
 
inflections["omena"] = function(args, data)
	data.title = "[[Kotus]] type 11/[[Appendix:Finnish nominal inflection/omena|omena]], no gradation"
	table.insert(data.categories, "Finnish omena-type nominals")
 
	local params = get_params(args, 2)
 
	-- TODO: make it possible to use make_ine_pl_stem_forms here too
	make_gen_sg_stem_forms(data, params.base .. params.a, params.a)
	local ine_pl_stem = params.base .. params.o
	local ine_pl_stem2 = params.base
 
	data.forms["nom_sg"] = {params.base .. params.a}
	data.forms["par_sg"] = {params.base .. params.a .. params.a}
	data.forms["ill_sg"] = {params.base .. params.a .. params.a .. "n"}
	data.forms["ess_sg"] = {params.base .. params.a .. "n" .. params.a}
 
	data.forms["gen_pl"] = {params.base .. "ien", params.base .. params.o .. "iden", params.base .. params.o .. "itten"}
	data.forms["gen_pl"].rare = {params.base .. params.o .. "jen", params.base .. params.a .. "in"}
	data.forms["par_pl"] = {params.base .. "i" .. params.a, params.base .. params.o .. "it" .. params.a}
	data.forms["par_pl"].rare = {params.base .. params.o .. "j" .. params.a}
	data.forms["ine_pl"] = {ine_pl_stem .. "iss" .. params.a, ine_pl_stem2 .. "iss" .. params.a}
	data.forms["ela_pl"] = {ine_pl_stem .. "ist" .. params.a, ine_pl_stem2 .. "ist" .. params.a}
	data.forms["ill_pl"] = {params.base .. "iin", params.base .. params.o .. "ihin"}
	data.forms["ade_pl"] = {ine_pl_stem .. "ill" .. params.a, ine_pl_stem2 .. "ill" .. params.a}
	data.forms["abl_pl"] = {ine_pl_stem .. "ilt" .. params.a, ine_pl_stem2 .. "ilt" .. params.a}
	data.forms["all_pl"] = {ine_pl_stem .. "ille", ine_pl_stem2 .. "ille"}
	data.forms["ess_pl"] = {params.base .. params.o .. "in" .. params.a, params.base .. "in" .. params.a}
	data.forms["tra_pl"] = {ine_pl_stem .. "iksi", ine_pl_stem2 .. "iksi"}
	data.forms["ins_pl"] = {ine_pl_stem .. "in", ine_pl_stem2 .. "in"}
	data.forms["abe_pl"] = {ine_pl_stem .. "itt" .. params.a, ine_pl_stem2 .. "itt" .. params.a}
	data.forms["com_pl"] = {params.base .. params.o .. "ine", params.base .. "ine"}
end
 
inflections["kulkija"] = function(args, data)
	data.title = "[[Kotus]] type 12/[[Appendix:Finnish nominal inflection/kulkija|kulkija]], no gradation"
	table.insert(data.categories, "Finnish kulkija-type nominals")
 
	local params = get_params(args, 2)
 
	make_gen_sg_stem_forms(data, params.base .. params.a, params.a)
	make_ine_pl_stem_forms(data, params.base .. params.o, params.a)
 
	data.forms["nom_sg"] = {params.base .. params.a}
	data.forms["par_sg"] = {params.base .. params.a .. params.a}
	data.forms["par_sg"].obsolete = {params.base .. params.a .. "t" .. params.a}
	data.forms["ill_sg"] = {params.base .. params.a .. params.a .. "n"}
	data.forms["ess_sg"] = {params.base .. params.a .. "n" .. params.a}
 
	data.forms["gen_pl"] = {params.base .. params.o .. "iden", params.base .. params.o .. "itten"}
	data.forms["gen_pl"].rare = {params.base .. params.a .. "in"}
	data.forms["par_pl"] = {params.base .. params.o .. "it" .. params.a}
	data.forms["ill_pl"] = {params.base .. params.o .. "ihin"}
	data.forms["ess_pl"] = {params.base .. params.o .. "in" .. params.a}
	data.forms["com_pl"] = {params.base .. params.o .. "ine"}
end
 
inflections["katiska"] = function(args, data)
	data.title = "[[Kotus]] type 13/[[Appendix:Finnish nominal inflection/katiska|katiska]], no gradation"
	table.insert(data.categories, "Finnish katiska-type nominals")
 
	local params = get_params(args, 2)
	local st_stem = params.base
	local wk_stem = params.base
 
	make_gen_sg_stem_forms(data, wk_stem .. params.a, params.a)
	make_ine_pl_stem_forms(data, wk_stem .. params.o, params.a)
 
	data.forms["nom_sg"] = {st_stem .. params.a}
	data.forms["par_sg"] = {st_stem .. params.a .. params.a}
	data.forms["par_sg"].obsolete = {st_stem .. params.a .. "t" .. params.a}
	data.forms["ill_sg"] = {st_stem .. params.a .. params.a .. "n"}
	data.forms["ess_sg"] = {st_stem .. params.a .. "n" .. params.a}
 
	data.forms["gen_pl"] = {wk_stem .. params.o .. "iden", wk_stem .. params.o .. "itten", st_stem .. params.o .. "jen"}
	data.forms["gen_pl"].rare = {st_stem .. params.a .. "in"}
	data.forms["par_pl"] = {wk_stem .. params.o .. "it" .. params.a, st_stem .. params.o .. "j" .. params.a}
	data.forms["ill_pl"] = {st_stem .. params.o .. "ihin", (st_stem ~= wk_stem and wk_stem .. params.o .. "ihin" or nil)}
	data.forms["ess_pl"] = {st_stem .. params.o .. "in" .. params.a}
	data.forms["com_pl"] = {st_stem .. params.o .. "ine"}
end
 
inflections["solakka"] = function(args, data)
	data.title = "[[Kotus]] type 14/[[Appendix:Finnish nominal inflection/solakka|solakka]]"
	table.insert(data.categories, "Finnish solakka-type nominals")
 
	local params = get_params(args, 4, "kk", "k")
 
	make_weak(params.base, params.nom_grade, params.a, params.gen_grade)
 
	if params.nom_grade == params.gen_grade then
		data.title = data.title .. ", no gradation"
	else
		data.title = data.title .. ", ''" .. params.nom_grade .. "-" .. params.gen_grade .. "'' gradation"
	end
 
	make_gen_sg_stem_forms(data, params.base .. params.gen_grade .. params.a, params.a)
	make_ine_pl_stem_forms(data, params.base .. params.gen_grade .. params.o, params.a)
 
	data.forms["nom_sg"] = {params.base .. params.nom_grade .. params.a}
	data.forms["par_sg"] = {params.base .. params.nom_grade .. params.a .. params.a}
	data.forms["par_sg"].obsolete = {params.base .. params.nom_grade .. params.a .. "t" .. params.a}
	data.forms["ill_sg"] = {params.base .. params.nom_grade .. params.a .. params.a .. "n"}
	data.forms["ess_sg"] = {params.base .. params.nom_grade .. params.a .. "n" .. params.a}
 
	data.forms["gen_pl"] = {params.base .. params.gen_grade .. params.o .. "iden", params.base .. params.gen_grade .. params.o .. "itten", params.base .. params.nom_grade .. params.o .. "jen"}
	data.forms["gen_pl"].rare = {params.base .. params.nom_grade .. params.a .. "in"}
	data.forms["par_pl"] = {params.base .. params.gen_grade .. params.o .. "it" .. params.a, params.base .. params.nom_grade .. params.o .. "j" .. params.a}
	data.forms["ill_pl"] = {params.base .. params.nom_grade .. params.o .. "ihin", (params.nom_grade ~= params.gen_grade and params.base .. params.gen_grade .. params.o .. "ihin" or nil)}
	data.forms["ess_pl"] = {params.base .. params.nom_grade .. params.o .. "in" .. params.a}
	data.forms["com_pl"] = {params.base .. params.nom_grade .. params.o .. "ine"}
end
 
inflections["korkea"] = function(args, data)
	data.title = "[[Kotus]] type 15/[[Appendix:Finnish nominal inflection/korkea|korkea]], no gradation"
	table.insert(data.categories, "Finnish korkea-type nominals")
 
	local params = get_params(args, 2)
	local final = mw.ustring.sub(params.base, -1)
 
	make_gen_sg_stem_forms(data, params.base .. params.a, params.a)
	make_ine_pl_stem_forms(data, params.base, params.a)
 
	data.forms["nom_sg"] = {params.base .. params.a}
	data.forms["nom_sg"].obsolete = {params.base .. final}
	data.forms["gen_sg"].obsolete = {params.base .. final .. "n"}
	data.forms["par_sg"] = {params.base .. params.a .. params.a, params.base .. params.a .. "t" .. params.a}
	data.forms["par_sg"].obsolete = {params.base .. final .. "t" .. params.a}
	data.forms["ill_sg"] = {params.base .. params.a .. params.a .. "n"}
	data.forms["ess_sg"] = {params.base .. params.a .. "n" .. params.a}
	data.forms["ess_sg"].obsolete = {params.base .. final .. "n" .. params.a}
 
	data.forms["gen_pl"] = {params.base .. "iden", params.base .. "itten"}
	data.forms["gen_pl"].rare = {params.base .. params.a .. "in"}
	data.forms["par_pl"] = {params.base .. "it" .. params.a}
	data.forms["ill_pl"] = {params.base .. "isiin", params.base .. "ihin"}
	data.forms["ess_pl"] = {params.base .. "in" .. params.a}
	data.forms["com_pl"] = {params.base .. "ine"}
end
 
inflections["vanhempi"] = function(args, data)
	data.title = "[[Kotus]] type 16/[[Appendix:Finnish nominal inflection/vanhempi|vanhempi]]"
	table.insert(data.categories, "Finnish vanhempi-type nominals")
 
	local params = get_params(args, 2)
	local st_stem = params.base .. "mp"
	local wk_stem = params.base .. "mm"
 
	if params.nom_grade == params.gen_grade then
		data.title = data.title .. ", no gradation"
	else
		data.title = data.title .. ", ''mp-mm'' gradation"
	end
 
	make_gen_sg_stem_forms(data, wk_stem .. params.a, params.a)
	make_ine_pl_stem_forms(data, wk_stem, params.a)
 
	data.forms["nom_sg"] = {st_stem .. "i"}
	data.forms["par_sg"] = {st_stem .. params.a .. params.a}
	data.forms["par_sg"].obsolete = {st_stem .. params.a .. "t" .. params.a}
	data.forms["ill_sg"] = {st_stem .. params.a .. params.a .. "n"}
	data.forms["ess_sg"] = {st_stem .. params.a .. "n" .. params.a}
 
	data.forms["gen_pl"] = {st_stem .. "ien"}
	data.forms["gen_pl"].rare = {st_stem .. params.a .. "in"}
	data.forms["par_pl"] = {st_stem .. "i" .. params.a}
	data.forms["ill_pl"] = {st_stem .. "iin"}
	data.forms["ess_pl"] = {st_stem .. "in" .. params.a}
	data.forms["com_pl"] = {st_stem .. "ine"}
end
 
inflections["vapaa"] = function(args, data)
	data.title = "[[Kotus]] type 17/[[Appendix:Finnish nominal inflection/vapaa|vapaa]], no gradation"
	table.insert(data.categories, "Finnish vapaa-type nominals")
 
	local params = get_params(args, 2)
	local final = mw.ustring.sub(params.base, -1)
 
	make_gen_sg_stem_forms(data, params.base .. final, params.a)
	make_ine_pl_stem_forms(data, params.base, params.a)
 
	data.forms["nom_sg"] = {params.base .. final}
	data.forms["gen_sg"].obsolete = {params.base .. "h" .. final .. "n"}
	data.forms["par_sg"] = {params.base .. final .. "t" .. params.a}
	data.forms["ill_sg"] = {params.base .. final .. "seen"}
	data.forms["ill_sg"].obsolete = {params.base .. "h" .. final .. "sen"}
	data.forms["ess_sg"] = {params.base .. final .. "n" .. params.a}
	data.forms["ess_sg"].obsolete = {params.base .. "h" .. final .. "n" .. params.a}
 
	data.forms["gen_pl"] = {params.base .. "iden", params.base .. "itten"}
	data.forms["gen_pl"].obsolete = {params.base .. "hien", params.base .. "hitten"}
	data.forms["par_pl"] = {params.base .. "it" .. params.a}
	data.forms["par_pl"].obsolete = {params.base .. "hi" .. params.a}
	data.forms["ill_pl"] = {params.base .. "isiin"}
	data.forms["ill_pl"].rare = {params.base .. "ihin"}
	data.forms["ill_pl"].obsolete = {params.base .. "hisin"}
	data.forms["ess_pl"] = {params.base .. "in" .. params.a}
	data.forms["com_pl"] = {params.base .. "ine"}
end
 
inflections["maa"] = function(args, data)
	data.title = "[[Kotus]] type 18/[[Appendix:Finnish nominal inflection/maa|maa]], no gradation"
	table.insert(data.categories, "Finnish maa-type nominals")
 
	local params = get_params(args, 2)
	local nom_sg = args["nom_sg"]; if nom_sg == "" then nom_sg = nil end
	local final = mw.ustring.sub(params.base, -1)
	local pl_stem = mw.ustring.sub(params.base, 1, -2)
 
	make_gen_sg_stem_forms(data, params.base, params.a)
	make_ine_pl_stem_forms(data, pl_stem, params.a)
 
	data.forms["nom_sg"] = {nom_sg or params.base}
	data.forms["par_sg"] = {params.base .. "t" .. params.a}
	data.forms["ill_sg"] = {params.base .. "h" .. final .. "n"}
	data.forms["ess_sg"] = {params.base .. "n" .. params.a}
 
	data.forms["gen_pl"] = {pl_stem .. "iden", pl_stem .. "itten"}
	data.forms["par_pl"] = {pl_stem .. "it" .. params.a}
	data.forms["ill_pl"] = {pl_stem .. "ihin"}
	data.forms["ess_pl"] = {pl_stem .. "in" .. params.a}
	data.forms["com_pl"] = {pl_stem .. "ine"}
end
 
inflections["suo"] = function(args, data)
	data.title = "[[Kotus]] type 19/[[Appendix:Finnish nominal inflection/suo|suo]], no gradation"
	table.insert(data.categories, "Finnish suo-type nominals")
 
	local params = get_params(args, 2)
	local final = mw.ustring.sub(params.base, -1)
	local plural = mw.ustring.sub(params.base, 1, -3) .. final
 
	make_gen_sg_stem_forms(data, params.base, params.a)
	make_ine_pl_stem_forms(data, plural, params.a)
 
	data.forms["nom_sg"] = {params.base}
	data.forms["par_sg"] = {params.base .. "t" .. params.a}
	data.forms["ill_sg"] = {params.base .. "h" .. final .. "n"}
	data.forms["ess_sg"] = {params.base .. "n" .. params.a}
 
	data.forms["gen_pl"] = {plural .. "iden", plural .. "itten"}
	data.forms["par_pl"] = {plural .. "it" .. params.a}
	data.forms["ill_pl"] = {plural .. "ihin"}
	data.forms["ess_pl"] = {plural .. "in" .. params.a}
	data.forms["com_pl"] = {plural .. "ine"}
end
 
inflections["filee"] = function(args, data)
	data.title = "[[Kotus]] type 20/[[Appendix:Finnish nominal inflection/filee|filee]], no gradation"
	table.insert(data.categories, "Finnish filee-type nominals")
 
	local params = get_params(args, 2)
	local pl_stem = mw.ustring.sub(params.base, 1, -2)
	local final = mw.ustring.sub(params.base, -1)
 
	make_gen_sg_stem_forms(data, params.base, params.a)
	make_ine_pl_stem_forms(data, pl_stem, params.a)
 
	data.forms["nom_sg"] = {params.base}
	data.forms["par_sg"] = {params.base .. "t" .. params.a}
	data.forms["ill_sg"] = {params.base .. "h" .. final .. "n", params.base .. "seen"}
	data.forms["ess_sg"] = {params.base .. "n" .. params.a}
 
	data.forms["gen_pl"] = {pl_stem .. "iden", pl_stem .. "itten"}
	data.forms["par_pl"] = {pl_stem .. "it" .. params.a}
	data.forms["ill_pl"] = {pl_stem .. "ihin", pl_stem .. "isiin"}
	data.forms["ess_pl"] = {pl_stem .. "in" .. params.a}
	data.forms["com_pl"] = {pl_stem .. "ine"}
end
 
inflections["rosé"] = function(args, data)
	data.title = "[[Kotus]] type 21/[[Appendix:Finnish nominal inflection/rosé|rosé]], no gradation"
	table.insert(data.categories, "Finnish rosé-type nominals")
 
	local params = get_params(args, 2)
	local ill_sg_vowel = args["ill_sg_vowel"]; if ill_sg_vowel == "" then error("Parameter \"ill_sg_vowel=\" cannot be empty.") end
	local ill_sg_vowel2 = args["ill_sg_vowel2"]; if ill_sg_vowel2 == "" then error("Parameter \"ill_sg_vowel2=\" cannot be empty.") end
	local final = mw.ustring.sub(params.base, -1)
 
	make_gen_sg_stem_forms(data, params.base, params.a)
	make_ine_pl_stem_forms(data, params.base, params.a)
 
	data.forms["nom_sg"] = {params.base}
	data.forms["par_sg"] = {params.base .. "t" .. params.a}
	data.forms["ill_sg"] = {params.base .. "h" .. (ill_sg_vowel or final) .. "n", (ill_sg_vowel2 and params.base .. "h" .. ill_sg_vowel2 .. "n" or nil)}
	data.forms["ess_sg"] = {params.base .. "n" .. params.a}
 
	data.forms["gen_pl"] = {params.base .. "iden"}
	data.forms["gen_pl"].obsolete = {params.base .. "itten"}
	data.forms["par_pl"] = {params.base .. "it" .. params.a}
	data.forms["ill_pl"] = {params.base .. "ihin"}
	data.forms["ess_pl"] = {params.base .. "in" .. params.a}
	data.forms["com_pl"] = {params.base .. "ine"}
end
 
inflections["parfait"] = function(args, data)
	data.title = "[[Kotus]] type 22/[[Appendix:Finnish nominal inflection/parfait|parfait]], no gradation"
	table.insert(data.categories, "Finnish parfait-type nominals")
 
	local params = get_params(args, 2)
	local ill_sg_vowel = args["ill_sg_vowel"] or (mw.title.getCurrentTitle().nsText == "Template" and "e"); if not ill_sg_vowel or ill_sg_vowel == "" then error("Parameter \"ill_sg_vowel=\" is missing.") end
	local ill_sg_vowel2 = args["ill_sg_vowel2"]; if ill_sg_vowel2 == "" then error("Parameter \"ill_sg_vowel2=\" cannot be empty.") end
 
	make_gen_sg_stem_forms(data, params.base .. "'", params.a)
	make_ine_pl_stem_forms(data, params.base .. "'", params.a)
 
	data.forms["nom_sg"] = {params.base}
	data.forms["par_sg"] = {params.base .. "'t" .. params.a}
	data.forms["ill_sg"] = {params.base .. "'h" .. ill_sg_vowel .. "n", (ill_sg_vowel2 and params.base .. "'h" .. ill_sg_vowel2 .. "n" or nil)}
	data.forms["ess_sg"] = {params.base .. "'n" .. params.a}
 
	data.forms["gen_pl"] = {params.base .. "'iden"}
	data.forms["gen_pl"].obsolete = {params.base .. "'itten"}
	data.forms["par_pl"] = {params.base .. "'it" .. params.a}
	data.forms["ill_pl"] = {params.base .. "'ihin"}
	data.forms["ess_pl"] = {params.base .. "'in" .. params.a}
	data.forms["com_pl"] = {params.base .. "'ine"}
end
 
inflections["tiili"] = function(args, data)
	data.title = "[[Kotus]] type 23/[[Appendix:Finnish nominal inflection/tiili|tiili]], no gradation"
	table.insert(data.categories, "Finnish tiili-type nominals")
 
	local params = get_params(args, 2)
 
	make_gen_sg_stem_forms(data, params.base .. "e", params.a)
	make_ine_pl_stem_forms(data, params.base, params.a)
 
	data.forms["nom_sg"] = {params.base .. "i"}
	data.forms["par_sg"] = {params.base .. "t" .. params.a}
	data.forms["ill_sg"] = {params.base .. "een"}
	data.forms["ess_sg"] = {params.base .. "en" .. params.a}
 
	data.forms["gen_pl"] = {params.base .. "ien"}
	data.forms["par_pl"] = {params.base .. "i" .. params.a}
	data.forms["ill_pl"] = {params.base .. "iin"}
	data.forms["ess_pl"] = {params.base .. "in" .. params.a}
	data.forms["com_pl"] = {params.base .. "ine"}
end
 
inflections["uni"] = function(args, data)
	data.title = "[[Kotus]] type 24/[[Appendix:Finnish nominal inflection/uni|uni]], no gradation"
	table.insert(data.categories, "Finnish uni-type nominals")
 
	local params = get_params(args, 2)
	local par_sg_a = args["par_sg_a"] or params.a; if par_sg_a ~= "a" and par_sg_a ~= "ä" then error("Parameter \"par_sg_a=\" must be \"a\" or \"ä\".") end
 
	make_gen_sg_stem_forms(data, params.base .. "e", params.a)
	make_ine_pl_stem_forms(data, params.base, params.a)
 
	data.forms["nom_sg"] = {params.base .. "i"}
	data.forms["par_sg"] = {params.base .. "t" .. par_sg_a}
	data.forms["ill_sg"] = {params.base .. "een"}
	data.forms["ess_sg"] = {params.base .. "en" .. params.a}
 
	data.forms["gen_pl"] = {params.base .. "ien", params.base .. "ten"}
	data.forms["par_pl"] = {params.base .. "i" .. params.a}
	data.forms["ill_pl"] = {params.base .. "iin"}
	data.forms["ess_pl"] = {params.base .. "in" .. params.a}
	data.forms["com_pl"] = {params.base .. "ine"}
end
 
inflections["toimi"] = function(args, data)
	data.title = "[[Kotus]] type 25/[[Appendix:Finnish nominal inflection/toimi|toimi]], no gradation"
	table.insert(data.categories, "Finnish toimi-type nominals")
 
	local params = get_params(args, 2)
 
	make_gen_sg_stem_forms(data, params.base .. "me", params.a)
	make_ine_pl_stem_forms(data, params.base .. "m", params.a)
 
	data.forms["nom_sg"] = {params.base .. "mi"}
	data.forms["par_sg"] = {params.base .. "nt" .. params.a, params.base .. "me" .. params.a}
	data.forms["ill_sg"] = {params.base .. "meen"}
	data.forms["ess_sg"] = {params.base .. "men" .. params.a}
 
	data.forms["gen_pl"] = {params.base .. "mien", params.base .. "nten"}
	data.forms["par_pl"] = {params.base .. "mi" .. params.a}
	data.forms["ill_pl"] = {params.base .. "miin"}
	data.forms["ess_pl"] = {params.base .. "min" .. params.a}
	data.forms["com_pl"] = {params.base .. "mine"}
end
 
inflections["pieni"] = function(args, data)
	data.title = "[[Kotus]] type 26/[[Appendix:Finnish nominal inflection/pieni|pieni]], no gradation"
	table.insert(data.categories, "Finnish pieni-type nominals")
 
	local params = get_params(args, 2)
	local par_sg_a = args["par_sg_a"] or params.a; if par_sg_a ~= "a" and par_sg_a ~= "ä" then error("Parameter \"par_sg_a=\" must be \"a\" or \"ä\".") end
 
	make_gen_sg_stem_forms(data, params.base .. "e", params.a)
	make_ine_pl_stem_forms(data, params.base, params.a)
 
	data.forms["nom_sg"] = {params.base .. "i"}
	data.forms["par_sg"] = {params.base .. "t" .. par_sg_a}
	data.forms["ill_sg"] = {params.base .. "een"}
	data.forms["ess_sg"] = {params.base .. "en" .. params.a}
 
	data.forms["gen_pl"] = {params.base .. "ten", params.base .. "ien"}
	data.forms["par_pl"] = {params.base .. "i" .. params.a}
	data.forms["ill_pl"] = {params.base .. "iin"}
	data.forms["ess_pl"] = {params.base .. "in" .. params.a}
	data.forms["com_pl"] = {params.base .. "ine"}
end
 
inflections["käsi"] = function(args, data)
	data.title = "[[Kotus]] type 27/[[Appendix:Finnish nominal inflection/käsi|käsi]], ''t-d'' gradation"
	table.insert(data.categories, "Finnish käsi-type nominals")
 
	local params = get_params(args, 2)
 
	make_gen_sg_stem_forms(data, params.base .. "de", params.a)
	make_ine_pl_stem_forms(data, params.base .. "s", params.a)
 
	data.forms["nom_sg"] = {params.base .. "si"}
	data.forms["par_sg"] = {params.base .. "tt" .. params.a}
	data.forms["ill_sg"] = {params.base .. "teen"}
	data.forms["ess_sg"] = {params.base .. "ten" .. params.a}
 
	data.forms["gen_pl"] = {params.base .. "sien"}
	data.forms["gen_pl"].rare = {params.base .. "tten"}
	data.forms["par_pl"] = {params.base .. "si" .. params.a}
	data.forms["ill_pl"] = {params.base .. "siin"}
	data.forms["ess_pl"] = {params.base .. "sin" .. params.a}
	data.forms["com_pl"] = {params.base .. "sine"}
end
 
inflections["kynsi"] = function(args, data)
	data.title = "[[Kotus]] type 28/[[Appendix:Finnish nominal inflection/kynsi|kynsi]]"
	table.insert(data.categories, "Finnish kynsi-type nominals")
 
	local params = get_params(args, 2, "n")
	local final = mw.ustring.sub(params.base, -1)
 
	if final ~= "l" and final ~= "n" and final ~= "r" then
		error("Stem must end in \"l\", \"n\" or \"r\".")
	end
 
	data.title = data.title .. ", ''" .. final .. "t-" .. final .. final .. "'' gradation"
 
	local st_stem = params.base .. "t"
	local wk_stem = params.base .. final
 
	make_gen_sg_stem_forms(data, wk_stem .. "e", params.a)
	make_ine_pl_stem_forms(data, params.base .. "s", params.a)
 
	data.forms["nom_sg"] = {params.base .. "si"}
	data.forms["par_sg"] = {st_stem .. "t" .. params.a}
	data.forms["ill_sg"] = {st_stem .. "een"}
	data.forms["ess_sg"] = {st_stem .. "en" .. params.a}
 
	data.forms["gen_pl"] = {params.base .. "sien"}
	data.forms["gen_pl"].rare = {st_stem .. "ten"}
	data.forms["par_pl"] = {params.base .. "si" .. params.a}
	data.forms["ill_pl"] = {params.base .. "siin"}
	data.forms["ess_pl"] = {params.base .. "sin" .. params.a}
	data.forms["com_pl"] = {params.base .. "sine"}
end
 
inflections["lapsi"] = function(args, data)
	data.title = "[[Kotus]] type 29/[[Appendix:Finnish nominal inflection/lapsi|lapsi]], no gradation"
	table.insert(data.categories, "Finnish lapsi-type nominals")
 
	local params = get_params(args, 2, "p")
	local final = mw.ustring.sub(params.base, -1)
	local sync_stem = mw.ustring.sub(params.base, 1, -2)
 
	if final ~= "k" and final ~= "p" then
		error("Stem must end in \"k\" or \"p\".")
	end
 
	make_gen_sg_stem_forms(data, params.base .. "se", params.a)
	make_ine_pl_stem_forms(data, params.base .. "s", params.a)
 
	data.forms["nom_sg"] = {params.base .. "si"}
	data.forms["par_sg"] = {sync_stem .. "st" .. params.a}
	data.forms["ill_sg"] = {params.base .. "seen"}
	data.forms["ess_sg"] = {params.base .. "sen" .. params.a}
 
	data.forms["gen_pl"] = {params.base .. "sien", sync_stem .. "sten"}
	data.forms["par_pl"] = {params.base .. "si" .. params.a}
	data.forms["ill_pl"] = {params.base .. "siin"}
	data.forms["ess_pl"] = {params.base .. "sin" .. params.a}
	data.forms["com_pl"] = {params.base .. "sine"}
end
 
inflections["veitsi"] = function(args, data)
	data.title = "[[Kotus]] type 30/[[Appendix:Finnish nominal inflection/veitsi|veitsi]], no gradation"
	table.insert(data.categories, "Finnish veitsi-type nominals")
 
	local params = get_params(args, 2)
 
	make_gen_sg_stem_forms(data, params.base .. "tse", params.a)
	make_ine_pl_stem_forms(data, params.base .. "ts", params.a)
 
	data.forms["nom_sg"] = {params.base .. "tsi"}
	data.forms["par_sg"] = {params.base .. "st" .. params.a}
	data.forms["ill_sg"] = {params.base .. "tseen"}
	data.forms["ess_sg"] = {params.base .. "tsen" .. params.a}
 
	data.forms["gen_pl"] = {params.base .. "tsien"}
	data.forms["gen_pl"].rare = {params.base .. "sten"}
	data.forms["par_pl"] = {params.base .. "tsi" .. params.a}
	data.forms["ill_pl"] = {params.base .. "tsiin"}
	data.forms["ess_pl"] = {params.base .. "tsin" .. params.a}
	data.forms["com_pl"] = {params.base .. "tsine"}
end
 
inflections["kaksi"] = function(args, data)
	data.title = "[[Kotus]] type 31/[[Appendix:Finnish nominal inflection/kaksi|kaksi]], ''t-d'' gradation"
	table.insert(data.categories, "Finnish kaksi-type nominals")
 
	local params = get_params(args, 2)
	local st_stem = params.base .. "ht"
	local wk_stem = params.base .. "hd"
 
	make_gen_sg_stem_forms(data, wk_stem .. "e", params.a)
	make_ine_pl_stem_forms(data, params.base .. "ks", params.a)
 
	data.forms["nom_sg"] = {params.base .. "ksi"}
	data.forms["par_sg"] = {st_stem .. params.a}
	data.forms["ill_sg"] = {st_stem .. "een"}
	data.forms["ess_sg"] = {st_stem .. "en" .. params.a}
 
	data.forms["gen_pl"] = {params.base .. "ksien"}
	data.forms["par_pl"] = {params.base .. "ksi" .. params.a}
	data.forms["ill_pl"] = {params.base .. "ksiin"}
	data.forms["ess_pl"] = {params.base .. "ksin" .. params.a}
	data.forms["com_pl"] = {params.base .. "ksine"}
end
 
inflections["sisar"] = function(args, data)
	data.title = "[[Kotus]] type 32/[[Appendix:Finnish nominal inflection/sisar|sisar]]"
	table.insert(data.categories, "Finnish sisar-type nominals")
 
	local params = get_params(args, 5, "t", "tt", "ar")
	local nom_sg = args["nom_sg"]; if nom_sg == "" then nom_sg = nil end
 
	make_weak(params.base, params.gen_grade, params.final, params.nom_grade)
 
	if params.nom_grade == params.gen_grade then
		data.title = data.title .. ", no gradation"
	else
		data.title = data.title .. ", ''" .. params.gen_grade .. "-" .. params.nom_grade .. "'' gradation"
	end
 
	make_gen_sg_stem_forms(data, params.base .. params.gen_grade .. params.final .. "e", params.a)
	make_ine_pl_stem_forms(data, params.base .. params.gen_grade .. params.final, params.a)
 
	data.forms["nom_sg"] = {nom_sg or params.base .. params.nom_grade .. params.final}
	data.forms["par_sg"] = {params.base .. params.nom_grade .. params.final .. "t" .. params.a}
	data.forms["ill_sg"] = {params.base .. params.gen_grade .. params.final .. "een"}
	data.forms["ess_sg"] = {params.base .. params.gen_grade .. params.final .. "en" .. params.a}
 
	data.forms["gen_pl"] = {params.base .. params.gen_grade .. params.final .. "ien", params.base .. params.nom_grade .. params.final .. "ten"}
	data.forms["par_pl"] = {params.base .. params.gen_grade .. params.final .. "i" .. params.a}
	data.forms["ill_pl"] = {params.base .. params.gen_grade .. params.final .. "iin"}
	data.forms["ess_pl"] = {params.base .. params.gen_grade .. params.final .. "in" .. params.a}
	data.forms["com_pl"] = {params.base .. params.gen_grade .. params.final .. "ine"}
end
 
inflections["kytkin"] = function(args, data)
	data.title = "[[Kotus]] type 33/[[Appendix:Finnish nominal inflection/kytkin|kytkin]]"
	table.insert(data.categories, "Finnish kytkin-type nominals")
 
	local params = get_params(args, 5, "t", "tt", "i")
 
	make_weak(params.base, params.gen_grade, params.final, params.nom_grade)
 
	if params.nom_grade == params.gen_grade then
		data.title = data.title .. ", no gradation"
	else
		data.title = data.title .. ", ''" .. params.gen_grade .. "-" .. params.nom_grade .. "'' gradation"
	end
 
	make_gen_sg_stem_forms(data, params.base .. params.gen_grade .. params.final .. "me", params.a)
	make_ine_pl_stem_forms(data, params.base .. params.gen_grade .. params.final .. "m", params.a)
 
	data.forms["nom_sg"] = {params.base .. params.nom_grade .. params.final .. "n"}
	data.forms["par_sg"] = {params.base .. params.nom_grade .. params.final .. "nt" .. params.a}
	data.forms["ill_sg"] = {params.base .. params.gen_grade .. params.final .. "meen"}
	data.forms["ess_sg"] = {params.base .. params.gen_grade .. params.final .. "men" .. params.a}
 
	data.forms["gen_pl"] = {params.base .. params.gen_grade .. params.final .. "mien", params.base .. params.nom_grade .. params.final .. "nten"}
	data.forms["par_pl"] = {params.base .. params.gen_grade .. params.final .. "mi" .. params.a}
	data.forms["ill_pl"] = {params.base .. params.gen_grade .. params.final .. "miin"}
	data.forms["ess_pl"] = {params.base .. params.gen_grade .. params.final .. "min" .. params.a}
	data.forms["com_pl"] = {params.base .. params.gen_grade .. params.final .. "mine"}
end
 
inflections["onneton"] = function(args, data)
	data.title = "[[Kotus]] type 34/[[Appendix:Finnish nominal inflection/onneton|onneton]], ''tt-t'' gradation"
	table.insert(data.categories, "Finnish onneton-type nominals")
 
	local params = get_params(args, 2)
 
	make_gen_sg_stem_forms(data, params.base .. "tt" .. params.o .. "m" .. params.a, params.a)
	make_ine_pl_stem_forms(data, params.base .. "tt" .. params.o .. "m", params.a)
 
	data.forms["nom_sg"] = {params.base .. "t" .. params.o .. "n"}
	data.forms["nom_sg"].obsolete = {params.base .. "t" .. params.o .. "in"}
	data.forms["par_sg"] = {params.base .. "t" .. params.o .. "nt" .. params.a}
	data.forms["par_sg"].obsolete = {params.base .. "t" .. params.o .. "int" .. params.a}
	data.forms["ill_sg"] = {params.base .. "tt" .. params.o .. "m" .. params.a .. params.a .. "n"}
	data.forms["ess_sg"] = {params.base .. "tt" .. params.o .. "m" .. params.a .. "n" .. params.a}
	data.forms["ess_sg"].obsolete = {params.base .. "t" .. params.o .. "nn" .. params.a, params.base .. "t" .. params.o .. "inn" .. params.a}
 
	data.forms["gen_pl"] = {params.base .. "tt" .. params.o .. "mien"}
	data.forms["gen_pl"].rare = {params.base .. "t" .. params.o .. "nten"}
	data.forms["gen_pl"].obsolete = {params.base .. "tt" .. params.o .. "m" .. params.a .. "in", params.base .. "t" .. params.o .. "inten"}
	data.forms["par_pl"] = {params.base .. "tt" .. params.o .. "mi" .. params.a}
	data.forms["ill_pl"] = {params.base .. "tt" .. params.o .. "miin"}
	data.forms["ess_pl"] = {params.base .. "tt" .. params.o .. "min" .. params.a}
	data.forms["com_pl"] = {params.base .. "tt" .. params.o .. "mine"}
end
 
inflections["lämmin"] = function(args, data)
	data.title = "[[Kotus]] type 35/[[Appendix:Finnish nominal inflection/lämmin|lämmin]], ''mp-mm'' gradation"
	table.insert(data.categories, "Finnish lämmin-type nominals")
 
	local params = get_params(args, 1)
	params.base = params.base .. "lä"
	params.a = "ä"
 
	local wk_stem = params.base .. "mmi"
	local st_stem = params.base .. "mpi"
 
	make_gen_sg_stem_forms(data, st_stem .. "m" .. params.a, params.a)
	make_ine_pl_stem_forms(data, st_stem .. "m", params.a)
 
	data.forms["nom_sg"] = {wk_stem .. "n"}
	data.forms["par_sg"] = {wk_stem .. "nt" .. params.a}
	data.forms["par_sg"].obsolete = {st_stem .. "m" .. params.a .. params.a, st_stem .. "m" .. params.a .. "t" .. params.a}
	data.forms["ill_sg"] = {st_stem .. "m" .. params.a .. params.a .. "n"}
	data.forms["ess_sg"] = {st_stem .. "m" .. params.a .. "n" .. params.a}
	data.forms["ess_sg"].obsolete = {wk_stem .. "nn" .. params.a}
 
	data.forms["gen_pl"] = {st_stem .. "mien"}
	data.forms["gen_pl"].rare = {st_stem .. "m" .. params.a .. "in"}
	data.forms["gen_pl"].obsolete = {wk_stem .. "nten"}
	data.forms["par_pl"] = {st_stem .. "mi" .. params.a}
	data.forms["ill_pl"] = {st_stem .. "miin"}
	data.forms["ess_pl"] = {st_stem .. "min" .. params.a}
	data.forms["com_pl"] = {st_stem .. "mine"}
end
 
inflections["sisin"] = function(args, data)
	data.title = "[[Kotus]] type 36/[[Appendix:Finnish nominal inflection/sisin|sisin]], ''mp-mm'' gradation"
	table.insert(data.categories, "Finnish sisin-type nominals")
 
	local params = get_params(args, 2)
	local wk_stem = params.base .. "imm"
	local st_stem = params.base .. "imp"
 
	make_gen_sg_stem_forms(data, wk_stem .. params.a, params.a)
	make_ine_pl_stem_forms(data, wk_stem, params.a)
 
	data.forms["nom_sg"] = {params.base .. "in"}
	data.forms["par_sg"] = {params.base .. "int" .. params.a}
	data.forms["par_sg"].obsolete = {st_stem .. params.a .. params.a, st_stem .. params.a .. "t" .. params.a}
	data.forms["ill_sg"] = {st_stem .. params.a .. params.a .. "n"}
	data.forms["ess_sg"] = {st_stem .. params.a .. "n" .. params.a}
	data.forms["ess_sg"].obsolete = {params.base .. "inn" .. params.a}
 
	data.forms["gen_pl"] = {st_stem .. "ien", params.base .. "inten"}
	data.forms["gen_pl"].rare = {st_stem .. params.a .. "in"}
	data.forms["par_pl"] = {st_stem .. "i" .. params.a}
	data.forms["ill_pl"] = {st_stem .. "iin"}
	data.forms["ess_pl"] = {st_stem .. "in" .. params.a}
	data.forms["com_pl"] = {st_stem .. "ine"}
end
 
inflections["vasen"] = function(args, data)
	data.title = "[[Kotus]] type 37/[[Appendix:Finnish nominal inflection/vasen|vasen]], ''mp-mm'' gradation"
	table.insert(data.categories, "Finnish vasen-type nominals")
 
	local params = get_params(args, 1)
	params.base = params.base .. "vase"
	params.a = "a"
 
	local st_stem = params.base .. "mp"
	local wk_stem = params.base .. "mm"
 
	make_gen_sg_stem_forms(data, wk_stem .. params.a, params.a)
	make_ine_pl_stem_forms(data, wk_stem, params.a)
 
	data.forms["nom_sg"] = {params.base .. "n"}
	data.forms["par_sg"] = {params.base .. "nt" .. params.a, st_stem .. params.a .. params.a}
	data.forms["par_sg"].obsolete = {st_stem .. params.a .. "t" .. params.a}
	data.forms["ill_sg"] = {st_stem .. params.a .. params.a .. "n"}
	data.forms["ess_sg"] = {st_stem .. params.a .. "n" .. params.a}
 
	data.forms["gen_pl"] = {st_stem .. "ien", params.base .. "nten"}
	data.forms["gen_pl"].rare = {st_stem .. params.a .. "in"}
	data.forms["par_pl"] = {st_stem .. "i" .. params.a}
	data.forms["ill_pl"] = {st_stem .. "iin"}
	data.forms["ess_pl"] = {st_stem .. "in" .. params.a}
	data.forms["com_pl"] = {st_stem .. "ine"}
end
 
inflections["nainen"] = function(args, data)
	data.title = "[[Kotus]] type 38/[[Appendix:Finnish nominal inflection/nainen|nainen]], no gradation"
	table.insert(data.categories, "Finnish nainen-type nominals")
 
	local params = get_params(args, 2)
 
	make_gen_sg_stem_forms(data, params.base .. "se", params.a)
	make_ine_pl_stem_forms(data, params.base .. "s", params.a)
 
	data.forms["nom_sg"] = {params.base .. "nen"}
	data.forms["par_sg"] = {params.base .. "st" .. params.a}
	data.forms["ill_sg"] = {params.base .. "seen"}
	data.forms["ess_sg"] = {params.base .. "sen" .. params.a}
 
	data.forms["gen_pl"] = {params.base .. "sten", params.base .. "sien"}
	data.forms["par_pl"] = {params.base .. "si" .. params.a}
	data.forms["ill_pl"] = {params.base .. "siin"}
	data.forms["ess_pl"] = {params.base .. "sin" .. params.a}
	data.forms["com_pl"] = {params.base .. "sine"}
end
 
inflections["vastaus"] = function(args, data)
	data.title = "[[Kotus]] type 39/[[Appendix:Finnish nominal inflection/vastaus|vastaus]], no gradation"
	table.insert(data.categories, "Finnish vastaus-type nominals")
 
	local params = get_params(args, 2)
	local nom_sg = args["nom_sg"]; if nom_sg == "" then nom_sg = nil end
 
	make_gen_sg_stem_forms(data, params.base .. "kse", params.a)
	make_ine_pl_stem_forms(data, params.base .. "ks", params.a)
 
	data.forms["nom_sg"] = {nom_sg or params.base .. "s"}
	data.forms["par_sg"] = {params.base .. "st" .. params.a}
	data.forms["ill_sg"] = {params.base .. "kseen"}
	data.forms["ess_sg"] = {params.base .. "ksen" .. params.a}
 
	data.forms["gen_pl"] = {params.base .. "sten", params.base .. "ksien"}
	data.forms["par_pl"] = {params.base .. "ksi" .. params.a}
	data.forms["ill_pl"] = {params.base .. "ksiin"}
	data.forms["ess_pl"] = {params.base .. "ksin" .. params.a}
	data.forms["com_pl"] = {params.base .. "ksine"}
end
 
inflections["kalleus"] = function(args, data)
	data.title = "[[Kotus]] type 40/[[Appendix:Finnish nominal inflection/kalleus|kalleus]], ''t-d'' gradation"
	table.insert(data.categories, "Finnish kalleus-type nominals")
 
	local params = get_params(args, 2)
	local wk_stem = params.base .. "d"
	local st_stem = params.base .. "t"
 
	make_gen_sg_stem_forms(data, wk_stem .. "e", params.a)
	make_ine_pl_stem_forms(data, params.base .. "ks", params.a)
 
	data.forms["nom_sg"] = {params.base .. "s"}
	data.forms["par_sg"] = {st_stem .. "t" .. params.a}
	data.forms["ill_sg"] = {st_stem .. "een"}
	data.forms["ess_sg"] = {st_stem .. "en" .. params.a}
 
	data.forms["gen_pl"] = {params.base .. "ksien"}
	data.forms["par_pl"] = {params.base .. "ksi" .. params.a}
	data.forms["ill_pl"] = {params.base .. "ksiin"}
	data.forms["ess_pl"] = {params.base .. "ksin" .. params.a}
	data.forms["com_pl"] = {params.base .. "ksine"}
end
 
inflections["vieras"] = function(args, data)
	data.title = "[[Kotus]] type 41/[[Appendix:Finnish nominal inflection/vieras|vieras]]"
	table.insert(data.categories, "Finnish vieras-type nominals")
 
	local params = get_params(args, 5, "k", "kk", "a")
	local nom_sg = args["nom_sg"]; if nom_sg == "" then nom_sg = nil end
 
	make_weak(params.base, params.gen_grade, params.final, params.nom_grade)
 
	if params.nom_grade == params.gen_grade then
		data.title = data.title .. ", no gradation"
	else
		data.title = data.title .. ", ''" .. params.gen_grade .. "-" .. params.nom_grade .. "'' gradation"
	end
 
	make_gen_sg_stem_forms(data, params.base .. params.gen_grade .. params.final .. params.final, params.a)
	make_ine_pl_stem_forms(data, params.base .. params.gen_grade .. params.final, params.a)
 
	data.forms["nom_sg"] = {nom_sg or params.base .. params.nom_grade .. params.final .. "s"}
	data.forms["par_sg"] = {params.base .. params.nom_grade .. params.final .. "st" .. params.a}
	data.forms["ill_sg"] = {params.base .. params.gen_grade .. params.final .. params.final .. "seen"}
	data.forms["ess_sg"] = {params.base .. params.gen_grade .. params.final .. params.final .. "n" .. params.a}
 
	data.forms["gen_pl"] = {params.base .. params.gen_grade .. params.final .. "iden", params.base .. params.gen_grade .. params.final .. "itten"}
	data.forms["par_pl"] = {params.base .. params.gen_grade .. params.final .. "it" .. params.a}
	data.forms["ill_pl"] = {params.base .. params.gen_grade .. params.final .. "isiin"}
	data.forms["ill_pl"].rare = {params.base .. params.gen_grade .. params.final .. "ihin"}
	data.forms["ess_pl"] = {params.base .. params.gen_grade .. params.final .. "in" .. params.a}
	data.forms["com_pl"] = {params.base .. params.gen_grade .. params.final .. "ine"}
end
 
inflections["mies"] = function(args, data)
	data.title = "[[Kotus]] type 42/[[Appendix:Finnish nominal inflection/mies|mies]], no gradation"
	table.insert(data.categories, "Finnish mies-type nominals")
 
	local params = get_params(args, 1)
	params.base = params.base .. "mie"
	params.a = "ä"
 
	make_gen_sg_stem_forms(data, params.base .. "he", params.a)
	make_ine_pl_stem_forms(data, params.base .. "h", params.a)
 
	data.forms["nom_sg"] = {params.base .. "s"}
	data.forms["par_sg"] = {params.base .. "st" .. params.a}
	data.forms["ill_sg"] = {params.base .. "heen"}
	data.forms["ess_sg"] = {params.base .. "hen" .. params.a}
 
	data.forms["gen_pl"] = {params.base .. "sten", params.base .. "hien"}
	data.forms["par_pl"] = {params.base .. "hi" .. params.a}
	data.forms["ill_pl"] = {params.base .. "hiin"}
	data.forms["ess_pl"] = {params.base .. "hin" .. params.a}
	data.forms["com_pl"] = {params.base .. "hine"}
end
 
inflections["ohut"] = function(args, data)
	data.title = "[[Kotus]] type 43/[[Appendix:Finnish nominal inflection/ohut|ohut]]"
	table.insert(data.categories, "Finnish ohut-type nominals")
 
	local params = get_params(args, 5, "k", "kk", "u")
 
	make_weak(params.base, params.gen_grade, params.final, params.nom_grade)
 
	if params.nom_grade == params.gen_grade then
		data.title = data.title .. ", no gradation"
	else
		data.title = data.title .. ", ''" .. params.gen_grade .. "-" .. params.nom_grade .. "'' gradation"
	end
 
	make_gen_sg_stem_forms(data, params.base .. params.gen_grade .. params.final .. "e", params.a)
	make_ine_pl_stem_forms(data, params.base .. params.gen_grade .. params.final, params.a)
 
	data.forms["nom_sg"] = {params.base .. params.nom_grade .. params.final .. "t"}
	data.forms["par_sg"] = {params.base .. params.nom_grade .. params.final .. "tt" .. params.a}
	data.forms["ill_sg"] = {params.base .. params.gen_grade .. params.final .. "een"}
	data.forms["ess_sg"] = {params.base .. params.gen_grade .. params.final .. "en" .. params.a}
 
	data.forms["gen_pl"] = {params.base .. params.gen_grade .. params.final .. "iden", params.base .. params.gen_grade .. params.final .. "itten"}
	data.forms["par_pl"] = {params.base .. params.gen_grade .. params.final .. "it" .. params.a}
	data.forms["ill_pl"] = {params.base .. params.gen_grade .. params.final .. "isiin", params.base .. params.gen_grade .. params.final .. "ihin"}
	data.forms["ess_pl"] = {params.base .. params.gen_grade .. params.final .. "in" .. params.a}
	data.forms["com_pl"] = {params.base .. params.gen_grade .. params.final .. "ine"}
end
 
inflections["kevät"] = function(args, data)
	data.title = "[[Kotus]] type 44/[[Appendix:Finnish nominal inflection/kevät|kevät]], no gradation"
	table.insert(data.categories, "Finnish kevät-type nominals")
 
	local params = get_params(args, 2)
	local final = mw.ustring.sub(params.base, -1)
 
	make_gen_sg_stem_forms(data, params.base .. final, params.a)
	make_ine_pl_stem_forms(data, params.base, params.a)
 
	data.forms["nom_sg"] = {params.base .. "t"}
	data.forms["par_sg"] = {params.base .. "tt" .. params.a}
	data.forms["ill_sg"] = {params.base .. final .. "seen"}
	data.forms["ess_sg"] = {params.base .. final .. "n" .. params.a}
 
	data.forms["gen_pl"] = {params.base .. "iden", params.base .. "itten"}
	data.forms["par_pl"] = {params.base .. "it" .. params.a}
	data.forms["ill_pl"] = {params.base .. "isiin"}
	data.forms["ill_pl"].rare = {params.base .. "ihin"}
	data.forms["ess_pl"] = {params.base .. "in" .. params.a}
	data.forms["com_pl"] = {params.base .. "ine"}
end
 
inflections["kahdeksas"] = function(args, data)
	data.title = "[[Kotus]] type 45/[[Appendix:Finnish nominal inflection/kahdeksas|kahdeksas]], ''nt-nn'' gradation"
	table.insert(data.categories, "Finnish kahdeksas-type nominals")
 
	local params = get_params(args, 2)
	local wk_stem = params.base .. "nn"
	local st_stem = params.base .. "nt"
	local pl_stem = params.base .. "ns"
 
	make_gen_sg_stem_forms(data, wk_stem .. "e", params.a)
	make_ine_pl_stem_forms(data, pl_stem, params.a)
 
	data.forms["nom_sg"] = {params.base .. "s"}
	data.forms["par_sg"] = {params.base .. "tt" .. params.a}
	data.forms["ill_sg"] = {st_stem .. "een"}
	data.forms["ess_sg"] = {st_stem .. "en" .. params.a}
 
	data.forms["gen_pl"] = {pl_stem .. "ien"}
	data.forms["par_pl"] = {pl_stem .. "i" .. params.a}
	data.forms["ill_pl"] = {pl_stem .. "iin"}
	data.forms["ess_pl"] = {pl_stem .. "in" .. params.a}
	data.forms["com_pl"] = {pl_stem .. "ine"}
end
 
inflections["tuhat"] = function(args, data)
	data.title = "[[Kotus]] type 46/[[Appendix:Finnish nominal inflection/tuhat|tuhat]], ''nt-nn'' gradation"
	table.insert(data.categories, "Finnish tuhat-type nominals")
 
	local params = get_params(args, 2)
	local wk_stem = params.base .. "nn"
	local st_stem = params.base .. "nt"
	local pl_stem = params.base .. "ns"
 
	make_gen_sg_stem_forms(data, wk_stem .. "e", params.a)
	make_ine_pl_stem_forms(data, pl_stem, params.a)
 
	data.forms["nom_sg"] = {params.base .. "t"}
	data.forms["par_sg"] = {params.base .. "tt" .. params.a}
	data.forms["ill_sg"] = {st_stem .. "een"}
	data.forms["ess_sg"] = {st_stem .. "en" .. params.a}
 
	data.forms["gen_pl"] = {pl_stem .. "ien"}
	data.forms["gen_pl"].rare = {params.base .. "nten"}
	data.forms["par_pl"] = {pl_stem .. "i" .. params.a}
	data.forms["ill_pl"] = {pl_stem .. "iin"}
	data.forms["ess_pl"] = {pl_stem .. "in" .. params.a}
	data.forms["com_pl"] = {pl_stem .. "ine"}
end
 
inflections["kuollut"] = function(args, data)
	data.title = "[[Kotus]] type 47/[[Appendix:Finnish nominal inflection/kuollut|kuollut]], no gradation"
	table.insert(data.categories, "Finnish kuollut-type nominals")
 
	local params = get_params(args, 2)
 
	make_gen_sg_stem_forms(data, params.base .. "ee", params.a)
	make_ine_pl_stem_forms(data, params.base .. "e", params.a)
 
	data.forms["nom_sg"] = {params.base .. params.u .. "t"}
	data.forms["par_sg"] = {params.base .. params.u .. "tt" .. params.a}
	data.forms["ill_sg"] = {params.base .. "eeseen"}
	data.forms["ess_sg"] = {params.base .. "een" .. params.a}
 
	data.forms["gen_pl"] = {params.base .. "eiden", params.base .. "eitten"}
	data.forms["par_pl"] = {params.base .. "eit" .. params.a}
	data.forms["ill_pl"] = {params.base .. "eisiin", params.base .. "eihin"}
	data.forms["ess_pl"] = {params.base .. "ein" .. params.a}
	data.forms["com_pl"] = {params.base .. "eine"}
end
 
inflections["hame"] = function(args, data)
	data.title = "[[Kotus]] type 48/[[Appendix:Finnish nominal inflection/hame|hame]]"
	table.insert(data.categories, "Finnish hame-type nominals")
 
	local params = get_params(args, 4, "k", "kk")
 
	make_weak(params.base, params.gen_grade, "e", params.nom_grade)
 
	if params.nom_grade == params.gen_grade then
		data.title = data.title .. ", no gradation"
	else
		data.title = data.title .. ", ''" .. params.gen_grade .. "-" .. params.nom_grade .. "'' gradation"
	end
 
	make_gen_sg_stem_forms(data, params.base .. params.gen_grade .. "ee", params.a)
	make_ine_pl_stem_forms(data, params.base .. params.gen_grade .. "e", params.a)
 
	data.forms["nom_sg"] = {params.base .. params.nom_grade .. "e"}
	data.forms["par_sg"] = {params.base .. params.nom_grade .. "ett" .. params.a}
	data.forms["ill_sg"] = {params.base .. params.gen_grade .. "eeseen"}
	data.forms["ess_sg"] = {params.base .. params.gen_grade .. "een" .. params.a}
 
	data.forms["gen_pl"] = {params.base .. params.gen_grade .. "eiden", params.base .. params.gen_grade .. "eitten"}
	data.forms["par_pl"] = {params.base .. params.gen_grade .. "eit" .. params.a}
	data.forms["ill_pl"] = {params.base .. params.gen_grade .. "eisiin", params.base .. params.gen_grade .. "eihin"}
	data.forms["ess_pl"] = {params.base .. params.gen_grade .. "ein" .. params.a}
	data.forms["com_pl"] = {params.base .. params.gen_grade .. "eine"}
end
 
 
-- Helper functions
 
function make_gen_sg_stem_forms(data, gen_sg_stem, a)
	data.forms["gen_sg"] = {gen_sg_stem .. "n"}
	data.forms["ine_sg"] = {gen_sg_stem .. "ss" .. a}
	data.forms["ela_sg"] = {gen_sg_stem .. "st" .. a}
	data.forms["ade_sg"] = {gen_sg_stem .. "ll" .. a}
	data.forms["abl_sg"] = {gen_sg_stem .. "lt" .. a}
	data.forms["all_sg"] = {gen_sg_stem .. "lle"}
	data.forms["tra_sg"] = {gen_sg_stem .. "ksi"}
	data.forms["ins_sg"] = {gen_sg_stem .. "n"}
	data.forms["abe_sg"] = {gen_sg_stem .. "tt" .. a}
 
	data.forms["nom_pl"] = {gen_sg_stem .. "t"}
end
 
function make_ine_pl_stem_forms(data, ine_pl_stem, a)
	data.forms["ine_pl"] = {ine_pl_stem .. "iss" .. a}
	data.forms["ela_pl"] = {ine_pl_stem .. "ist" .. a}
	data.forms["ade_pl"] = {ine_pl_stem .. "ill" .. a}
	data.forms["abl_pl"] = {ine_pl_stem .. "ilt" .. a}
	data.forms["all_pl"] = {ine_pl_stem .. "ille"}
	data.forms["tra_pl"] = {ine_pl_stem .. "iksi"}
	data.forms["ins_pl"] = {ine_pl_stem .. "in"}
	data.forms["abe_pl"] = {ine_pl_stem .. "itt" .. a}
end
 
function postprocess(args, data)
	local pos = args["pos"]; if not pos or pos == "" then pos = "noun" end
	local nosg = args["nosg"]; if nosg == "" then nosg = nil end
	local nopl = args["nopl"]; if nopl == "" then nopl = nil end
	local n = args["n"]; if n == "" then n = nil end
	local suffix = args["suffix"]; if suffix == "" then suffix = nil end
	local appendix = args["appendix"]; if appendix == "" then appendix = nil end
	local has_ins_sg = args["has_ins_sg"]; if has_ins_sg == "" then has_ins_sg = nil end
 
	-- Add the possessive suffix to the comitative plural, if the word is a noun
	if pos == "noun" and data.forms["com_pl"] then
		for key, subform in ipairs(data.forms["com_pl"]) do
			data.forms["com_pl"][key] = subform .. "en"
		end
	end
 
	if nosg or n == "pl" then
		table.insert(data.categories, "Finnish pluralia tantum")
	end
 
	-- TODO: This says "nouns", but this module is also used for adjectives!
	if nopl or n == "sg" then
		table.insert(data.categories, "Finnish uncountable nouns")
	end
 
	if not has_ins_sg then
		data.forms["ins_sg"] = nil
	end
 
	for key, form in pairs(data.forms) do
		-- Add suffix to forms
		for i, subform in ipairs(form) do
			subform = subform .. (suffix or "")
			form[i] = subform
		end
 
		if form.rare then
			for i, subform in ipairs(form.rare) do
				subform = subform .. (suffix or "")
				form.rare[i] = subform
			end
		end
 
		if form.obsolete then
			for i, subform in ipairs(form.obsolete) do
				subform = subform .. (suffix or "")
				form.obsolete[i] = subform
			end
		end
 
		-- Do not show obsolete forms in normal pages
		if not appendix then
			form.obsolete = nil
		end
 
		-- Do not show singular or plural forms for nominals that don't have them
		if ((nosg or n == "pl") and key:find("_sg$")) or ((nopl or n == "sg") and key:find("_pl$")) then
			form = nil
		end
 
		data.forms[key] = form
	end
 
	-- Check if the lemma form matches the page name
 
	if not appendix and data.forms[(nosg or n == "pl") and "nom_pl" or "nom_sg"][1] ~= mw.title.getCurrentTitle().text then
		table.insert(data.categories, "Finnish entries with inflection not matching pagename")
	end
end
 
 
-- Functions for generating the inflection table
 
function show_form(form)
	if not form then
		return "—"
	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(subform, nil, lang, nil, nil, nil, {}, mw.title.getCurrentTitle().prefixedText))
	end
 
	if form.rare then
		for key, subform in ipairs(form.rare) do
			table.insert(ret, m_links.full_link(subform, nil, lang, nil, nil, nil, {}, mw.title.getCurrentTitle().prefixedText) .. "<sup>rare</sup>")
		end
	end
 
	if form.obsolete then
		for key, subform in ipairs(form.obsolete) do
			table.insert(ret, m_links.full_link(subform, nil, lang, nil, nil, nil, {}, mw.title.getCurrentTitle().prefixedText) .. "<sup>obsolete</sup>")
		end
	end
 
	return table.concat(ret, "<br/>")
end
 
-- Make the table
function make_table(data)
	return [=[<div class="NavFrame" style="width: 40%">
<div class="NavHead" style="background:rgb(80%,80%,100%);">Inflection of ]=] .. m_links.full_link(nil, mw.title.getCurrentTitle().text, lang, nil, "term", nil, nil, nil) .. (data.title and " (" .. data.title .. ")" or "") .. [=[</div>
<div class="NavContent">
{| class="inflection-table" style="width:100%; color:rgb(0%,0%,30%); border:solid 1px rgb(80%,80%,100%); text-align:left;" cellspacing="1" cellpadding="2"
|- style="background:rgb(80%,80%,100%);vertical-align:top;"
! style="width:33%;" colspan="2" |
! style="width:33%;" | singular
! style="width:33%;" | plural
|- style="background:rgb(95%,95%,100%);vertical-align:top;" |
! style="background:rgb(80%,80%,100%);" colspan="2" | nominative
| ]=] .. show_form(data.forms["nom_sg"]) .. [=[
 
| ]=] .. show_form(data.forms["nom_pl"]) .. 
 
(data.forms["acc_sg"] and ([=[
 
|- style="background:rgb(95%,95%,100%);vertical-align:top;" | 
! style="background:rgb(80%,80%,100%);" colspan="2" | accusative
| ]=] .. show_form(data.forms["acc_sg"]) [=[
 
| ]=] .. show_form(data.forms["acc_pl"] or data.forms["nom_pl"]))
or ([=[
 
|- style="background:rgb(95%,95%,100%);vertical-align:top;" | 
! style="background:rgb(80%,80%,100%);" rowspan="2" | accusative
! style="background:rgb(80%,80%,100%);" | nom.<sup style="border-bottom: 1px dotted black; cursor: help;" title="The nominative accusative is used, for example, as the object of certain passives and imperatives.">?</sup>
| ]=] .. show_form(data.forms["nom_sg"]) .. [=[
 
| rowspan="2" | ]=] .. show_form(data.forms["acc_pl"] or data.forms["nom_pl"]) .. [=[
 
|- style="background:rgb(95%,95%,100%);vertical-align:top;" | 
! style="background:rgb(80%,80%,100%);" | gen.
| ]=] .. show_form(data.forms["gen_sg"]))) .. [=[
 
|- style="background:rgb(95%,95%,100%);vertical-align:top;" |
! style="background:rgb(80%,80%,100%);" colspan="2" | genitive
| ]=] .. show_form(data.forms["gen_sg"]) .. [=[
 
| ]=] .. show_form(data.forms["gen_pl"]) .. [=[
 
|- style="background:rgb(95%,95%,100%);vertical-align:top;" |
! style="background:rgb(80%,80%,100%);" colspan="2" | partitive
| ]=] .. show_form(data.forms["par_sg"]) .. [=[
 
| ]=] .. show_form(data.forms["par_pl"]) .. [=[
 
|- style="background:rgb(95%,95%,100%);vertical-align:top;" |
! style="background:rgb(80%,80%,100%);" colspan="2" | inessive
| ]=] .. show_form(data.forms["ine_sg"]) .. [=[
 
| ]=] .. show_form(data.forms["ine_pl"]) .. [=[
 
|- style="background:rgb(95%,95%,100%);vertical-align:top;" |
! style="background:rgb(80%,80%,100%);" colspan="2" | elative
| ]=] .. show_form(data.forms["ela_sg"]) .. [=[
 
| ]=] .. show_form(data.forms["ela_pl"]) .. [=[
 
|- style="background:rgb(95%,95%,100%);vertical-align:top;" |
! style="background:rgb(80%,80%,100%);" colspan="2" | illative
| ]=] .. show_form(data.forms["ill_sg"]) .. [=[
 
| ]=] .. show_form(data.forms["ill_pl"]) .. [=[
 
|- style="background:rgb(95%,95%,100%);vertical-align:top;" |
! style="background:rgb(80%,80%,100%);" colspan="2" | adessive
| ]=] .. show_form(data.forms["ade_sg"]) .. [=[
 
| ]=] .. show_form(data.forms["ade_pl"]) .. [=[
 
|- style="background:rgb(95%,95%,100%);vertical-align:top;" |
! style="background:rgb(80%,80%,100%);" colspan="2" | ablative
| ]=] .. show_form(data.forms["abl_sg"]) .. [=[
 
| ]=] .. show_form(data.forms["abl_pl"]) .. [=[
 
|- style="background:rgb(95%,95%,100%);vertical-align:top;" |
! style="background:rgb(80%,80%,100%);" colspan="2" | allative
| ]=] .. show_form(data.forms["all_sg"]) .. [=[
 
| ]=] .. show_form(data.forms["all_pl"]) .. [=[
 
|- style="background:rgb(95%,95%,100%);vertical-align:top;" |
! style="background:rgb(80%,80%,100%);" colspan="2" | essive
| ]=] .. show_form(data.forms["ess_sg"]) .. [=[
 
| ]=] .. show_form(data.forms["ess_pl"]) .. [=[
 
|- style="background:rgb(95%,95%,100%);vertical-align:top;" |
! style="background:rgb(80%,80%,100%);" colspan="2" | translative
| ]=] .. show_form(data.forms["tra_sg"]) .. [=[
 
| ]=] .. show_form(data.forms["tra_pl"]) .. [=[
 
|- style="background:rgb(95%,95%,100%);vertical-align:top;" |
! style="background:rgb(80%,80%,100%);" colspan="2" | instructive
| ]=] .. show_form(data.forms["ins_sg"]) .. [=[
 
| ]=] .. show_form(data.forms["ins_pl"]) .. [=[
 
|- style="background:rgb(95%,95%,100%);vertical-align:top;" |
! style="background:rgb(80%,80%,100%);" colspan="2" | abessive
| ]=] .. show_form(data.forms["abe_sg"]) .. [=[
 
| ]=] .. show_form(data.forms["abe_pl"]) .. [=[
 
|- style="background:rgb(95%,95%,100%);vertical-align:top;" |
! style="background:rgb(80%,80%,100%);" colspan="2" | comitative
| ]=] .. show_form(data.forms["com_sg"]) .. [=[
 
| ]=] .. show_form(data.forms["com_pl"]) .. [=[
 
|}
</div>
</div>]=]
 
end
 
return export