Module:tr-nouns

From Wiktionary, the free dictionary
Jump to navigation Jump to search

This module needs documentation.
Please document this module by describing its purpose and usage on the documentation page.

local lang = require("Module:languages").getByCode("tr")

local export = {}


local vowels = {
	["a"] = {high = "ı", low = "a"}, ["â"] = {high = "ı", low = "a"},
	["e"] = {high = "i", low = "e"},
	["ı"] = {high = "ı", low = "a"},
	["i"] = {high = "i", low = "e"}, ["î"] = {high = "i", low = "e"},
	["o"] = {high = "u", low = "a"},
	["ö"] = {high = "ü", low = "e"},
	["u"] = {high = "u", low = "a"}, ["û"] = {high = "u", low = "a"},
	["ü"] = {high = "ü", low = "e"},
}


-- Inflection functions

function export.vowel(frame)
	local params = {
		[1] = {required = true, default = "u"},
		
		["n"] = {},
		["poss"] = {type = "boolean"},
		["pred"] = {type = "boolean"},
		["json"] = {type = "boolean"},
	}
	
	local args = require("Module:parameters").process(frame:getParent().args, params)
	local data = {forms = {}, info = "Inflection", categories = {}}
	local stem = mw.title.getCurrentTitle().text
	local vowel = vowels[args[1]]
	local plvowel = vowels[vowel.low]
	
	local plstem
	if args["n"] == "p" then
		plstem = stem
	else
		plstem = stem .. "l" .. vowel.low .. "r"
	end
	
	if mw.ustring.match(stem, "([aâeıiîoöuûü])$") ~= args[1] then
		require("Module:debug").track("tr-nouns/vowel")
	end
	
	data.forms["nom|s"]     = {stem}
	data.forms["def|acc|s"] = {stem .. "y" .. vowel.high}
	data.forms["dat|s"]     = {stem .. "y" .. vowel.low}
	data.forms["loc|s"]     = {stem .. "d" .. vowel.low}
	data.forms["abl|s"]     = {stem .. "d" .. vowel.low .. "n"}
	data.forms["gen|s"]     = {stem .. "n" .. vowel.high .. "n"}
	
	data.forms["nom|p"]     = {plstem}
	data.forms["def|acc|p"] = {plstem .. plvowel.high}
	data.forms["dat|p"]     = {plstem .. plvowel.low}
	data.forms["loc|p"]     = {plstem .. "d" .. plvowel.low}
	data.forms["abl|p"]     = {plstem .. "d" .. plvowel.low .. "n"}
	data.forms["gen|p"]     = {plstem .. plvowel.high .. "n"}
	
	if args["poss"] then
		data.forms["1|s|spos|poss"] = {stem .. "m"}
		data.forms["2|s|spos|poss"] = {stem .. "n"}
		data.forms["3|s|spos|poss"] = {stem .. "s" .. vowel.high}
		data.forms["1|p|spos|poss"] = {stem .. "m" .. vowel.high .. "z"}
		data.forms["2|p|spos|poss"] = {stem .. "n" .. vowel.high .. "z"}
		data.forms["3|p|spos|poss"] = {plstem .. plvowel.high}
		
		data.forms["1|s|mpos|poss"] = {plstem .. plvowel.high .. "m"}
		data.forms["2|s|mpos|poss"] = {plstem .. plvowel.high .. "n"}
		data.forms["3|s|mpos|poss"] = {plstem .. plvowel.high}
		data.forms["1|p|mpos|poss"] = {plstem .. plvowel.high .. "m" .. plvowel.high .. "z"}
		data.forms["2|p|mpos|poss"] = {plstem .. plvowel.high .. "n" .. plvowel.high .. "z"}
		data.forms["3|p|mpos|poss"] = {plstem .. plvowel.high}
		
		data.forms["1|s|spos|poss|def|acc"] = {stem .. "m" .. vowel.high}
		data.forms["2|s|spos|poss|def|acc"] = {stem .. "n" .. vowel.high}
		data.forms["3|s|spos|poss|def|acc"] = {stem .. "s" .. vowel.high .. "n" .. vowel.high}
		data.forms["1|p|spos|poss|def|acc"] = {stem .. "m" .. vowel.high .. "z" .. vowel.high}
		data.forms["2|p|spos|poss|def|acc"] = {stem .. "n" .. vowel.high .. "z" .. vowel.high}
		data.forms["3|p|spos|poss|def|acc"] = {plstem .. plvowel.high .. "n" .. plvowel.high}
		
		data.forms["1|s|mpos|poss|def|acc"] = {plstem .. plvowel.high .. "m" .. plvowel.high}
		data.forms["2|s|mpos|poss|def|acc"] = {plstem .. plvowel.high .. "n" .. plvowel.high}
		data.forms["3|s|mpos|poss|def|acc"] = {plstem .. plvowel.high .. "n" .. plvowel.high}
		data.forms["1|p|mpos|poss|def|acc"] = {plstem .. plvowel.high .. "m" .. plvowel.high .. "z" .. plvowel.high}
		data.forms["2|p|mpos|poss|def|acc"] = {plstem .. plvowel.high .. "n" .. plvowel.high .. "z" .. plvowel.high}
		data.forms["3|p|mpos|poss|def|acc"] = {plstem .. plvowel.high .. "n" .. plvowel.high}
		
		data.forms["1|s|spos|poss|dat"] = {stem .. "m" .. vowel.low}
		data.forms["2|s|spos|poss|dat"] = {stem .. "n" .. vowel.low}
		data.forms["3|s|spos|poss|dat"] = {stem .. "s" .. vowel.high .. "n" .. vowel.low}
		data.forms["1|p|spos|poss|dat"] = {stem .. "m" .. vowel.high .. "z" .. vowel.low}
		data.forms["2|p|spos|poss|dat"] = {stem .. "n" .. vowel.high .. "z" .. vowel.low}
		data.forms["3|p|spos|poss|dat"] = {plstem .. plvowel.high .. "n" .. plvowel.low}
		
		data.forms["1|s|mpos|poss|dat"] = {plstem .. plvowel.high .. "m" .. plvowel.low}
		data.forms["2|s|mpos|poss|dat"] = {plstem .. plvowel.high .. "n" .. plvowel.low}
		data.forms["3|s|mpos|poss|dat"] = {plstem .. plvowel.high .. "n" .. plvowel.low}
		data.forms["1|p|mpos|poss|dat"] = {plstem .. plvowel.high .. "m" .. plvowel.high .. "z" .. plvowel.low}
		data.forms["2|p|mpos|poss|dat"] = {plstem .. plvowel.high .. "n" .. plvowel.high .. "z" .. plvowel.low}
		data.forms["3|p|mpos|poss|dat"] = {plstem .. plvowel.high .. "n" .. plvowel.low}
		
		data.forms["1|s|spos|poss|loc"] = {stem .. "m" .. "d" .. vowel.low}
		data.forms["2|s|spos|poss|loc"] = {stem .. "n" .. "d" .. vowel.low}
		data.forms["3|s|spos|poss|loc"] = {stem .. "s" .. vowel.high .. "n" .. "d" .. vowel.low}
		data.forms["1|p|spos|poss|loc"] = {stem .. "m" .. vowel.high .. "z" .. "d" .. vowel.low}
		data.forms["2|p|spos|poss|loc"] = {stem .. "n" .. vowel.high .. "z" .. "d" .. vowel.low}
		data.forms["3|p|spos|poss|loc"] = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low}
		
		data.forms["1|s|mpos|poss|loc"] = {plstem .. plvowel.high .. "m" .. "d" .. plvowel.low}
		data.forms["2|s|mpos|poss|loc"] = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low}
		data.forms["3|s|mpos|poss|loc"] = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low}
		data.forms["1|p|mpos|poss|loc"] = {plstem .. plvowel.high .. "m" .. plvowel.high .. "z" .. "d" .. plvowel.low}
		data.forms["2|p|mpos|poss|loc"] = {plstem .. plvowel.high .. "n" .. plvowel.high .. "z" .. "d" .. plvowel.low}
		data.forms["3|p|mpos|poss|loc"] = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low}
		
		data.forms["1|s|spos|poss|abl"] = {stem .. "m" .. "d" .. vowel.low .. "n"}
		data.forms["2|s|spos|poss|abl"] = {stem .. "n" .. "d" .. vowel.low .. "n"}
		data.forms["3|s|spos|poss|abl"] = {stem .. "s" .. vowel.high .. "n" .. "d" .. vowel.low .. "n"}
		data.forms["1|p|spos|poss|abl"] = {stem .. "m" .. vowel.high .. "z" .. "d" .. vowel.low .. "n"}
		data.forms["2|p|spos|poss|abl"] = {stem .. "n" .. vowel.high .. "z" .. "d" .. vowel.low .. "n"}
		data.forms["3|p|spos|poss|abl"] = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low .. "n"}
		
		data.forms["1|s|mpos|poss|abl"] = {plstem .. plvowel.high .. "m" .. "d" .. plvowel.low .. "n"}
		data.forms["2|s|mpos|poss|abl"] = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low .. "n"}
		data.forms["3|s|mpos|poss|abl"] = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low .. "n"}
		data.forms["1|p|mpos|poss|abl"] = {plstem .. plvowel.high .. "m" .. plvowel.high .. "z" .. "d" .. plvowel.low .. "n"}
		data.forms["2|p|mpos|poss|abl"] = {plstem .. plvowel.high .. "n" .. plvowel.high .. "z" .. "d" .. plvowel.low .. "n"}
		data.forms["3|p|mpos|poss|abl"] = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low .. "n"}
		
		data.forms["1|s|spos|poss|gen"] = {stem .. "m" .. vowel.high .. "n"}
		data.forms["2|s|spos|poss|gen"] = {stem .. "n" .. vowel.high .. "n"}
		data.forms["3|s|spos|poss|gen"] = {stem .. "s" .. vowel.high .. "n" .. vowel.high .. "n"}
		data.forms["1|p|spos|poss|gen"] = {stem .. "m" .. vowel.high .. "z" .. vowel.high .. "n"}
		data.forms["2|p|spos|poss|gen"] = {stem .. "n" .. vowel.high .. "z" .. vowel.high .. "n"}
		data.forms["3|p|spos|poss|gen"] = {plstem .. plvowel.high .. "n" .. plvowel.high .. "n"}
		
		data.forms["1|s|mpos|poss|gen"] = {plstem .. plvowel.high .. "m" .. plvowel.high .. "n"}
		data.forms["2|s|mpos|poss|gen"] = {plstem .. plvowel.high .. "n" .. plvowel.high .. "n"}
		data.forms["3|s|mpos|poss|gen"] = {plstem .. plvowel.high .. "n" .. plvowel.high .. "n"}
		data.forms["1|p|mpos|poss|gen"] = {plstem .. plvowel.high .. "m" .. plvowel.high .. "z" .. plvowel.high .. "n"}
		data.forms["2|p|mpos|poss|gen"] = {plstem .. plvowel.high .. "n" .. plvowel.high .. "z" .. plvowel.high .. "n"}
		data.forms["3|p|mpos|poss|gen"] = {plstem .. plvowel.high .. "n" .. plvowel.high .. "n"}
	end
	
	if args["pred"] then
		data.forms["1|s|pred|of the|s"] = {stem .. "y" .. vowel.high .. "m"}
		data.forms["2|s|pred|of the|s"] = {stem .. "s" .. vowel.high .. "n"}
		data.forms["3|s|pred|of the|s"] = {stem, stem .. "d" .. vowel.high .. "r"}
		data.forms["1|p|pred|of the|s"] = {stem .. "y" .. vowel.high .. "z"}
		data.forms["2|p|pred|of the|s"] = {stem .. "s" .. vowel.high .. "n" .. vowel.high .. "z"}
		data.forms["3|p|pred|of the|s"] = {plstem}
		
		data.forms["1|s|pred|of the|p"] = {plstem .. plvowel.high .. "m"}
		data.forms["2|s|pred|of the|p"] = {plstem .. "s" .. plvowel.high .. "n"}
		data.forms["3|s|pred|of the|p"] = {plstem, plstem .. "d" .. plvowel.high .. "r"}
		data.forms["1|p|pred|of the|p"] = {plstem .. plvowel.high .. "z"}
		data.forms["2|p|pred|of the|p"] = {plstem .. "s" .. plvowel.high .. "n" .. plvowel.high .. "z"}
		data.forms["3|p|pred|of the|p"] = {plstem .. "d" .. plvowel.high .. "r"}
	end
	
	postprocess(args, data)
	
	if args["json"] then
		return mw.text.jsonEncode(data)
	end
	
	return make_table(data)
