local export = {}
local pos_functions = {}
local lang = require("Module:languages").getByCode("tts")
local script = require('Module:scripts').getByCode("Thai")
local PAGENAME = mw.title.getCurrentTitle().text
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 poscat_th = require("Module:th-utilities").th_pos(poscat)
local data = {lang = lang, sc = script, pos_category = poscat_th, categories = {}, heads = {args["head"]}, inflections = {}, sort_key = args["sort"]}
if pos_functions[poscat_th] then
pos_functions[poscat_th](args, data)
end
return require("Module:headword").full_headword(data)
end
pos_functions["คำกริยา"] = function(args, data)
local par1 = args[1]; if par1 == "" then par1 = nil end
local par2 = args[2]; if par2 == "" then par2 = nil end
local par3 = args[3]; if par3 == "" then par3 = nil end
local abstract_forms = {label = "คำอาการนาม", accel = {pos = "คำนาม", form = "abstract-noun"}}
if par1 ~= "-" then
if not par1 then
table.insert(abstract_forms, "การ" .. PAGENAME)
else
if par1 == "~" then
table.insert(abstract_forms, "การ" .. PAGENAME)
table.insert(abstract_forms, "ความ" .. PAGENAME)
else
table.insert(abstract_forms, par1)
table.insert(abstract_forms, par2)
table.insert(abstract_forms, par3)
end
end
table.insert(data.inflections, abstract_forms)
end
end
pos_functions["คำคุณศัพท์"] = function(args, data)
local par1 = args[1]; if par1 == "" then par1 = nil end
local par2 = args[2]; if par2 == "" then par2 = nil end
local par3 = args[3]; if par3 == "" then par3 = nil end
local abstract_forms = {label = "คำอาการนาม", accel = {pos = "คำนาม", form = "abstract-noun"}}
if par1 ~= "-" then
if not par1 then
table.insert(abstract_forms, "ความ" .. PAGENAME)
else
table.insert(abstract_forms, par1)
table.insert(abstract_forms, par2)
table.insert(abstract_forms, par3)
end
table.insert(data.inflections, abstract_forms)
end
end
-- same logic
pos_functions["คำกริยาวิเศษณ์"] = pos_functions["คำคุณศัพท์"]
-- same logic
pos_functions["คำวิสามานยนาม"] = pos_functions["คำนาม"]
return export