local m_utilities = require("Module:utilities")
local m_links = require("Module:links")
local lang = require("Module:languages").getByCode("zu")
local export = {}
function export.adjective(frame)
local params = {
= {},
}
local args = require("Module:parameters").process(frame:getParent().args, params)
local data = {forms = {}, info = "adjective concord", categories = {}}
if args == "L" or args == "H" or args == "LH" or args == "HH" or args == "HHH" then
data.info = data.info .. ", tone " .. args
table.insert(data.categories, lang:getCanonicalName() .. " adjectives with tone " .. args)
elseif args then
error("The tone must be \"L\", \"H\", \"LH\", \"HH\" or \"HHH\".")
else
table.insert(data.categories, "Requests for tone in " .. lang:getCanonicalName() .. " adjective entries")
end
local base = mw.title.getCurrentTitle().subpageText
data.forms = {"engim" .. (mw.ustring.find(base, "^+$") and "u" or "") .. base}
data.forms = {"om" .. (mw.ustring.find(base, "^+$") and "u" or "") .. base}
data.forms = {"esiba" .. base}
data.forms = {"eniba" .. base}
data.forms = {"om" .. (mw.ustring.find(base, "^+$") and "u" or "") .. base}
data.forms = {"aba" .. base}
data.forms = {"om" .. (mw.ustring.find(base, "^+$") and "u" or "") .. base}
data.forms = {"emi" .. base}
data.forms = {"eli" .. base}
data.forms = {"ama" .. base}
data.forms = {"esi" .. base}
data.forms = {"ezi" .. (mw.ustring.find(base, "^") and "m" or mw.ustring.find(base, "^n") and "" or "n") .. (mw.ustring.find(base, "^h") and mw.ustring.gsub(base, "^()h", "%1") or mw.ustring.find(base, "^sh") and mw.ustring.gsub(base, "^sh", "tsh") or base)}
data.forms = {"e" .. (mw.ustring.find(base, "^") and "m" or mw.ustring.find(base, "^n") and "" or "n") .. (mw.ustring.find(base, "^h") and mw.ustring.gsub(base, "^()h", "%1") or mw.ustring.find(base, "^sh") and mw.ustring.gsub(base, "^sh", "tsh") or base)}
data.forms = {"ezi" .. (mw.ustring.find(base, "^") and "m" or mw.ustring.find(base, "^n") and "" or "n") .. (mw.ustring.find(base, "^h") and mw.ustring.gsub(base, "^()h", "%1") or mw.ustring.find(base, "^sh") and mw.ustring.gsub(base, "^sh", "tsh") or base)}
data.forms = {"olu" .. base}
data.forms = {"obu" .. base}
data.forms = {"oku" .. base}
data.forms = {"oku" .. base}
data.forms = {"engingem" .. (mw.ustring.find(base, "^+$") and "u" or "") .. base}
data.forms = {"ongem" .. (mw.ustring.find(base, "^+$") and "u" or "") .. base}
data.forms = {"esingeba" .. base}
data.forms = {"eningeba" .. base}
data.forms = {"ongem" .. (mw.ustring.find(base, "^+$") and "u" or "") .. base}
data.forms = {"abangeba" .. base}
data.forms = {"ongem" .. (mw.ustring.find(base, "^+$") and "u" or "") .. base}
data.forms = {"engemi" .. base}
data.forms = {"elingeli" .. base}
data.forms = {"angema" .. base}
data.forms = {"esingesi" .. base}
data.forms = {"ezingezi" .. (mw.ustring.find(base, "^") and "m" or mw.ustring.find(base, "^n") and "" or "n") .. (mw.ustring.find(base, "^h") and mw.ustring.gsub(base, "^()h", "%1") or mw.ustring.find(base, "^sh") and mw.ustring.gsub(base, "^sh", "tsh") or base)}
data.forms = {"enge" .. (mw.ustring.find(base, "^") and "m" or mw.ustring.find(base, "^n") and "" or "n") .. (mw.ustring.find(base, "^h") and mw.ustring.gsub(base, "^()h", "%1") or mw.ustring.find(base, "^sh") and mw.ustring.gsub(base, "^sh", "tsh") or base),
"engeyi" .. (mw.ustring.find(base, "^") and "m" or mw.ustring.find(base, "^n") and "" or "n") .. (mw.ustring.find(base, "^h") and mw.ustring.gsub(base, "^()h", "%1") or mw.ustring.find(base, "^sh") and mw.ustring.gsub(base, "^sh", "tsh") or base)
}
data.forms = {"ezingezi" .. (mw.ustring.find(base, "^") and "m" or mw.ustring.find(base, "^n") and "" or "n") .. (mw.ustring.find(base, "^h") and mw.ustring.gsub(base, "^()h", "%1") or mw.ustring.find(base, "^sh") and mw.ustring.gsub(base, "^sh", "tsh") or base)}
data.forms = {"olungelu" .. base}
data.forms = {"obungebu" .. base}
data.forms = {"okungeku" .. base}
data.forms = {"okungeku" .. base}
data.forms = {"ngim" .. (mw.ustring.find(base, "^+$") and "u" or "") .. base}
data.forms = {"um" .. (mw.ustring.find(base, "^+$") and "u" or "") .. base}
data.forms = {"siba" .. base}
data.forms = {"niba" .. base}
data.forms = {"m" .. (mw.ustring.find(base, "^+$") and "u" or "") .. base}
data.forms = {"ba" .. base}
data.forms = {"m" .. (mw.ustring.find(base, "^+$") and "u" or "") .. base}
data.forms = {"mi" .. base}
data.forms = {"li" .. base}
data.forms = {"ma" .. base}
data.forms = {"si" .. base}
data.forms = {"zi" .. (mw.ustring.find(base, "^") and "m" or mw.ustring.find(base, "^n") and "" or "n") .. (mw.ustring.find(base, "^h") and mw.ustring.gsub(base, "^()h", "%1") or mw.ustring.find(base, "^sh") and mw.ustring.gsub(base, "^sh", "tsh") or base)}
data.forms = {"i" .. (mw.ustring.find(base, "^") and "m" or mw.ustring.find(base, "^n") and "" or "n") .. (mw.ustring.find(base, "^h") and mw.ustring.gsub(base, "^()h", "%1") or mw.ustring.find(base, "^sh") and mw.ustring.gsub(base, "^sh", "tsh") or base),
"yi" .. (mw.ustring.find(base, "^") and "m" or mw.ustring.find(base, "^n") and "" or "n") .. (mw.ustring.find(base, "^h") and mw.ustring.gsub(base, "^()h", "%1") or mw.ustring.find(base, "^sh") and mw.ustring.gsub(base, "^sh", "tsh") or base)
}
data.forms = {"zi" .. (mw.ustring.find(base, "^") and "m" or mw.ustring.find(base, "^n") and "" or "n") .. (mw.ustring.find(base, "^h") and mw.ustring.gsub(base, "^()h", "%1") or mw.ustring.find(base, "^sh") and mw.ustring.gsub(base, "^sh", "tsh") or base)}
data.forms = {"lu" .. base}
data.forms = {"bu" .. base}
data.forms = {"ku" .. base}
data.forms = {"ku" .. base}
data.forms = {"angim" .. (mw.ustring.find(base, "^+$") and "u" or "") .. base}
data.forms = {"awum" .. (mw.ustring.find(base, "^+$") and "u" or "") .. base}
data.forms = {"asiba" .. base}
data.forms = {"aniba" .. base}
data.forms = {"akam" .. (mw.ustring.find(base, "^+$") and "u" or "") .. base}
data.forms = {"ababa" .. base}
data.forms = {"awum" .. (mw.ustring.find(base, "^+$") and "u" or "") .. base}
data.forms = {"ayimi" .. base}
data.forms = {"alili" .. base}
data.forms = {"awama" .. base}
data.forms = {"asisi" .. base}
data.forms = {"azizi" .. (mw.ustring.find(base, "^") and "m" or mw.ustring.find(base, "^n") and "" or "n") .. (mw.ustring.find(base, "^h") and mw.ustring.gsub(base, "^()h", "%1") or mw.ustring.find(base, "^sh") and mw.ustring.gsub(base, "^sh", "tsh") or base)}
data.forms = {"ayiyi" .. (mw.ustring.find(base, "^") and "m" or mw.ustring.find(base, "^n") and "" or "n") .. (mw.ustring.find(base, "^h") and mw.ustring.gsub(base, "^()h", "%1") or mw.ustring.find(base, "^sh") and mw.ustring.gsub(base, "^sh", "tsh") or base)}
data.forms = {"azizi" .. (mw.ustring.find(base, "^") and "m" or mw.ustring.find(base, "^n") and "" or "n") .. (mw.ustring.find(base, "^h") and mw.ustring.gsub(base, "^()h", "%1") or mw.ustring.find(base, "^sh") and mw.ustring.gsub(base, "^sh", "tsh") or base)}
data.forms = {"alulu" .. base}
data.forms = {"abubu" .. base}
data.forms = {"akuku" .. base}
data.forms = {"akuku" .. base}
return make_table(data) .. m_utilities.format_categories(data.categories, lang)
end
function export.enumerative(frame)
local params = {
= {},
}
local args = require("Module:parameters").process(frame:getParent().args, params)
local data = {forms = {}, info = "enumerative concord", categories = {}}
data.simple = true
if args == "L" or args == "H" or args == "LH" or args == "HH" or args == "HHH" then
data.info = data.info .. ", tone " .. args
table.insert(data.categories, lang:getCanonicalName() .. " adjectives with tone " .. args)
elseif args then
error("The tone must be \"L\", \"H\", \"LH\", \"HH\" or \"HHH\".")
else
table.insert(data.categories, "Requests for tone in " .. lang:getCanonicalName() .. " enumerative entries")
end
local base = mw.title.getCurrentTitle().subpageText
data.forms = {"m" .. (mw.ustring.find(base, "^+$") and "u" or "") .. base}
data.forms = {"ba" .. base}
data.forms = {"m" .. (mw.ustring.find(base, "^+$") and "u" or "") .. base}
data.forms = {"mi" .. base}
data.forms = {"li" .. base}
data.forms = {"ma" .. base}
data.forms = {"si" .. base}
data.forms = {"zi" .. base}
data.forms = {"yi" .. base}
data.forms = {"zi" .. base}
data.forms = {"lu" .. base}
data.forms = {"bu" .. base}
data.forms = {"ku" .. base}
data.forms = {"ku" .. base}
return make_table(data) .. m_utilities.format_categories(data.categories, lang)
end
function export.relative(frame)
local params = {
= {},
}
local args = require("Module:parameters").process(frame:getParent().args, params)
local data = {forms = {}, info = "relative concord", categories = {}}
if args == "L" or args == "H" or args == "LH" or args == "HH" or args == "HHH" then
data.info = data.info .. ", tone " .. args
table.insert(data.categories, lang:getCanonicalName() .. " adjectives with tone " .. args)
elseif args then
error("The tone must be \"L\", \"H\", \"LH\", \"HH\" or \"HHH\".")
else
table.insert(data.categories, "Requests for tone in " .. lang:getCanonicalName() .. " relative entries")
end
local base = mw.title.getCurrentTitle().subpageText
data.forms = {"engi" .. base}
data.forms = {"o" .. base}
data.forms = {"esi" .. base}
data.forms = {"eni" .. base}
data.forms = {"o" .. base}
data.forms = {"aba" .. base}
data.forms = {"o" .. base}
data.forms = {"e" .. base}
data.forms = {"eli" .. base}
data.forms = {"a" .. base}
data.forms = {"esi" .. base}
data.forms = {"ezi" .. base}
data.forms = {"e" .. base}
data.forms = {"ezi" .. base}
data.forms = {"olu" .. base}
data.forms = {"obu" .. base}
data.forms = {"oku" .. base}
data.forms = {"oku" .. base}
data.forms = {"enginge" .. base}
data.forms = {"onge" .. base}
data.forms = {"esinge" .. base}
data.forms = {"eninge" .. base}
data.forms = {"onge" .. base}
data.forms = {"abange" .. base}
data.forms = {"onge" .. base}
data.forms = {"enge" .. base}
data.forms = {"elinge" .. base}
data.forms = {"ange" .. base}
data.forms = {"esinge" .. base}
data.forms = {"ezinge" .. base}
data.forms = {"enge" .. base}
data.forms = {"ezinge" .. base}
data.forms = {"olunge" .. base}
data.forms = {"obunge" .. base}
data.forms = {"okunge" .. base}
data.forms = {"okunge" .. base}
data.forms = {"ngi" .. base}
data.forms = {"u" .. base}
data.forms = {"si" .. base}
data.forms = {"ni" .. base}
data.forms = {"u" .. base}
data.forms = {"ba" .. base}
data.forms = {"u" .. base}
data.forms = {"i" .. base}
data.forms = {"li" .. base}
data.forms = {"a" .. base}
data.forms = {"si" .. base}
data.forms = {"zi" .. base}
data.forms = {"i" .. base}
data.forms = {"zi" .. base}
data.forms = {"lu" .. base}
data.forms = {"bu" .. base}
data.forms = {"ku" .. base}
data.forms = {"ku" .. base}
data.forms = {"angi" .. base}
data.forms = {"awu" .. base}
data.forms = {"asi" .. base}
data.forms = {"ani" .. base}
data.forms = {"aka" .. base}
data.forms = {"aba" .. base}
data.forms = {"awu" .. base}
data.forms = {"ayi" .. base}
data.forms = {"ali" .. base}
data.forms = {"awa" .. base}
data.forms = {"asi" .. base}
data.forms = {"azi" .. base}
data.forms = {"ayi" .. base}
data.forms = {"azi" .. base}
data.forms = {"alu" .. base}
data.forms = {"abu" .. base}
data.forms = {"aku" .. base}
data.forms = {"aku" .. base}
return make_table(data) .. m_utilities.format_categories(data.categories, lang)
end
-- Make the table
function make_table(data)
local function repl(param)
if param == "info" then
return mw.getContentLanguage():ucfirst(data.info or "")
end
local form = data.forms
if not form or #form == 0 then
return "—"
end
local ret = {}
for key, subform in ipairs(form) do
table.insert(ret, m_links.full_link({lang = lang, term = subform}))
end
return table.concat(ret, ", ")
end
local names = {
= "modifier",
= "copulative",
= "positive",
= "negative",
= "1st singular",
= "2nd singular",
= "1st plural",
= "2nd plural",
= "class 1",
= "class 2",
= "class 3",
= "class 4",
= "class 5",
= "class 6",
= "class 7",
= "class 8",
= "class 9",
= "class 10",
= "class 11",
= "class 14",
= "class 15",
= "class 17",
}
local classes = {"c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8", "c9", "c10", "c11", "c14", "c15", "c17"}
local columns = {"mod"}
local columns2 = {}
if not data.simple then
table.insert(classes, 1, "1sg")
table.insert(classes, 2, "2sg")
table.insert(classes, 3, "1pl")
table.insert(classes, 4, "2pl")
table.insert(columns, "cop")
table.insert(columns2, "pos")
table.insert(columns2, "neg")
end
local wikicode = {}
table.insert(wikicode, mw.getCurrentFrame():expandTemplate{
title = 'inflection-table-top',
args = {
title = '{{{info}}}',
palette = 'green',
tall = 'yes',
}
})
table.insert(wikicode, '!')
for _, col in ipairs(columns) do
if not data.simple then
table.insert(wikicode, '! colspan="2" |' .. names)
else
table.insert(wikicode, '! ' .. names)
end
end
if not data.simple then
table.insert(wikicode, "|-")
table.insert(wikicode, "!")
table.insert(wikicode, '! class="secondary" | ' .. names)
table.insert(wikicode, '! class="secondary" | ' .. names)
table.insert(wikicode, '! class="secondary" | ' .. names)
table.insert(wikicode, '! class="secondary" | ' .. names)
end
for _, class in ipairs(classes) do
table.insert(wikicode, "|- ")
table.insert(wikicode, "! " .. names)
for _, col in ipairs(columns) do
if not data.simple then
for _, col2 in ipairs(columns2) do
table.insert(wikicode, "| {{{" .. col .. "_" .. class .. "_" .. col2 .. "}}}")
end
else
table.insert(wikicode, "| {{{" .. col .. "_" .. class .. "}}}")
end
end
end
table.insert(wikicode, mw.getCurrentFrame():expandTemplate{ title = 'inflection-table-bottom' })
wikicode = table.concat(wikicode, "\n")
return mw.ustring.gsub(wikicode, "{{{(+)}}}", repl)
end
return export