Module:iu-headword

local export = {} local pos_functions = {}

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

-- The main entry point. -- This is the only function that can be invoked from a template. function export.show(frame) PAGENAME = mw.title.getCurrentTitle.text

local poscat = frame.args[1] or error("Part of speech has not been specified. Please pass parameter 1 to the module invocation.")

local params = { ["head"] = {list = true}, ["suff"] = {type = "boolean"}, }	if pos_functions[poscat] then for key, val in pairs(pos_functions[poscat].params) do			params[key] = val end end local args = require("Module:parameters").process(frame:getParent.args, params) local data = {lang = lang, pos_category = poscat, categories = {}, heads = args["head"], inflections = {}} if args["suff"] then data.pos_category = "suffixes"

if poscat == "adjectives" then table.insert(data.categories, lang:getCanonicalName .. " adjective-forming suffixes") elseif poscat == "adverbs" then table.insert(data.categories, lang:getCanonicalName .. " adverb-forming suffixes") elseif poscat == "nouns" then table.insert(data.categories, lang:getCanonicalName .. " noun-forming suffixes") elseif poscat == "verbs" then table.insert(data.categories, lang:getCanonicalName .. " verb-forming suffixes") else error("No category exists for suffixes forming " .. poscat .. ".") end end

if pos_functions[poscat] then pos_functions[poscat].func(args, data) end

return require("Module:headword").full_headword(data) end

