local export = {}
local pos_functions = {}
local lang = require("Module:languages").getByCode("moh")
-- The main entry point.
-- This is the only function that can be invoked from a template.
function export.show(frame)
PAGENAME = mw.title.getCurrentTitle().text
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 cat = args["cat"]; if cat == "" then cat = nil end
local cat2 = args["cat2"]; if cat2 == "" then cat2 = nil end
local cat3 = args["cat3"]; if cat3 == "" then cat3 = nil end
local head = args["head"]; if head == "" then head = nil end
local data = {lang = lang, pos_category = cat or poscat, categories = {}, heads = {PAGENAME}, genders = {}, inflections = {}}
if cat2 then table.insert(data.categories, "莫霍克語" .. cat2) end
if cat3 then table.insert(data.categories, "莫霍克語" .. cat3) end
if pos_functions[poscat] then
pos_functions[poscat](args, data)
end
return require("Module:headword").full_headword(data)
end
pos_functions["名詞"] = function(args, data)
-- joiner
local joiner = args["joiner"]
if joiner ~= nil then --categorize joiner
if joiner == "t" or joiner == "ht" or joiner == "’t" then
table.insert(data.categories, "Mohawk nouns with joiner " .. "-t-")
end
else joiner = ""
end
-- stem
local stem = args[1]
if stem ~= nil then
table.insert(data.inflections, {label= "stem",{nolink=true, term = stem .. joiner}})
end
--locative
local loc = args["loc"]
if loc ~= nil then
table.insert(data.inflections, {label= "方位格", loc})
end
local pl = args["pl"]
if pl ~= nil then
table.insert(data.inflections, {label= "複數", pl})
end
-- prefix
local prefix = args["pre"]
if prefix ~= nil then
if prefix == "ka" or prefix == "k" then
table.insert(data.categories, "含有前綴ka-的莫霍克語詞")
elseif prefix == "o" then
table.insert(data.categories, "含有前綴o-的莫霍克語詞")
elseif prefix == "ska" then
table.insert(data.categories, "Mohawk singulative nouns")
end
end
-- suffix
local suffix = args["suf"]
if suffix ~= nil then
if suffix == "on" or suffix == "k" then
table.insert(data.categories, "莫霍克語-on名詞")
elseif suffix == "a’" or prefix == "-" then
table.insert(data.categories, "莫霍克語-a’名詞")
elseif suffix == "e’" then
table.insert(data.categories, "莫霍克語-e’名詞")
end
end
-- joiner
local gender = args["g"]
if gender ~= nil then
if gender == "m" then
table.insert(data.genders, "m")
elseif gender == "f" then
table.insert(data.genders, "f")
end
end
-- feminine
local fem = args["f"]
if fem ~= nil then
table.insert(data.inflections, {label= "陰性", fem})
end
-- masculine
local masc = args["m"]
if masc ~= nil then
table.insert(data.inflections, {label= "陽性", masc})
end
end
pos_functions["專有名詞"] = pos_functions["名詞"]
pos_functions["動詞"] = function(args, data)
local fut = args[1]
if fut ~= nil and fut ~= "" then
table.insert(data.inflections, {label= "未來時",fut})
end
local perf = args[2]
if perf ~= nil and perf ~= "" then
table.insert(data.inflections, {label= "完成體", perf})
end
local imp = args[3]
if imp ~= nil and imp ~= "" then
table.insert(data.inflections, {label= "祈使語氣", imp})
end
local reflexive = args["refl"]
if reflexive ~= nil then
if reflexive == "at" then
table.insert(data.categories, "Mohawk middle verbs")
elseif reflexive == "atat" then
table.insert(data.categories, "莫霍克語反身動詞")
end
end
local loc = args["loc"]
if loc ~= nil then
if loc == "cis" then
table.insert(data.categories, "含有前綴i-的莫霍克語詞")
elseif loc == "trans" then
table.insert(data.categories, "含有前綴t-的莫霍克語詞")
end
end
local stem = args["inc"]
if stem ~= nil and stem ~= "" then
table.insert(data.inflections, {label= "合併形", stem})
end
end
pos_functions["前綴"] = function(args, data)
local prefix = args[1]
if prefix ~= nil then
if prefix == "agent" then
table.insert(data.categories, "莫霍克語施事代詞前綴")
elseif prefix == "patient" then
table.insert(data.categories, "莫霍克語受事代詞前綴")
elseif prefix == "transitive" then
table.insert(data.categories, "莫霍克語及物代詞前綴")
elseif prefix == "possessive" then
table.insert(data.categories, "莫霍克語所有格前綴")
else
table.insert(data.categories, "莫霍克語前綴")
end
end
end
pos_functions["副詞"] = function(args, data)
table.insert(data.categories, "莫霍克語副詞")
end
pos_functions["數詞"] = function(args, data)
table.insert(data.categories, "莫霍克語數詞")
end
pos_functions["連詞"] = function(args, data)
table.insert(data.categories, "莫霍克語連詞")
end
return export