This module is used for Zulu headword-line templates.
local export = {}
local lang = require("Module:languages").getByCode("zu")
-- A list of valid noun classes
-- The value is the corresponding plural class.
-- True means the class is uncountable.
local singular_classes = {
= "2",
= "2a",
= "4",
= "4a",
= "6",
= "8",
= "10",
= "10",
= true,
= true,
= true,
}
local plural_classes = {
= true,
= true,
= true,
= true,
= true,
= true,
= true,
}
local prefixes = {
= {"umu()", "um(.)", "u(n)"},
= {"u()"},
= {"aba()", "abe()"},
= {"o()"},
= {"umu()", "um(.)", "u(n)"},
= {"u()"},
= {"imi()", "im()"},
= {"imi()", "im()"},
= {"ili()", "i()"},
= {"ama()", "am()"},
= {"isi()", "is()"},
= {"izi()", "iz()"},
= {"in()", "im()", "i()"},
= {"izin()", "izim()", "izi()", "iz()"},
= {"ulu()", "u()"},
= {"ubu()", "utshw(a)", "utsh(a)"},
= {"uku()", "ukw()"},
= {"uku()", "ukw()"},
}
local function remove_prefix(word, class)
if not class or not prefixes then
return nil
end
-- If there is a capital letter in the word,
-- assume that it's the first letter of the stem and remove everything before it
if word:find("") then
return word:gsub("^+", "")
else
for key, prefix in ipairs(prefixes) do
word = word:gsub("^" .. prefix, "%1")
end
return word:gsub("^-", "")
end
end
function export.noun(frame)
local params = {
= {},
= {},
= {},
= {list = true},
}
local args = require("Module:parameters").process(frame:getParent().args, params)
local data = {lang = lang, pos_category = "nouns", categories = {}, heads = {args}, genders = {}, inflections = {}}
if not args then
data.heads = mw.title.getCurrentTitle().subpageText:gsub("^-", "") .. "<sup title=\"tones missing\">?</sup>"
table.insert(data.categories, "Requests for tone in " .. lang:getCanonicalName() .. " noun entries")
end
-- Singular
if not singular_classes] and not plural_classes] then
args = nil
end
table.insert(data.genders, "c" .. (args or "?"))
-- Plural
if args ~= "-" and (#args > 0 or type(singular_classes] ~= true) == "string") then
if not plural_classes] then
args = nil
end
local plural = {label = "plural", request = true}
for _, form in ipairs(args) do
table.insert(plural, {term = form, genders = {"c" .. (args or "?")}})
end
table.insert(data.inflections, plural)
end
data.sort_key = remove_prefix(mw.title.getCurrentTitle().subpageText, args)
return require("Module:headword").full_headword(data)
end
function export.adjective(frame)
local params = {
= {},
}
local args = require("Module:parameters").process(frame:getParent().args, params)
local data = {lang = lang, pos_category = "adjectives", categories = {}, heads = {args}, inflections = {}}
if not args then
data.heads = mw.title.getCurrentTitle().subpageText:gsub("^-", "") .. "<sup title=\"tones missing\">?</sup>"
table.insert(data.categories, "Requests for tone in " .. lang:getCanonicalName() .. " adjective entries")
end
data.heads = "-" .. data.heads
return require("Module:headword").full_headword(data)
end
function export.relative(frame)
local params = {
= {},
}
local args = require("Module:parameters").process(frame:getParent().args, params)
local data = {lang = lang, pos_category = "relatives", categories = {}, heads = {args}, inflections = {}}
if not args then
data.heads = mw.title.getCurrentTitle().subpageText:gsub("^-", "") .. "<sup title=\"tones missing\">?</sup>"
table.insert(data.categories, "Requests for tone in " .. lang:getCanonicalName() .. " relative entries")
end
data.heads = "-" .. data.heads
return require("Module:headword").full_headword(data)
end
function export.ideophone(frame)
local params = {
= {},
}
local args = require("Module:parameters").process(frame:getParent().args, params)
local data = {lang = lang, pos_category = "ideophones", categories = {}, heads = {args}, inflections = {}}
if not args then
data.heads = mw.title.getCurrentTitle().subpageText:gsub("^-", "") .. "<sup title=\"tones missing\">?</sup>"
table.insert(data.categories, "Requests for tone in " .. lang:getCanonicalName() .. " ideophone entries")
end
return require("Module:headword").full_headword(data)
end
function export.verb(frame)
local params = {
= {},
}
local args = require("Module:parameters").process(frame:getParent().args, params)
local data = {lang = lang, pos_category = "verbs", categories = {}, heads = {args}, inflections = {}}
if not args then
data.heads = mw.title.getCurrentTitle().subpageText:gsub("^-", "") .. "<sup title=\"tones missing\">?</sup>"
table.insert(data.categories, "Requests for tone in " .. lang:getCanonicalName() .. " verb entries")
end
data.heads = "-" .. data.heads
return require("Module:headword").full_headword(data)
end
return export