end


function export.cons(frame)
	local params = {
		[1] = {required = true, default = "u"},
		
		["n"] = {},
		["poss"] = {type = "boolean"},
		["pred"] = {type = "boolean"},
		["stem"] = {},
		["json"] = {type = "boolean"},
	}
	
	local args = require("Module:parameters").process(frame:getParent().args, params)
	local data = {forms = {}, info = "Inflection", categories = {}}
	
	local stem = mw.title.getCurrentTitle().text
	local stem2 = args["stem"] or stem
	local vowel = vowels[args[1]]
	local plvowel = vowels[vowel.low]
	local plstem
	if args["n"] == "p" then
		plstem = stem
	else
		plstem = stem .. "l" .. vowel.low .. "r"
	end
	
	if mw.ustring.match(stem, "([aâeıiîoöuûü])[^aâeıiîoöuûü]+$") ~= args[1] then
		require("Module:debug").track("tr-nouns/vowel")
	end
	
	local dt = "d"
	
	if mw.ustring.find(stem, "[çfhkptsş]$") then
		dt = "t"
	end
	
	
	data.forms["nom|s"]     = {stem}
	data.forms["def|acc|s"] = {stem2 .. vowel.high}
	data.forms["dat|s"]     = {stem2 .. vowel.low}
	data.forms["loc|s"]     = {stem .. dt .. vowel.low}
	data.forms["abl|s"]     = {stem .. dt .. vowel.low .. "n"}
	data.forms["gen|s"]     = {stem2 .. vowel.high .. "n"}
	
	data.forms["nom|p"]     = {plstem}
	data.forms["def|acc|p"] = {plstem .. plvowel.high}
	data.forms["dat|p"]     = {plstem .. plvowel.low}
	data.forms["loc|p"]     = {plstem .. "d" .. plvowel.low}
	data.forms["abl|p"]     = {plstem .. "d" .. plvowel.low .. "n"}
	data.forms["gen|p"]     = {plstem .. plvowel.high .. "n"}
	
	if args["poss"] then
		data.forms["1|s|spos|poss"] = {stem2 .. vowel.high .. "m"}
		data.forms["2|s|spos|poss"] = {stem2 .. vowel.high .. "n"}
		data.forms["3|s|spos|poss"] = {stem2 .. vowel.high}
		data.forms["1|p|spos|poss"] = {stem2 .. vowel.high .. "m" .. vowel.high .. "z"}
		data.forms["2|p|spos|poss"] = {stem2 .. vowel.high .. "n" .. vowel.high .. "z"}
		data.forms["3|p|spos|poss"] = {plstem .. plvowel.high}
		
		data.forms["1|s|mpos|poss"] = {plstem .. plvowel.high .. "m"}
		data.forms["2|s|mpos|poss"] = {plstem .. plvowel.high .. "n"}
		data.forms["3|s|mpos|poss"] = {plstem .. plvowel.high}
		data.forms["1|p|mpos|poss"] = {plstem .. plvowel.high .. "m" .. plvowel.high .. "z"}
		data.forms["2|p|mpos|poss"] = {plstem .. plvowel.high .. "n" .. plvowel.high .. "z"}
		data.forms["3|p|mpos|poss"] = {plstem .. plvowel.high}
		
		data.forms["1|s|spos|poss|def|acc"] = {stem2 .. vowel.high .. "m" .. vowel.high}
		data.forms["2|s|spos|poss|def|acc"] = {stem2 .. vowel.high .. "n" .. vowel.high}
		data.forms["3|s|spos|poss|def|acc"] = {stem2 .. vowel.high .. "n" .. vowel.high}
		data.forms["1|p|spos|poss|def|acc"] = {stem2 .. vowel.high .. "m" .. vowel.high .. "z" .. vowel.high}
		data.forms["2|p|spos|poss|def|acc"] = {stem2 .. vowel.high .. "n" .. vowel.high .. "z" .. vowel.high}
		data.forms["3|p|spos|poss|def|acc"] = {plstem .. plvowel.high .. "n" .. plvowel.high}
		
		data.forms["1|s|mpos|poss|def|acc"] = {plstem .. plvowel.high .. "m" .. plvowel.high}
		data.forms["2|s|mpos|poss|def|acc"] = {plstem .. plvowel.high .. "n" .. plvowel.high}
		data.forms["3|s|mpos|poss|def|acc"] = {plstem .. plvowel.high .. "n" .. plvowel.high}
		data.forms["1|p|mpos|poss|def|acc"] = {plstem .. plvowel.high .. "m" .. plvowel.high .. "z" .. plvowel.high}
		data.forms["2|p|mpos|poss|def|acc"] = {plstem .. plvowel.high .. "n" .. plvowel.high .. "z" .. plvowel.high}
		data.forms["3|p|mpos|poss|def|acc"] = {plstem .. plvowel.high .. "n" .. plvowel.high}
		
		data.forms["1|s|spos|poss|dat"] = {stem2 .. vowel.high .. "m" .. vowel.low}
		data.forms["2|s|spos|poss|dat"] = {stem2 .. vowel.high .. "n" .. vowel.low}
		data.forms["3|s|spos|poss|dat"] = {stem2 .. vowel.high .. "n" .. vowel.low}
		data.forms["1|p|spos|poss|dat"] = {stem2 .. vowel.high .. "m" .. vowel.high .. "z" .. vowel.low}
		data.forms["2|p|spos|poss|dat"] = {stem2 .. vowel.high .. "n" .. vowel.high .. "z" .. vowel.low}
		data.forms["3|p|spos|poss|dat"] = {plstem .. plvowel.high .. "n" .. plvowel.low}
		
		data.forms["1|s|mpos|poss|dat"] = {plstem .. plvowel.high .. "m" .. plvowel.low}
		data.forms["2|s|mpos|poss|dat"] = {plstem .. plvowel.high .. "n" .. plvowel.low}
		data.forms["3|s|mpos|poss|dat"] = {plstem .. plvowel.high .. "n" .. plvowel.low}
		data.forms["1|p|mpos|poss|dat"] = {plstem .. plvowel.high .. "m" .. plvowel.high .. "z" .. plvowel.low}
		data.forms["2|p|mpos|poss|dat"] = {plstem .. plvowel.high .. "n" .. plvowel.high .. "z" .. plvowel.low}
		data.forms["3|p|mpos|poss|dat"] = {plstem .. plvowel.high .. "n" .. plvowel.low}
		
		data.forms["1|s|spos|poss|loc"] = {stem2 .. vowel.high .. "m" .. "d" .. vowel.low}
		data.forms["2|s|spos|poss|loc"] = {stem2 .. vowel.high .. "n" .. "d" .. vowel.low}
		data.forms["3|s|spos|poss|loc"] = {stem2 .. vowel.high .. "n" .. "d" .. vowel.low}
		data.forms["1|p|spos|poss|loc"] = {stem2 .. vowel.high .. "m" .. vowel.high .. "z" .. "d" .. vowel.low}
		data.forms["2|p|spos|poss|loc"] = {stem2 .. vowel.high .. "n" .. vowel.high .. "z" .. "d" .. vowel.low}
		data.forms["3|p|spos|poss|loc"] = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low}
		
		data.forms["1|s|mpos|poss|loc"] = {plstem .. plvowel.high .. "m" .. "d" .. plvowel.low}
		data.forms["2|s|mpos|poss|loc"] = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low}
		data.forms["3|s|mpos|poss|loc"] = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low}
		data.forms["1|p|mpos|poss|loc"] = {plstem .. plvowel.high .. "m" .. plvowel.high .. "z" .. "d" .. plvowel.low}
		data.forms["2|p|mpos|poss|loc"] = {plstem .. plvowel.high .. "n" .. plvowel.high .. "z" .. "d" .. plvowel.low}
		data.forms["3|p|mpos|poss|loc"] = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low}
		
		data.forms["1|s|spos|poss|abl"] = {stem2 .. vowel.high .. "m" .. "d" .. vowel.low .. "n"}
		data.forms["2|s|spos|poss|abl"] = {stem2 .. vowel.high .. "n" .. "d" .. vowel.low .. "n"}
		data.forms["3|s|spos|poss|abl"] = {stem2 .. vowel.high .. "n" .. "d" .. vowel.low .. "n"}
		data.forms["1|p|spos|poss|abl"] = {stem2 .. vowel.high .. "m" .. vowel.high .. "z" .. "d" .. vowel.low .. "n"}
		data.forms["2|p|spos|poss|abl"] = {stem2 .. vowel.high .. "n" .. vowel.high .. "z" .. "d" .. vowel.low .. "n"}
		data.forms["3|p|spos|poss|abl"] = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low .. "n"}
		
		data.forms["1|s|mpos|poss|abl"] = {plstem .. plvowel.high .. "m" .. "d" .. plvowel.low .. "n"}
		data.forms["2|s|mpos|poss|abl"] = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low .. "n"}
		data.forms["3|s|mpos|poss|abl"] = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low .. "n"}
		data.forms["1|p|mpos|poss|abl"] = {plstem .. plvowel.high .. "m" .. plvowel.high .. "z" .. "d" .. plvowel.low .. "n"}
		data.forms["2|p|mpos|poss|abl"] = {plstem .. plvowel.high .. "n" .. plvowel.high .. "z" .. "d" .. plvowel.low .. "n"}
		data.forms["3|p|mpos|poss|abl"] = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low .. "n"}
		
		data.forms["1|s|spos|poss|gen"] = {stem2 .. vowel.high .. "m" .. vowel.high .. "n"}
		data.forms["2|s|spos|poss|gen"] = {stem2 .. vowel.high .. "n" .. vowel.high .. "n"}
		data.forms["3|s|spos|poss|gen"] = {stem2 .. vowel.high .. "n" .. vowel.high .. "n"}
		data.forms["1|p|spos|poss|gen"] = {stem2 .. vowel.high .. "m" .. vowel.high .. "z" .. vowel.high .. "n"}
		data.forms["2|p|spos|poss|gen"] = {stem2 .. vowel.high .. "n" .. vowel.high .. "z" .. vowel.high .. "n"}
		data.forms["3|p|spos|poss|gen"] = {plstem .. plvowel.high .. "n" .. plvowel.high .. "n"}
		
		data.forms["1|s|mpos|poss|gen"] = {plstem .. plvowel.high .. "m" .. plvowel.high .. "n"}
		data.forms["2|s|mpos|poss|gen"] = {plstem .. plvowel.high .. "n" .. plvowel.high .. "n"}
		data.forms["3|s|mpos|poss|gen"] = {plstem .. plvowel.high .. "n" .. plvowel.high .. "n"}
		data.forms["1|p|mpos|poss|gen"] = {plstem .. plvowel.high .. "m" .. plvowel.high .. "z" .. plvowel.high .. "n"}
		data.forms["2|p|mpos|poss|gen"] = {plstem .. plvowel.high .. "n" .. plvowel.high .. "z" .. plvowel.high .. "n"}
		data.forms["3|p|mpos|poss|gen"] = {plstem .. plvowel.high .. "n" .. plvowel.high .. "n"}
	end
	
	if args["pred"] then
		data.forms["1|s|pred|of the|s"] = {stem2 .. vowel.high .. "m"}
		data.forms["2|s|pred|of the|s"] = {stem .. "s" .. vowel.high .. "n"}
		data.forms["3|s|pred|of the|s"] = {stem, stem .. dt .. vowel.high .. "r"}
		data.forms["1|p|pred|of the|s"] = {stem2 .. vowel.high .. "z"}
		data.forms["2|p|pred|of the|s"] = {stem .. "s" .. vowel.high .. "n" .. vowel.high .. "z"}
		data.forms["3|p|pred|of the|s"] = {plstem}
		
		data.forms["1|s|pred|of the|p"] = {plstem .. plvowel.high .. "m"}
		data.forms["2|s|pred|of the|p"] = {plstem .. "s" .. plvowel.high .. "n"}
		data.forms["3|s|pred|of the|p"] = {plstem, plstem .. "d" .. plvowel.high .. "r"}
		data.forms["1|p|pred|of the|p"] = {plstem .. plvowel.high .. "z"}
		data.forms["2|p|pred|of the|p"] = {plstem .. "s" .. plvowel.high .. "n" .. plvowel.high .. "z"}
		data.forms["3|p|pred|of the|p"] = {plstem .. "d" .. plvowel.high .. "r"}
	end
	
	postprocess(args, data)
	
	if args["json"] then
		return mw.text.jsonEncode(data)
	end
	
	return make_table(data)
