Module:User:Joonas07/sq-headword

local export = {} local pos_functions = {}

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

function export.show(frame) local args = frame:getParent.args NAMESPACE = mw.title.getCurrentTitle.nsText 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"}, ["cat"] = {list = true}, }	if pos_functions[poscat] then for key, val in pairs(pos_functions[poscat].params) do			params[key] = val end end args = require("Module:parameters").process(args, params) local data = { lang = lang, pos_category = args["suff"] and "suffixes" or poscat, categories = args["suff"] and {lang:getCanonicalName .. " " .. poscat:sub(1, -2) .. "-forming suffixes"} or {}, heads = args.head, genders = {}, inflections = {} }	for key, val in ipairs(args.cat) do table.insert(data.categories, lang:getCanonicalName .. " " .. val) end if pos_functions[poscat] then pos_functions[poscat].func(args, data) end return require("Module:headword").full_headword(data) end

pos_functions["adjectives"] = {} -- TBD

pos_functions["adverbs"] = {} -- TBD

pos_functions["conjunctions"] = {} -- TBD

pos_functions["determiners"] = { params = { [1] = {},		[2] = {},		[3] = {},		[4] = {},		["art"] = {type = "boolean"} },	func = function(args, data) if args[1] then table.insert(data.genders, args[1]) table.insert(data.inflections, {label = 'feminine singular', value = args[2]}) end if args[3] then table.insert(data.inflections, {label = 'masculine plural', value = args[3]}) table.insert(data.inflections, {label = 'feminine plural', value = args[4]}) end end }

pos_functions["nouns"] = {} -- TBD

pos_functions["numerals"] = {} -- TBD

pos_functions["participles"] = {} -- TBD

pos_functions["particles"] = {} -- TBD

pos_functions["pronouns"] = {} -- TBD

pos_functions["proper nouns"] = {} -- TBD

pos_functions["verbs"] = { params = { [1] = {list = "aor"}, [2] = {list = "part"}, [3] = {},		["impers"] = {type = "boolean"} },	func = function(args, data) local original_forms = mw.clone(args[1]) local is_mediopassive = (args[3] == "med" or args[3] == "mid" or PAGENAME:find("ohem$") or PAGENAME:find("ehem$") or PAGENAME:find("ohet$") or PAGENAME:find("ehet$")) if args[3] == "act" then table.insert(data.inflections, {label = "active"}) elseif is_mediopassive then table.insert(data.inflections, {label = "mediopassive"}) for i, form in ipairs(args[1]) do args[1][i] = "u " .. form end else table.insert(data.inflections, {label = "active"}) end if args.impers then args[1].label = 'third-person aorist' args[1].request = true table.insert(data.categories, "Albanian impersonal verbs") else args[1].label = 'first-person aorist' args[1].request = true end for i, form in ipairs(args[1]) do args[1][i] = "" .. form .. "" end

table.insert(data.inflections, args[1]) args[2].label = 'participle' args[2].request = true table.insert(data.inflections, args[2]) end }

return export