pos_functions["nouns"] = { params = { [1] = {list = true, allow_holes = true}, },	func = function(args, data) if args[1][1] == "-" then table.insert(data.inflections, {label = "uncountable"}) table.insert(data.inflections, {label = "Latin", require("Module:iu-translit").tr(PAGENAME, "iu", "Cans")}) else local plural = PAGENAME

if mw.ustring.find("ᐁᐃᐄᐅᐆᐊᐋᐯᐱᐲᐳᐴᐸᐹᑌᑎᑏᑐᑑᑕᑖᑫᑭᑮᑯᑰᑲᑳᒉᒋᒌᒍᒎᒐᒑᒣᒥᒦᒧᒨᒪᒫᓀᓂᓃᓄᓅᓇᓈᓭᓯᓰᓱᓲᓴᓵᓓᓕᓖᓗᓘᓚᓛᔦᔨᔩᔪᔫᔭᔮᕓᕕᕖᕗᕘᕙᕚᕃᕆᕇᕈᕉᕋᕌᙯᕿᖀᖁᖂᖃᖄᙰᖏᖐᖑᖒᖓᖔᙱᙲᙳᙴᙵᙶᖠᖡᖢᖣᖤᖥ", mw.ustring.sub(plural, -1)) then plural = plural .. "ᑦ" elseif mw.ustring.sub(plural, -1) == "ᑦ" then plural = mw.ustring.sub(plural, 1, mw.ustring.len(plural) - 1) .. "ᑏᑦ" elseif mw.ustring.find("ᐦᑉᒃᒡᒻᓐᔅᓪᔾᕝᕐᖅᖕᖖᖦ", mw.ustring.sub(plural, -1)) then plural = mw.ustring.sub(plural, 1, mw.ustring.len(plural) - 1)

if mw.ustring.find("ᐁᐄᐆᐋᐯᐲᐴᐹᑌᑏᑑᑖᑫᑮᑰᑳᒉᒌᒎᒑᒣᒦᒨᒫᓀᓃᓅᓈᓭᓰᓲᓵᓓᓖᓘᓛᔦᔩᔫᔮᕓᕖᕘᕚᕃᕇᕉᕌᙯᖀᖂᖄᙰᖐᖒᖔᙲᙴᙶᖡᖣᖥ", mw.ustring.sub(plural, -1)) or mw.ustring.find("ᐁᐃ ᐃᐃ ᐄᐃ ᐅᐃ ᐆᐃ ᐊᐃ ᐋᐃ ᐯᐃ ᐱᐃ ᐲᐃ ᐳᐃ ᐴᐃ ᐸᐃ ᐹᐃ ᑌᐃ ᑎᐃ ᑏᐃ ᑐᐃ ᑑᐃ ᑕᐃ ᑖᐃ ᑫᐃ ᑭᐃ ᑮᐃ ᑯᐃ ᑰᐃ ᑲᐃ ᑳᐃ ᒉᐃ ᒋᐃ ᒌᐃ ᒍᐃ ᒎᐃ ᒐᐃ ᒑᐃ ᒣᐃ ᒥᐃ ᒦᐃ ᒧᐃ ᒨᐃ ᒪᐃ ᒫᐃ ᓀᐃ ᓂᐃ ᓃᐃ ᓄᐃ ᓅᐃ ᓇᐃ ᓈᐃ ᓭᐃ ᓯᐃ ᓰᐃ ᓱᐃ ᓲᐃ ᓴᐃ ᓵᐃ ᓓᐃ ᓕᐃ ᓖᐃ ᓗᐃ ᓘᐃ ᓚᐃ ᓛᐃ ᔦᐃ ᔨᐃ ᔩᐃ ᔪᐃ ᔫᐃ ᔭᐃ ᔮᐃ ᕓᐃ ᕕᐃ ᕖᐃ ᕗᐃ ᕘᐃ ᕙᐃ ᕚᐃ ᕃᐃ ᕆᐃ ᕇᐃ ᕈᐃ ᕉᐃ ᕋᐃ ᕌᐃ ᙯᐃ ᕿᐃ ᖀᐃ ᖁᐃ ᖂᐃ ᖃᐃ ᖄᐃ ᙰᐃ ᖏᐃ ᖐᐃ ᖑᐃ ᖒᐃ ᖓᐃ ᖔᐃ ᙱᐃ ᙲᐃ ᙳᐃ ᙴᐃ ᙵᐃ ᙶᐃ ᖠᐃ ᖡᐃ ᖢᐃ ᖣᐃ ᖤᐃ ᖥᐃ ᐁᐅ ᐃᐅ ᐄᐅ ᐅᐅ ᐆᐅ ᐊᐅ ᐋᐅ ᐯᐅ ᐱᐅ ᐲᐅ ᐳᐅ ᐴᐅ ᐸᐅ ᐹᐅ ᑌᐅ ᑎᐅ ᑏᐅ ᑐᐅ ᑑᐅ ᑕᐅ ᑖᐅ ᑫᐅ ᑭᐅ ᑮᐅ ᑯᐅ ᑰᐅ ᑲᐅ ᑳᐅ ᒉᐅ ᒋᐅ ᒌᐅ ᒍᐅ ᒎᐅ ᒐᐅ ᒑᐅ ᒣᐅ ᒥᐅ ᒦᐅ ᒧᐅ ᒨᐅ ᒪᐅ ᒫᐅ ᓀᐅ ᓂᐅ ᓃᐅ ᓄᐅ ᓅᐅ ᓇᐅ ᓈᐅ ᓭᐅ ᓯᐅ ᓰᐅ ᓱᐅ ᓲᐅ ᓴᐅ ᓵᐅ ᓓᐅ ᓕᐅ ᓖᐅ ᓗᐅ ᓘᐅ ᓚᐅ ᓛᐅ ᔦᐅ ᔨᐅ ᔩᐅ ᔪᐅ ᔫᐅ ᔭᐅ ᔮᐅ ᕓᐅ ᕕᐅ ᕖᐅ ᕗᐅ ᕘᐅ ᕙᐅ ᕚᐅ ᕃᐅ ᕆᐅ ᕇᐅ ᕈᐅ ᕉᐅ ᕋᐅ ᕌᐅ ᙯᐅ ᕿᐅ ᖀᐅ ᖁᐅ ᖂᐅ ᖃᐅ ᖄᐅ ᙰᐅ ᖏᐅ ᖐᐅ ᖑᐅ ᖒᐅ ᖓᐅ ᖔᐅ ᙱᐅ ᙲᐅ ᙳᐅ ᙴᐅ ᙵᐅ ᙶᐅ ᖠᐅ ᖡᐅ ᖢᐅ ᖣᐅ ᖤᐅ ᖥᐅ ᐁᐊ ᐃᐊ ᐄᐊ ᐅᐊ ᐆᐊ ᐊᐊ ᐋᐊ ᐯᐊ ᐱᐊ ᐲᐊ ᐳᐊ ᐴᐊ ᐸᐊ ᐹᐊ ᑌᐊ ᑎᐊ ᑏᐊ ᑐᐊ ᑑᐊ ᑕᐊ ᑖᐊ ᑫᐊ ᑭᐊ ᑮᐊ ᑯᐊ ᑰᐊ ᑲᐊ ᑳᐊ ᒉᐊ ᒋᐊ ᒌᐊ ᒍᐊ ᒎᐊ ᒐᐊ ᒑᐊ ᒣᐊ ᒥᐊ ᒦᐊ ᒧᐊ ᒨᐊ ᒪᐊ ᒫᐊ ᓀᐊ ᓂᐊ ᓃᐊ ᓄᐊ ᓅᐊ ᓇᐊ ᓈᐊ ᓭᐊ ᓯᐊ ᓰᐊ ᓱᐊ ᓲᐊ ᓴᐊ ᓵᐊ ᓓᐊ ᓕᐊ ᓖᐊ ᓗᐊ ᓘᐊ ᓚᐊ ᓛᐊ ᔦᐊ ᔨᐊ ᔩᐊ ᔪᐊ ᔫᐊ ᔭᐊ ᔮᐊ ᕓᐊ ᕕᐊ ᕖᐊ ᕗᐊ ᕘᐊ ᕙᐊ ᕚᐊ ᕃᐊ ᕆᐊ ᕇᐊ ᕈᐊ ᕉᐊ ᕋᐊ ᕌᐊ ᙯᐊ ᕿᐊ ᖀᐊ ᖁᐊ ᖂᐊ ᖃᐊ ᖄᐊ ᙰᐊ ᖏᐊ ᖐᐊ ᖑᐊ ᖒᐊ ᖓᐊ ᖔᐊ ᙱᐊ ᙲᐊ ᙳᐊ ᙴᐊ ᙵᐊ ᙶᐊ ᖠᐊ ᖡᐊ ᖢᐊ ᖣᐊ ᖤᐊ ᖥᐊ", mw.ustring.sub(plural, -2, -1)) then plural = plural .. "ᑦ" else plural = plural .. "ᐃᑦ" end end

table.insert(data.inflections, {label = "plural", accel = {form = "p"}, plural}) table.insert(data.inflections, {label = "Latin", require("Module:iu-translit").tr(PAGENAME, "iu", "Cans")}) end end }

return export