Module:moh-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("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, "Mohawk " .. cat2) end
if cat3 then table.insert(data.categories, "Mohawk " .. cat3) end
if pos_functions[poscat] then
pos_functions[poscat](args, data)
end
return require("Module:headword").full_headword(data)
end
pos_functions["nouns"] = 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= "locative", loc})
end
local pl = args["pl"]
if pl ~= nil then
table.insert(data.inflections, {label= "plural", pl})
end
-- prefix
local prefix = args["pre"]
if prefix ~= nil then
if prefix == "ka" or prefix == "k" then
table.insert(data.categories, "Mohawk terms prefixed with ka-")
elseif prefix == "o" then
table.insert(data.categories, "Mohawk terms prefixed with 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, "Mohawk -on nouns")
elseif suffix == "a’" or prefix == "-" then
table.insert(data.categories, "Mohawk -a’ nouns")
elseif suffix == "e’" then
table.insert(data.categories, "Mohawk -e’ nouns")
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= "feminine", fem})
end
-- masculine
local masc = args["m"]
if masc ~= nil then
table.insert(data.inflections, {label= "masculine", masc})
end
end
pos_functions["proper nouns"] = pos_functions["nouns"]
pos_functions["verbs"] = function(args, data)
local fut = args[1]
if fut ~= nil and fut ~= "" then
table.insert(data.inflections, {label= "future",fut})
end
local perf = args[2]
if perf ~= nil and perf ~= "" then
table.insert(data.inflections, {label= "perfect", perf})
end
local imp = args[3]
if imp ~= nil and imp ~= "" then
table.insert(data.inflections, {label= "imperative", 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, "Mohawk reflexive verbs")
end
end
local loc = args["loc"]
if loc ~= nil then
if loc == "cis" then
table.insert(data.categories, "Mohawk terms prefixed with i-")
elseif loc == "trans" then
table.insert(data.categories, "Mohawk terms prefixed with t-")
end
end
local stem = args["inc"]
if stem ~= nil and stem ~= "" then
table.insert(data.inflections, {label= "incorporating form", stem})
end
end
pos_functions["prefixes"] = function(args, data)
local prefix = args[1]
if prefix ~= nil then
if prefix == "agent" then
table.insert(data.categories, "Mohawk agent pronominal prefixes")
elseif prefix == "patient" then
table.insert(data.categories, "Mohawk patient pronominal prefixes")
elseif prefix == "transitive" then
table.insert(data.categories, "Mohawk transitive pronominal prefixes")
elseif prefix == "possessive" then
table.insert(data.categories, "Mohawk possesive prefixes")
else
table.insert(data.categories, "Mohawk prefixes")
end
end
end
pos_functions["adverbs"] = function(args, data)
table.insert(data.categories, "Mohawk adverbs")
end
pos_functions["numerals"] = function(args, data)
table.insert(data.categories, "Mohawk numerals")
end
pos_functions["conjunction"] = function(args, data)
table.insert(data.categories, "Mohawk conjunctions")
end
return export