Jump to content

Module:cau-nkh-headword

From Wiktionary, the free dictionary


local export = {}

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

function export.verb(frame)
	local params = {
		["a"] = {list = true},
		["cat"] = {},
		["head"] = {list = true},
		["impf"] = {list = true},
		["pf"] = {list = true},
	}
	
	local args = require("Module:parameters").process(frame:getParent().args, params)
	local data = {lang = lang, pos_category = "verbs", categories = {}, heads = args["head"], genders = {}, inflections = {}}
	
	if args["cat"] == "verb-forming suffixes" then
		data.pos_category = "suffixes"
		table.insert(data.categories, lang:getCanonicalName() .. " " .. args["cat"])
	end
	
	-- Aspects
	for i, val in ipairs(args["a"]) do
		if val == "impf" or val == "pf" then
			table.insert(data.genders, val)
			
			if val == "impf" then
				table.insert(data.categories, lang:getCanonicalName() .. " imperfective verbs")
			else
				table.insert(data.categories, lang:getCanonicalName() .. " perfective verbs")
			end
		else
			table.insert(data.genders, "?")
		end
	end
	
	-- Imperfective equivalent
	if args["impf"][1] then
		args["impf"].label = "imperfective"
		table.insert(data.inflections, args["impf"])
	end
	
	-- Perfective equivalent
	if args["pf"][1] then
		args["pf"].label = "perfective"
		table.insert(data.inflections, args["pf"])
	end
	
	return require("Module:headword").full_headword(data)
end


return export