A modult a Modul:ki-headword/doc lapon tudod dokumentálni
local export = {}
local lang = require("Module:languages").getByCode("ki")
local plural_classes = {
= "c2", = "c2a", = "c4", = "c8", = "c10", = "c10",
= "c13", = "c6", = "c6", = "c6"}
local plural_rules = {
= { = {"mw", "a", 3}, = {"mũ", "a", 3}, = { "muu", "oi", 4}, = {"muo", "o", 4}},
= { = { "", "", 1}},
= { = {"mũ", "mĩ", 3}, = {"mw", "mĩ", 3}, = { "muu", "miu", 4}, = {"muo", "mĩo", 4}},
= { = {"i", "ma", 2}, = {"", "ma", 1}},
= { = {"kĩa", "cia", 4}, = {"kĩe", "cie", 4}, = {"kĩi", "cii", 4}, = {"kĩi", "cii", 4}, = {"kĩo", "cio", 4}, = {"kiu", "ciu", 4}, = {"gĩa", "cia", 4}, = {"gĩe", "cie", 4}, = {"gĩi", "cii", 4}, = {"gĩi", "cii", 4}, = {"gĩo", "cio", 4}, = {"giu", "ciu", 4}, = {"kĩ", "i", 3}, = {"gĩ", "i", 3}},
= { = { "", "", 1}},
= { = {"rũh", "'h", 4},
= {"rũc", "nj", 4},
= {"rũth", "th", 5},
= {"rũk", "ng", 4},
= {"rũm", "m", 4},
= {"rũn", "n", 4},
= {"rũt", "nd", 4},
= {"rũb", "mb", 4},
= {"rũr*", "n", 4},
= {"rũr", "nd", 4},
= {"r*", "ny", 3},
= {"r", "nj", 3},
= {"rũ", "n", 3 }},
= { = {"ka", "tũ", 3}, = {"koi", "tuu", 4}, = {"ga", "tũ", 3}, = {"goi", "tuu", 4}},
= { = { "ũ", "mo", 2}, = {"we", "me", 3}, = {"wĩ", "me", 3}, = {"uo", "mo", 3}, = {"uu", "moi", 3}, = {"w", "m", 2}},
= { = {"kũ", "ma", 3}, = { "gũ", "ma", 3}, = {"ku", "m", 3}, = {"gu", "m", 3}},
= { = {"ha", "kũ", 3}},
}
function export.noun(frame)
local params = {
= {required=true},
= {},
= {},
= {alias_of = "head"}
}
local args = require("Module:parameters").process(frame:getParent().args, params)
local data = {lang = lang, pos_category = "nouns", categories = {}, heads = {args}, genders = mw.text.split(args, "%/"), inflections = {}}
table.insert(data.categories, lang:getCanonicalName() .. " class " .. data.genders .. " nouns")
local singular = args and require("Module:links").remove_links(args) or mw.title.getCurrentTitle().text
local inflection = nil
if not args then
inflection = export.generate_plural(singular, args)
else
if (args ~= "-") then
inflection = args
end
end
local accel = {form = "p"}
if (plural_classes]) then
accel.gender = plural_classes]
end
if (inflection) then
table.insert(data.inflections, {label = "plural", accel = accel, inflection})
end
return require("Module:headword").full_headword(data)
end
function startswith(test_string, start)
return mw.ustring.match(test_string, "^"..start)
end
function match_case(string1, string2)
c1 = mw.ustring.sub(string1, 1, 1)
c2 = mw.ustring.sub(string2, 1, 1)
if (mw.ustring.lower(c1) == c1) then
return mw.ustring.lower(c2) .. mw.ustring.sub(string2, 2)
end
return mw.ustring.upper(c2).. mw.ustring.sub(string2, 2)
end
function export.generate_plural(singular, class)
if (plural_rules) then
for k,v in ipairs(plural_rules) do
if startswith(singular, v) then
return match_case(singular, v..mw.ustring.sub(singular, v))
end
end
end
end
return export