Module:aot-headword
Jump to navigation
Jump to search
- This module lacks a documentation subpage. Please create it.
- Useful links: subpage list • links • transclusions • testcases • sandbox
local export = {}
local pos_functions = {}
local lang = require("Module:languages").getByCode("aot")
local PAGENAME = mw.title.getCurrentTitle().text
local script = lang:findBestScript(PAGENAME) -- Latn or Beng
function export.show(frame)
local args = frame:getParent().args
local poscat = frame.args[1] or error("Part of speech has not been specified. Please pass parameter 1 to the module invocation.")
local data = {lang = lang, sc = script, pos_category = poscat, sccat = true, categories = {}, heads = {args["head"] or PAGENAME}, translits = {args["tr"]}, inflections = {},
no_redundant_head_cat = not args["head"]
}
local beng = {label = "Bengali script", lang = lang, sc = require("Module:scripts").getByCode("Beng")}
if args[1] then table.insert(beng, args[1]) end
if args[2] then table.insert(beng, args[2]) end
if args[3] then table.insert(beng, args[3]) end
if args[4] then table.insert(beng, args[4]) end
if #beng > 0 then table.insert(data.inflections, beng) end
if pos_functions[poscat] then
pos_functions[poscat](args, data)
end
return require("Module:headword").full_headword(data)
end
pos_functions["verbs"] = function(args, data)
--verb is always prefix
data.heads[1] = data.heads[1] .. "-"
end
pos_functions["classifiers"] = function(args, data)
--classifier is always prefix
data.heads[1] = data.heads[1] .. "-"
end
pos_functions["adjectives"] = function(args, data)
--adjective can be either type 1 or type 2
if args["t"] ~= "1" and args["t"] ~= "2" then
args["t"] = "?"
end
--adjective type 1 is prefix
if args["t"] == "1" then
data.heads[1] = data.heads[1] .. "-"
end
table.insert(data.inflections, {label = "type " .. args["t"]})
end
return export