Module:rmq-headword

local export = {} local lang = require("Module:languages").getByCode("rmq")

--nouns function export.show_noun(frame) local args = frame:getParent.args local data = {lang = lang, pos_category = "nouns", categories = {}, sort_key = args.sort, heads = {args.head}, genders, inflections = {}} local tracking_categories = {} --define variables

local stem = mw.title.getCurrentTitle.text if args.head then --in case a different headword is specified stem = args.head end local short_stem = stem:sub(1, -2) local ending = ""

--add gender local g, genders = args.g or args[1] if g == "m" then data.genders = { "m" } elseif g == "f" then data.genders = { "f" } elseif g == "both" then data.genders = { "m","f" } else data.genders = { "?" }	end --find ending ending = stem:sub(-1) if	stem:sub(-2,-1) == "ay" then stem = stem:sub(1, -3) ending = "ay" elseif stem:sub(-2,-1) == "oy" then stem = stem:sub(1, -3) ending = "oy" elseif stem:sub(-2,-1) == "uy" then stem = stem:sub(1,-3) ending = "uy" elseif stem:sub(-2,-1) == "ó" then stem = stem:sub(1,-3) ending = "ó" elseif stem:sub(-2,-1) == "í" then ending = "í" elseif ending == "y" then stem = stem:sub(1,-2) end

--generate plurals local pl = args.pl or args[2] if pl then if pl == "-" then table.insert(data.categories, "Caló uncountable nouns") data.inflections = else data.inflections = end else if ending == "ay" then data.inflections = elseif ending == "oy" then data.inflections = elseif ending == "uy" then data.inflections = elseif ending == "y" then data.inflections = elseif ending == "ó" then data.inflections = elseif ending == "í" then data.inflections = elseif ('aeiouáé'):match(ending) then data.inflections = else data.inflections = end end

return require("Module:headword").full_headword(data) .. require("Module:utilities").format_categories(tracking_categories, lang, args.sort) end

return export