end

function export.compound(frame)
	local params = {
		[1] = {required = true, default = "u"},
		
		["n"] = {},
		["poss"] = {},
		["pred"] = {type = "boolean"},
		["stem"] = {},
		["json"] = {type = "boolean"},
	}
	
	local args = require("Module:parameters").process(frame:getParent().args, params)
	local data = {forms = {}, info = "Inflection", categories = {}}
	local stem = mw.title.getCurrentTitle().text
	local stem2 = args["stem"] or stem
	local vowel = vowels[args[1]]
	local plvowel = vowels[vowel.low]
	
	local plstem
	if args["n"] == "p" then
		plstem = stem2
	else
		plstem = stem2 .. "l" .. vowel.low .. "r"
	end
	
	if mw.ustring.match(stem, "([aâeıiîoöuûü])$") ~= args[1] then
		require("Module:debug").track("tr-nouns/vowel")
	end
	
	local dt = "d"
	
	if mw.ustring.find(stem2, "[çfhkptsş]$") then
		dt = "t"
	end
	
	
	data.forms["nom|s"]     = {stem}
	data.forms["def|acc|s"] = {stem .. "n" .. vowel.high}
	data.forms["dat|s"]     = {stem .. "n" .. vowel.low}
	data.forms["loc|s"]     = {stem .. "nd" .. vowel.low}
	data.forms["abl|s"]     = {stem .. "nd" .. vowel.low .. "n"}
	data.forms["gen|s"]     = {stem .. "n" .. vowel.high .. "n"}
	
	data.forms["nom|p"]     = {plstem .. plvowel.high}
	data.forms["def|acc|p"] = {plstem .. plvowel.high .. "n" .. plvowel.high}
	data.forms["dat|p"]     = {plstem .. plvowel.high .. "n" .. plvowel.low}
	data.forms["loc|p"]     = {plstem .. plvowel.high .. "nd" .. plvowel.low}
	data.forms["abl|p"]     = {plstem .. plvowel.high .. "nd" .. plvowel.low .. "n"}
	data.forms["gen|p"]     = {plstem .. plvowel.high .. "n" .. plvowel.high .. "n"}
	
	if args["poss"] then
		if args["poss"] == "c" then
			data.forms["1|s|spos|poss"] = {stem .. "m"}
			data.forms["2|s|spos|poss"] = {stem .. "n"}
			data.forms["3|s|spos|poss"] = {stem}
			data.forms["1|p|spos|poss"] = {stem .. "m" .. vowel.high .. "z"}
			data.forms["2|p|spos|poss"] = {stem .. "n" .. vowel.high .. "z"}
			data.forms["3|p|spos|poss"] = {plstem .. plvowel.high}
			
			data.forms["1|s|mpos|poss"] = {plstem .. plvowel.high .. "m"}
			data.forms["2|s|mpos|poss"] = {plstem .. plvowel.high .. "n"}
			data.forms["3|s|mpos|poss"] = {plstem .. plvowel.high}
			data.forms["1|p|mpos|poss"] = {plstem .. plvowel.high .. "m" .. plvowel.high .. "z"}
			data.forms["2|p|mpos|poss"] = {plstem .. plvowel.high .. "n" .. plvowel.high .. "z"}
			data.forms["3|p|mpos|poss"] = {plstem .. plvowel.high}
			
			data.forms["1|s|spos|poss|def|acc"] = {stem .. "m" .. vowel.high}
			data.forms["2|s|spos|poss|def|acc"] = {stem .. "n" .. vowel.high}
			data.forms["3|s|spos|poss|def|acc"] = {stem .. "n" .. vowel.high}
			data.forms["1|p|spos|poss|def|acc"] = {stem .. "m" .. vowel.high .. "z" .. vowel.high}
			data.forms["2|p|spos|poss|def|acc"] = {stem .. "n" .. vowel.high .. "z" .. vowel.high}
			data.forms["3|p|spos|poss|def|acc"] = {plstem .. plvowel.high .. "n" .. plvowel.high}
			
			data.forms["1|s|mpos|poss|def|acc"] = {plstem .. plvowel.high .. "m" .. plvowel.high}
			data.forms["2|s|mpos|poss|def|acc"] = {plstem .. plvowel.high .. "n" .. plvowel.high}
			data.forms["3|s|mpos|poss|def|acc"] = {plstem .. plvowel.high .. "n" .. plvowel.high}
			data.forms["1|p|mpos|poss|def|acc"] = {plstem .. plvowel.high .. "m" .. plvowel.high .. "z" .. plvowel.high}
			data.forms["2|p|mpos|poss|def|acc"] = {plstem .. plvowel.high .. "n" .. plvowel.high .. "z" .. plvowel.high}
			data.forms["3|p|mpos|poss|def|acc"] = {plstem .. plvowel.high .. "n" .. plvowel.high}
			
			data.forms["1|s|spos|poss|dat"] = {stem .. "m" .. vowel.low}
			data.forms["2|s|spos|poss|dat"] = {stem .. "n" .. vowel.low}
			data.forms["3|s|spos|poss|dat"] = {stem .. "n" .. vowel.low}
			data.forms["1|p|spos|poss|dat"] = {stem .. "m" .. vowel.high .. "z" .. vowel.low}
			data.forms["2|p|spos|poss|dat"] = {stem .. "n" .. vowel.high .. "z" .. vowel.low}
			data.forms["3|p|spos|poss|dat"] = {plstem .. plvowel.high .. "n" .. plvowel.low}
			
			data.forms["1|s|mpos|poss|dat"] = {plstem .. plvowel.high .. "m" .. plvowel.low}
			data.forms["2|s|mpos|poss|dat"] = {plstem .. plvowel.high .. "n" .. plvowel.low}
			data.forms["3|s|mpos|poss|dat"] = {plstem .. plvowel.high .. "n" .. plvowel.low}
			data.forms["1|p|mpos|poss|dat"] = {plstem .. plvowel.high .. "m" .. plvowel.high .. "z" .. plvowel.low}
			data.forms["2|p|mpos|poss|dat"] = {plstem .. plvowel.high .. "n" .. plvowel.high .. "z" .. plvowel.low}
			data.forms["3|p|mpos|poss|dat"] = {plstem .. plvowel.high .. "n" .. plvowel.low}
			
			data.forms["1|s|spos|poss|loc"] = {stem .. "m" .. "d" .. vowel.low}
			data.forms["2|s|spos|poss|loc"] = {stem .. "n" .. "d" .. vowel.low}
			data.forms["3|s|spos|poss|loc"] = {stem .. "n" .. "d" .. vowel.low}
			data.forms["1|p|spos|poss|loc"] = {stem .. "m" .. vowel.high .. "z" .. "d" .. vowel.low}
			data.forms["2|p|spos|poss|loc"] = {stem .. "n" .. vowel.high .. "z" .. "d" .. vowel.low}
			data.forms["3|p|spos|poss|loc"] = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low}
			
			data.forms["1|s|mpos|poss|loc"] = {plstem .. plvowel.high .. "m" .. "d" .. plvowel.low}
			data.forms["2|s|mpos|poss|loc"] = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low}
			data.forms["3|s|mpos|poss|loc"] = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low}
			data.forms["1|p|mpos|poss|loc"] = {plstem .. plvowel.high .. "m" .. plvowel.high .. "z" .. "d" .. plvowel.low}
			data.forms["2|p|mpos|poss|loc"] = {plstem .. plvowel.high .. "n" .. plvowel.high .. "z" .. "d" .. plvowel.low}
			data.forms["3|p|mpos|poss|loc"] = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low}
			
			data.forms["1|s|spos|poss|abl"] = {stem .. "m" .. "d" .. vowel.low .. "n"}
			data.forms["2|s|spos|poss|abl"] = {stem .. "n" .. "d" .. vowel.low .. "n"}
			data.forms["3|s|spos|poss|abl"] = {stem .. "n" .. "d" .. vowel.low .. "n"}
			data.forms["1|p|spos|poss|abl"] = {stem .. "m" .. vowel.high .. "z" .. "d" .. vowel.low .. "n"}
			data.forms["2|p|spos|poss|abl"] = {stem .. "n" .. vowel.high .. "z" .. "d" .. vowel.low .. "n"}
			data.forms["3|p|spos|poss|abl"] = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low .. "n"}
			
			data.forms["1|s|mpos|poss|abl"] = {plstem .. plvowel.high .. "m" .. "d" .. plvowel.low .. "n"}
			data.forms["2|s|mpos|poss|abl"] = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low .. "n"}
			data.forms["3|s|mpos|poss|abl"] = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low .. "n"}
			data.forms["1|p|mpos|poss|abl"] = {plstem .. plvowel.high .. "m" .. plvowel.high .. "z" .. "d" .. plvowel.low .. "n"}
			data.forms["2|p|mpos|poss|abl"] = {plstem .. plvowel.high .. "n" .. plvowel.high .. "z" .. "d" .. plvowel.low .. "n"}
			data.forms["3|p|mpos|poss|abl"] = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low .. "n"}
			
			data.forms["1|s|spos|poss|gen"] = {stem .. "m" .. vowel.high .. "n"}
			data.forms["2|s|spos|poss|gen"] = {stem .. "n" .. vowel.high .. "n"}
			data.forms["3|s|spos|poss|gen"] = {stem .. "n" .. vowel.high .. "n"}
			data.forms["1|p|spos|poss|gen"] = {stem .. "m" .. vowel.high .. "z" .. vowel.high .. "n"}
			data.forms["2|p|spos|poss|gen"] = {stem .. "n" .. vowel.high .. "z" .. vowel.high .. "n"}
			data.forms["3|p|spos|poss|gen"] = {plstem .. plvowel.high .. "n" .. plvowel.high .. "n"}
			
			data.forms["1|s|mpos|poss|gen"] = {plstem .. plvowel.high .. "m" .. plvowel.high .. "n"}
			data.forms["2|s|mpos|poss|gen"] = {plstem .. plvowel.high .. "n" .. plvowel.high .. "n"}
			data.forms["3|s|mpos|poss|gen"] = {plstem .. plvowel.high .. "n" .. plvowel.high .. "n"}
			data.forms["1|p|mpos|poss|gen"] = {plstem .. plvowel.high .. "m" .. plvowel.high .. "z" .. plvowel.high .. "n"}
			data.forms["2|p|mpos|poss|gen"] = {plstem .. plvowel.high .. "n" .. plvowel.high .. "z" .. plvowel.high .. "n"}
			data.forms["3|p|mpos|poss|gen"] = {plstem .. plvowel.high .. "n" .. plvowel.high .. "n"}
			
		elseif args["poss"] == "v" then
			data.forms["1|s|spos|poss"] = {stem2 .. "m"}
			data.forms["2|s|spos|poss"] = {stem2 .. "n"}
			data.forms["3|s|spos|poss"] = {stem2 .. "s" .. vowel.high}
			data.forms["1|p|spos|poss"] = {stem2 .. "m" .. vowel.high .. "z"}
			data.forms["2|p|spos|poss"] = {stem2 .. "n" .. vowel.high .. "z"}
			data.forms["3|p|spos|poss"] = {plstem .. plvowel.high}
			
			data.forms["1|s|mpos|poss"] = {plstem .. plvowel.high .. "m"}
			data.forms["2|s|mpos|poss"] = {plstem .. plvowel.high .. "n"}
			data.forms["3|s|mpos|poss"] = {plstem .. plvowel.high}
			data.forms["1|p|mpos|poss"] = {plstem .. plvowel.high .. "m" .. plvowel.high .. "z"}
			data.forms["2|p|mpos|poss"] = {plstem .. plvowel.high .. "n" .. plvowel.high .. "z"}
			data.forms["3|p|mpos|poss"] = {plstem .. plvowel.high}
			
			data.forms["1|s|spos|poss|def|acc"] = {stem2 .. "m" .. vowel.high}
			data.forms["2|s|spos|poss|def|acc"] = {stem2 .. "n" .. vowel.high}
			data.forms["3|s|spos|poss|def|acc"] = {stem2 .. "s" .. vowel.high .. "n" .. vowel.high}
			data.forms["1|p|spos|poss|def|acc"] = {stem2 .. "m" .. vowel.high .. "z" .. vowel.high}
			data.forms["2|p|spos|poss|def|acc"] = {stem2 .. "n" .. vowel.high .. "z" .. vowel.high}
			data.forms["3|p|spos|poss|def|acc"] = {plstem .. plvowel.high .. "n" .. plvowel.high}
			
			data.forms["1|s|mpos|poss|def|acc"] = {plstem .. plvowel.high .. "m" .. plvowel.high}
			data.forms["2|s|mpos|poss|def|acc"] = {plstem .. plvowel.high .. "n" .. plvowel.high}
			data.forms["3|s|mpos|poss|def|acc"] = {plstem .. plvowel.high .. "n" .. plvowel.high}
			data.forms["1|p|mpos|poss|def|acc"] = {plstem .. plvowel.high .. "m" .. plvowel.high .. "z" .. plvowel.high}
			data.forms["2|p|mpos|poss|def|acc"] = {plstem .. plvowel.high .. "n" .. plvowel.high .. "z" .. plvowel.high}
			data.forms["3|p|mpos|poss|def|acc"] = {plstem .. plvowel.high .. "n" .. plvowel.high}
			
			data.forms["1|s|spos|poss|dat"] = {stem2 .. "m" .. vowel.low}
			data.forms["2|s|spos|poss|dat"] = {stem2 .. "n" .. vowel.low}
			data.forms["3|s|spos|poss|dat"] = {stem2 .. "s" .. vowel.high .. "n" .. vowel.low}
			data.forms["1|p|spos|poss|dat"] = {stem2 .. "m" .. vowel.high .. "z" .. vowel.low}
			data.forms["2|p|spos|poss|dat"] = {stem2 .. "n" .. vowel.high .. "z" .. vowel.low}
			data.forms["3|p|spos|poss|dat"] = {plstem .. plvowel.high .. "n" .. plvowel.low}
			
			data.forms["1|s|mpos|poss|dat"] = {plstem .. plvowel.high .. "m" .. plvowel.low}
			data.forms["2|s|mpos|poss|dat"] = {plstem .. plvowel.high .. "n" .. plvowel.low}
			data.forms["3|s|mpos|poss|dat"] = {plstem .. plvowel.high .. "n" .. plvowel.low}
			data.forms["1|p|mpos|poss|dat"] = {plstem .. plvowel.high .. "m" .. plvowel.high .. "z" .. plvowel.low}
			data.forms["2|p|mpos|poss|dat"] = {plstem .. plvowel.high .. "n" .. plvowel.high .. "z" .. plvowel.low}
			data.forms["3|p|mpos|poss|dat"] = {plstem .. plvowel.high .. "n" .. plvowel.low}
			
			data.forms["1|s|spos|poss|loc"] = {stem2 .. "m" .. "d" .. vowel.low}
			data.forms["2|s|spos|poss|loc"] = {stem2 .. "n" .. "d" .. vowel.low}
			data.forms["3|s|spos|poss|loc"] = {stem2 .. "s" .. vowel.high .. "n" .. "d" .. vowel.low}
			data.forms["1|p|spos|poss|loc"] = {stem2 .. "m" .. vowel.high .. "z" .. "d" .. vowel.low}
			data.forms["2|p|spos|poss|loc"] = {stem2 .. "n" .. vowel.high .. "z" .. "d" .. vowel.low}
			data.forms["3|p|spos|poss|loc"] = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low}
			
			data.forms["1|s|mpos|poss|loc"] = {plstem .. plvowel.high .. "m" .. "d" .. plvowel.low}
			data.forms["2|s|mpos|poss|loc"] = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low}
			data.forms["3|s|mpos|poss|loc"] = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low}
			data.forms["1|p|mpos|poss|loc"] = {plstem .. plvowel.high .. "m" .. plvowel.high .. "z" .. "d" .. plvowel.low}
			data.forms["2|p|mpos|poss|loc"] = {plstem .. plvowel.high .. "n" .. plvowel.high .. "z" .. "d" .. plvowel.low}
			data.forms["3|p|mpos|poss|loc"] = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low}
			
			data.forms["1|s|spos|poss|abl"] = {stem2 .. "m" .. "d" .. vowel.low .. "n"}
			data.forms["2|s|spos|poss|abl"] = {stem2 .. "n" .. "d" .. vowel.low .. "n"}
			data.forms["3|s|spos|poss|abl"] = {stem2 .. "s" .. vowel.high .. "n" .. "d" .. vowel.low .. "n"}
			data.forms["1|p|spos|poss|abl"] = {stem2 .. "m" .. vowel.high .. "z" .. "d" .. vowel.low .. "n"}
			data.forms["2|p|spos|poss|abl"] = {stem2 .. "n" .. vowel.high .. "z" .. "d" .. vowel.low .. "n"}
			data.forms["3|p|spos|poss|abl"] = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low .. "n"}
			
			data.forms["1|s|mpos|poss|abl"] = {plstem .. plvowel.high .. "m" .. "d" .. plvowel.low .. "n"}
			data.forms["2|s|mpos|poss|abl"] = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low .. "n"}
			data.forms["3|s|mpos|poss|abl"] = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low .. "n"}
			data.forms["1|p|mpos|poss|abl"] = {plstem .. plvowel.high .. "m" .. plvowel.high .. "z" .. "d" .. plvowel.low .. "n"}
			data.forms["2|p|mpos|poss|abl"] = {plstem .. plvowel.high .. "n" .. plvowel.high .. "z" .. "d" .. plvowel.low .. "n"}
			data.forms["3|p|mpos|poss|abl"] = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low .. "n"}
			
			data.forms["1|s|spos|poss|gen"] = {stem2 .. "m" .. vowel.high .. "n"}
			data.forms["2|s|spos|poss|gen"] = {stem2 .. "n" .. vowel.high .. "n"}
			data.forms["3|s|spos|poss|gen"] = {stem2 .. "s" .. vowel.high .. "n" .. vowel.high .. "n"}
			data.forms["1|p|spos|poss|gen"] = {stem2 .. "m" .. vowel.high .. "z" .. vowel.high .. "n"}
			data.forms["2|p|spos|poss|gen"] = {stem2 .. "n" .. vowel.high .. "z" .. vowel.high .. "n"}
			data.forms["3|p|spos|poss|gen"] = {plstem .. plvowel.high .. "n" .. plvowel.high .. "n"}
			
			data.forms["1|s|mpos|poss|gen"] = {plstem .. plvowel.high .. "m" .. plvowel.high .. "n"}
			data.forms["2|s|mpos|poss|gen"] = {plstem .. plvowel.high .. "n" .. plvowel.high .. "n"}
			data.forms["3|s|mpos|poss|gen"] = {plstem .. plvowel.high .. "n" .. plvowel.high .. "n"}
			data.forms["1|p|mpos|poss|gen"] = {plstem .. plvowel.high .. "m" .. plvowel.high .. "z" .. plvowel.high .. "n"}
			data.forms["2|p|mpos|poss|gen"] = {plstem .. plvowel.high .. "n" .. plvowel.high .. "z" .. plvowel.high .. "n"}
			data.forms["3|p|mpos|poss|gen"] = {plstem .. plvowel.high .. "n" .. plvowel.high .. "n"}
		
		else
			--error("For compound nouns, please specify |poss=c if the possessor is a consonant stem and |poss=v if it is a vowel stem.")	
			table.insert(data.categories, "Turkish compound nouns with invalid poss parameter")
		end
	end
	
	if args["pred"] then
		data.forms["1|s|pred|of the|s"] = {stem .. "y" .. vowel.high .. "m"}
		data.forms["2|s|pred|of the|s"] = {stem .. "s" .. vowel.high .. "n"}
		data.forms["3|s|pred|of the|s"] = {stem}
		data.forms["1|p|pred|of the|s"] = {stem .. "y" .. vowel.high .. "z"}
		data.forms["2|p|pred|of the|s"] = {stem .. "s" .. vowel.high .. "n" .. vowel.high .. "z"}
		data.forms["3|p|pred|of the|s"] = {plstem .. plvowel.high}
		
		data.forms["1|s|pred|of the|p"] = {plstem .. plvowel.high .. "y" .. plvowel.high .. "m"}
		data.forms["2|s|pred|of the|p"] = {plstem .. plvowel.high .. "s" .. plvowel.high .. "n"}
		data.forms["3|s|pred|of the|p"] = {plstem .. plvowel.high}
		data.forms["1|p|pred|of the|p"] = {plstem .. plvowel.high .. "y" .. plvowel.high .. "z"}
		data.forms["2|p|pred|of the|p"] = {plstem .. plvowel.high .. "s" .. plvowel.high .. "n" .. plvowel.high .. "z"}
		data.forms["3|p|pred|of the|p"] = {plstem .. plvowel.high}
	end

	postprocess(args, data)
	
	if args["json"] then
		return mw.text.jsonEncode(data)
	end
	
	return make_table(data)
