A modult a Modul:bnt-headword/doc lapon tudod dokumentálni

local export = {}

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


function export.noun(frame)
	local params = {
		[1] = {},
		[2] = {},
		["head"] = {},
		}
	
	local args = require("Module:parameters").process(frame:getParent().args, params)
	
	local data = {lang = lang, pos_category = "nouns", categories = {}, heads = {args["head"]}, genders = {args[1] or "?"}, inflections = {}}
	
	local prefixes = {
		["1"] =  {"mʊ̀"},
		["1a"] = {""},
		["2"] =  {"bà"},
		["3"] =  {"mʊ̀"},
		["4"] =  {"mɪ̀"},
		["5"] =  {"ì"},
		["6"] =  {"mà"},
		["7"] =  {"kɪ̀"},
		["8"] =  {"bì"},
		["9"] =  {"n", "m"},
		["10"] = {"n", "m"},
		["11"] = {"dʊ̀"},
		["12"] = {"kà"},
		["13"] = {"tʊ̀"},
		["14"] = {"bʊ̀"},
		["15"] = {"kʊ̀"},
		["16"] = {"pà"},
		["17"] = {"kʊ̀"},
		["18"] = {"mʊ̀"},
		["19"] = {"pì"}
	}
	
	local stem = mw.title.getCurrentTitle().subpageText
	
	if args[1] then
		for key, prefix in ipairs(prefixes[args[1]]) do
			if mw.ustring.find(stem, "^" .. prefix) then
				stem = stem:gsub("^" .. prefix, "")
				break
			end
		end
		
		table.insert(data.categories, lang:getCanonicalName() .. " class " .. args[1] .. " nouns")
	end
	
	data.sort_key = lang:makeSortKey(stem)
	
	if args[2] then
		local plural = prefixes[args[2]][1] .. stem
		
		if args[2] == "9" or args[2] == "10" then
			if mw.ustring.find(stem, "^[bp]") then
				plural = "m" .. stem
			end
		end
		
		table.insert(data.inflections, {label = "plural", {term = "*" .. plural, genders = {"c" .. args[2]}}})
	end
	
	return require("Module:headword").full_headword(data)
end


return export