local export = {}
local pos_functions = {}
local lang = require("Module:languages").getByCode("tts")
local script = require('Module:scripts').getByCode("Isan")
local PAGENAME = mw.title.getCurrentTitle().text
--local pron = require("Module:tts-pron")
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 head = args["head"]
local tr = args["tr"]
local data = {
lang = lang,
pos_category = poscat,
categories = {},
heads = {head},
translits = {tr},
inflections = {}
}
if pos_functions[poscat] then
pos_functions[poscat](args, data)
end
local content = mw.title.new(PAGENAME):getContent()
if content then
local phon
-- local code = mw.ustring.match(content, '{{tts%-pron[^}]*}}')
local code = mw.ustring.match(content, '{{tts[^}]*}}') --always match
local false_positive = mw.ustring.match(content, 'obsolete spelling of') or mw.ustring.match(content, 'obsolete form of') or mw.ustring.match(content, 'alternative spelling of') or mw.ustring.match(content, 'archaic spelling of') or mw.ustring.match(PAGENAME, 'Unsupported')
local code2 = mw.ustring.match(content, '{{audio|tts|[^}]*}}')
if code2 then
table.insert(data.categories, "Isan terms with redundant audio template")
end
end
return require("Module:headword").full_headword(data)
end
pos_functions["nouns"] = function(args, data)
local classifiers = {label = "classifier"}
if args[1] then
for _,par in ipairs(args) do
if par == "*" then
table.insert(classifiers, PAGENAME) -- shorthand
table.insert(data.categories, "Isan classifiers")
table.insert(data.categories, "Isan nouns classified by " .. PAGENAME)
else
table.insert(classifiers, par)
table.insert(data.categories, "Isan nouns classified by " .. par)
end
end
table.insert(data.inflections, classifiers)
end
end
pos_functions["verbs"] = 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 = "abstract noun", accel = {pos = "noun", 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["adjectives"] = 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 = "abstract noun", accel = {pos = "noun", 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["adverbs"] = pos_functions["adjectives"]
-- same logic
pos_functions["proper nouns"] = pos_functions["nouns"]
return export