end


function postprocess(args, data)
	data.has_poss = args["poss"]
	data.has_pred = args["pred"]
	data.n = args["n"]
	
	if args["n"] == "p" then
		table.insert(data.categories, lang:getCanonicalName() .. " pluralia tantum")
	elseif args["n"] == "s" then
		table.insert(data.categories, lang:getCanonicalName() .. " uncountable nouns")
	elseif args["n"] then
		error("args= must be \"s\" or \"p\".")
	end
	
	for key, form in pairs(data.forms) do
		-- Do not show singular or plural forms for nominals that don't have them
		if (args["n"] == "p" and key:find("|s$")) or (args["n"] == "s" and key:find("|p$")) then
			form = nil
		end
		
		data.forms[key] = form
	end
	
	data.lemma = (data.forms["nom|" .. (data.n or "s")])[1]
	
	-- Check if the lemma form matches the page name
	if (lang:makeEntryName(data.lemma)) ~= mw.title.getCurrentTitle().text then
		table.insert(data.categories, lang:getCanonicalName() .. " entries with inflection not matching pagename")
	end
end


-- Make the table
function make_table(data)
	local function repl(param)
		local accel = true
		local no_store = false
		
		if param == "info" then
			return mw.getContentLanguage():ucfirst(data.info or "")
		elseif string.sub(param, 1, 1) == "!" then
			no_store = true
			param = string.sub(param, 2)
		elseif string.sub(param, 1, 1) == "#" then
			accel = false
			param = string.sub(param, 2)
		end
		
		local forms = data.forms[param]
		
		if not forms then
			return "—"
		end
		
		local ret = {}
		
		for key, subform in ipairs(forms) do
			table.insert(ret, require("Module:links").full_link({lang = lang, term = subform, accel = accel and {form = param, lemma = data.lemma, no_store = no_store} or nil}))
		end
		
		return table.concat(ret, "<br/>")
	end
	
	local wikicode = {}
	table.insert(wikicode, [=[
{| class="inflection-table vsSwitcher" data-toggle-category="inflection" style="text-align: left; background: #F9F9F9; border: 1px solid #AAAAAA;"
|- style="background: #DEDEDE; text-align: left;"
! class="vsToggleElement" colspan="3" | {{{info}}}
|- class="vsShow"
! style="background: #EFEFEF; width: 12em;" | Nominative
| colspan="2" style="width: 10em;" | {{{nom|]=] .. (data.n or "s") .. [=[}}}
|- class="vsShow"
! style="background: #EFEFEF;" | Definite accusative
| colspan="2" | {{{def|acc|]=] .. (data.n or "s") .. [=[}}}
|- class="vsHide" style="background: #DEDEDE;"
! style="width: 12em;" |
! style="width: 10em;" | Singular
! style="width: 10em;" | Plural
|- class="vsHide"
! style="background: #EFEFEF;" | Nominative
| {{{nom|s}}}
| {{{nom|p}}}
|- class="vsHide"
! style="background: #EFEFEF;" | Definite accusative
| {{{def|acc|s}}}
| {{{def|acc|p}}}
|- class="vsHide"
! style="background: #EFEFEF;" | Dative
| {{{dat|s}}}
| {{{dat|p}}}
|- class="vsHide"
! style="background: #EFEFEF;" | Locative
| {{{loc|s}}}
| {{{loc|p}}}
|- class="vsHide"
! style="background: #EFEFEF;" | Ablative
| {{{abl|s}}}
| {{{abl|p}}}
|- class="vsHide"
! style="background: #EFEFEF;" | Genitive
| {{{gen|s}}}
| {{{gen|p}}}]=])

	-- Possessive forms
	if data.has_poss then
		table.insert(wikicode, [=[

|- class="vsHide"
| colspan="3" style="padding: 0;" |
{| class="inflection-table vsSwitcher" style="text-align: left; width: 100%;"
|- style="background: #DEDEDE; text-align: left;"
! class="vsToggleElement" colspan="3" | Possessive forms
|- class="vsHide" style="background: #DEDEDE;"
! colspan="3" | Nominative
|- class="vsHide" style="background: #DEDEDE;"
! style="width: 12em;" |
! style="width: 10em;" | Singular
! style="width: 10em;" | Plural
|- class="vsHide"
! style="background: #EFEFEF;" | 1st singular
| {{{1|s|spos|poss}}}
| {{{1|s|mpos|poss}}}
|- class="vsHide"
! style="background: #EFEFEF;" | 2nd singular
| {{{2|s|spos|poss}}}
| {{{2|s|mpos|poss}}}
|- class="vsHide"
! style="background: #EFEFEF;" | 3rd singular
| {{{3|s|spos|poss}}}
| {{{3|s|mpos|poss}}}
|- class="vsHide"
! style="background: #EFEFEF;" | 1st plural
| {{{1|p|spos|poss}}}
| {{{1|p|mpos|poss}}}
|- class="vsHide"
! style="background: #EFEFEF;" | 2nd plural
| {{{2|p|spos|poss}}}
| {{{2|p|mpos|poss}}}
|- class="vsHide"
! style="background: #EFEFEF;" | 3rd plural
| {{{3|p|spos|poss}}}
| {{{3|p|mpos|poss}}}
|- class="vsHide" style="background: #DEDEDE;"
! colspan="3" | Definite accusative
|- class="vsHide" style="background: #DEDEDE;"
! style="width: 12em;" |
! style="width: 10em;" | Singular
! style="width: 10em;" | Plural
|- class="vsHide"
! style="background: #EFEFEF;" | 1st singular
| {{{1|s|spos|poss|def|acc}}}
| {{{1|s|mpos|poss|def|acc}}}
|- class="vsHide"
! style="background: #EFEFEF;" | 2nd singular
| {{{2|s|spos|poss|def|acc}}}
| {{{2|s|mpos|poss|def|acc}}}
|- class="vsHide"
! style="background: #EFEFEF;" | 3rd singular
| {{{3|s|spos|poss|def|acc}}}
| {{{3|s|mpos|poss|def|acc}}}
|- class="vsHide"
! style="background: #EFEFEF;" | 1st plural
| {{{1|p|spos|poss|def|acc}}}
| {{{1|p|mpos|poss|def|acc}}}
|- class="vsHide"
! style="background: #EFEFEF;" | 2nd plural
| {{{2|p|spos|poss|def|acc}}}
| {{{2|p|mpos|poss|def|acc}}}
|- class="vsHide"
! style="background: #EFEFEF;" | 3rd plural
| {{{3|p|spos|poss|def|acc}}}
| {{{3|p|mpos|poss|def|acc}}}
|- class="vsHide" style="background: #DEDEDE;"
! colspan="3" | Dative
|- class="vsHide" style="background: #DEDEDE;"
! style="width: 12em;" |
! style="width: 10em;" | Singular
! style="width: 10em;" | Plural
|- class="vsHide"
! style="background: #EFEFEF;" | 1st singular
| {{{1|s|spos|poss|dat}}}
| {{{1|s|mpos|poss|dat}}}
|- class="vsHide"
! style="background: #EFEFEF;" | 2nd singular
| {{{2|s|spos|poss|dat}}}
| {{{2|s|mpos|poss|dat}}}
|- class="vsHide"
! style="background: #EFEFEF;" | 3rd singular
| {{{3|s|spos|poss|dat}}}
| {{{3|s|mpos|poss|dat}}}
|- class="vsHide"
! style="background: #EFEFEF;" | 1st plural
| {{{1|p|spos|poss|dat}}}
| {{{1|p|mpos|poss|dat}}}
|- class="vsHide"
! style="background: #EFEFEF;" | 2nd plural
| {{{2|p|spos|poss|dat}}}
| {{{2|p|mpos|poss|dat}}}
|- class="vsHide"
! style="background: #EFEFEF;" | 3rd plural
| {{{3|p|spos|poss|dat}}}
| {{{3|p|mpos|poss|dat}}}
|- class="vsHide" style="background: #DEDEDE;"
! colspan="3" | Locative
|- class="vsHide" style="background: #DEDEDE;"
! style="width: 12em;" |
! style="width: 10em;" | Singular
! style="width: 10em;" | Plural
|- class="vsHide"
! style="background: #EFEFEF;" | 1st singular
| {{{1|s|spos|poss|loc}}}
| {{{1|s|mpos|poss|loc}}}
|- class="vsHide"
! style="background: #EFEFEF;" | 2nd singular
| {{{2|s|spos|poss|loc}}}
| {{{2|s|mpos|poss|loc}}}
|- class="vsHide"
! style="background: #EFEFEF;" | 3rd singular
| {{{3|s|spos|poss|loc}}}
| {{{3|s|mpos|poss|loc}}}
|- class="vsHide"
! style="background: #EFEFEF;" | 1st plural
| {{{1|p|spos|poss|loc}}}
| {{{1|p|mpos|poss|loc}}}
|- class="vsHide"
! style="background: #EFEFEF;" | 2nd plural
| {{{2|p|spos|poss|loc}}}
| {{{2|p|mpos|poss|loc}}}
|- class="vsHide"
! style="background: #EFEFEF;" | 3rd plural
| {{{3|p|spos|poss|loc}}}
| {{{3|p|mpos|poss|loc}}}
|- class="vsHide" style="background: #DEDEDE;"
! colspan="3" | Ablative
|- class="vsHide" style="background: #DEDEDE;"
! style="width: 12em;" |
! style="width: 10em;" | Singular
! style="width: 10em;" | Plural
|- class="vsHide"
! style="background: #EFEFEF;" | 1st singular
| {{{1|s|spos|poss|abl}}}
| {{{1|s|mpos|poss|abl}}}
|- class="vsHide"
! style="background: #EFEFEF;" | 2nd singular
| {{{2|s|spos|poss|abl}}}
| {{{2|s|mpos|poss|abl}}}
|- class="vsHide"
! style="background: #EFEFEF;" | 3rd singular
| {{{3|s|spos|poss|abl}}}
| {{{3|s|mpos|poss|abl}}}
|- class="vsHide"
! style="background: #EFEFEF;" | 1st plural
| {{{1|p|spos|poss|abl}}}
| {{{1|p|mpos|poss|abl}}}
|- class="vsHide"
! style="background: #EFEFEF;" | 2nd plural
| {{{2|p|spos|poss|abl}}}
| {{{2|p|mpos|poss|abl}}}
|- class="vsHide"
! style="background: #EFEFEF;" | 3rd plural
| {{{3|p|spos|poss|abl}}}
| {{{3|p|mpos|poss|abl}}}
|- class="vsHide" style="background: #DEDEDE;"
! colspan="3" | Genitive
|- class="vsHide" style="background: #DEDEDE;"
! style="width: 12em;" |
! style="width: 10em;" | Singular
! style="width: 10em;" | Plural
|- class="vsHide"
! style="background: #EFEFEF;" | 1st singular
| {{{1|s|spos|poss|gen}}}
| {{{1|s|mpos|poss|gen}}}
|- class="vsHide"
! style="background: #EFEFEF;" | 2nd singular
| {{{2|s|spos|poss|gen}}}
| {{{2|s|mpos|poss|gen}}}
|- class="vsHide"
! style="background: #EFEFEF;" | 3rd singular
| {{{3|s|spos|poss|gen}}}
| {{{3|s|mpos|poss|gen}}}
|- class="vsHide"
! style="background: #EFEFEF;" | 1st plural
| {{{1|p|spos|poss|gen}}}
| {{{1|p|mpos|poss|gen}}}
|- class="vsHide"
! style="background: #EFEFEF;" | 2nd plural
| {{{2|p|spos|poss|gen}}}
| {{{2|p|mpos|poss|gen}}}
|- class="vsHide"
! style="background: #EFEFEF;" | 3rd plural
| {{{3|p|spos|poss|gen}}}
| {{{3|p|mpos|poss|gen}}}
|}]=])
	end
	
	-- Predicative forms
	if data.has_pred then
		table.insert(wikicode, [=[

|- class="vsHide"
| colspan="3" style="padding: 0;" |
{| class="inflection-table vsSwitcher" style="text-align: left; width: 100%;"
|- style="background: #DEDEDE; text-align: left;"
! class="vsToggleElement" colspan="3" | Predicative forms
|- class="vsHide" style="background: #DEDEDE;"
! style="width: 12em;" |
! style="width: 10em;" | Singular
! style="width: 10em;" | Plural
|- class="vsHide"
! style="background: #EFEFEF;" | 1st singular
| {{{1|s|pred|of the|s}}}
| {{{1|s|pred|of the|p}}}
|- class="vsHide"
! style="background: #EFEFEF;" | 2nd singular
| {{{2|s|pred|of the|s}}}
| {{{2|s|pred|of the|p}}}
|- class="vsHide"
! style="background: #EFEFEF;" | 3rd singular
| {{{3|s|pred|of the|s}}}
| {{{3|s|pred|of the|p}}}
|- class="vsHide"
! style="background: #EFEFEF;" | 1st plural
| {{{1|p|pred|of the|s}}}
| {{{1|p|pred|of the|p}}}
|- class="vsHide"
! style="background: #EFEFEF;" | 2nd plural
| {{{2|p|pred|of the|s}}}
| {{{2|p|pred|of the|p}}}
|- class="vsHide"
! style="background: #EFEFEF;" | 3rd plural
| {{{3|p|pred|of the|s}}}
| {{{3|p|pred|of the|p}}}
|}]=])
	end
	
	table.insert(wikicode, "\n|}")
	
	return mw.ustring.gsub(table.concat(wikicode), "{{{([#!]?[a-z0-9| ]+)}}}", repl) .. require("Module:utilities").format_categories(data.categories, lang)
end

return export