Modul:af-headword
Qiyofa
Bu modul uchun Modul:af-headword/doc nomli hujjat sahifasini yaratishingiz mumkin
local export = {}
local pos_functions = {}
local tili = require("Module:tili").getByCode("af")
-- 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 poscat = frame.args[1] or error("Part of speech has not been specified. Please pass parameter 1 to the module invocation.")
local params = {
["bosh"] = {list = true, default = ""},
["suff"] = {type = "boolean"},
}
if pos_functions[poscat] then
for key, val in pairs(pos_functions[poscat].params) do
params[key] = val
end
end
local args = require("Module:parameters").process(frame:getParent().args, params)
local data = {boshlar = args["bosh"], inflections = {}, categories = {}}
if args["suff"] then
table.insert(data.categories, tili:getCanonicalName() .. " suffixes")
if poscat == "sifat" then
table.insert(data.categories, tili:getCanonicalName() .. " adjective-forming suffixes")
elseif poscat == "holi" then
table.insert(data.categories, tili:getCanonicalName() .. " adverb-forming suffixes")
elseif poscat == "ot" then
table.insert(data.categories, tili:getCanonicalName() .. " noun-forming suffixes")
elseif poscat == "feʼl" then
table.insert(data.categories, tili:getCanonicalName() .. " verb-forming suffixes")
else
error("No category exists for suffixes forming " .. poscat .. ".")
end
else
table.insert(data.categories, tili:getCanonicalName() .. " " .. poscat)
end
if pos_functions[poscat] then
pos_functions[poscat].func(args, data)
end
return require("Module:headword").full_headword(tili, nil, data.boshlar, nil, nil, data.inflections, data.categories, nil)
end
-- Display additional inflection information for an adjective
pos_functions["sifat"] = {
params = {
[1] = {},
["attr2"] = {},
[2] = {},
["comp2"] = {},
[3] = {},
["sup2"] = {},
},
func = function(args, data)
local attr = args[1]
local comp = args[2]
local sup = args[3]
local attr2 = args["attr2"]
local comp2 = args["comp2"]
local sup2 = args["sup2"]
-- Generate the missing forms
if not attr then
if PAGENAME:find("[^aeiou]u$") then
attr = PAGENAME .. "we"
elseif mw.ustring.find(PAGENAME, "[eë]$") then
attr = PAGENAME
else
attr = PAGENAME .. "e"
end
end
if not comp then
if PAGENAME:find("r$") then
comp = PAGENAME .. "der"
elseif attr ~= "-" then
if not attr:find("[eë]$") then
comp = attr .. "er"
else
comp = attr .. "r"
end
else
comp = PAGENAME .. "er"
end
end
if not sup then
if attr == PAGENAME:gsub("nk$", "ng") then
sup = attr .. "ste"
elseif PAGENAME:find("[^aeiou]u$") then
sup = PAGENAME .. "uste"
else
sup = PAGENAME .. "ste"
end
end
-- Attributive form
if attr == "-" then
table.insert(data.inflections, {label = "used only [[predicative]]ly"})
table.insert(data.categories, "Afrikaans predicative-only adjectives")
else
local infl_parts = {label = "[[attributive]]", attr}
if attr2 then
table.insert(infl_parts, attr2)
end
table.insert(data.inflections, infl_parts)
end
-- Comparative and superlative forms
if comp == "-" then
table.insert(data.inflections, {label = "not [[Appendix:Glossariy#comparable|comparable]]"})
else
-- Comparative
local infl_parts = {label = "[[Appendix:Glossariy#comparative|comparative]]", comp}
if comp2 then
table.insert(infl_parts, comp2)
end
table.insert(data.inflections, infl_parts)
-- Superlative
infl_parts = {label = "[[Appendix:Glossariy#superlative|superlative]]", sup}
if sup2 then
table.insert(infl_parts, sup2)
end
table.insert(data.inflections, infl_parts)
end
end
}
-- List of irregular verbs. See further down.
local irregular_verbs = {}
-- Display additional inflection information for a adverb
pos_functions["feʼl"] = {
params = {
[1] = {},
["pres2"] = {},
[2] = {},
["past2"] = {},
["sep"] = {},
},
func = function(args, data)
local pres_part = args[1]
local pres_part2 = args["pres2"]
local past_part = args[2]
local past_part2 = args["past2"]
local sep = args["sep"]
local stem = PAGENAME
-- If separable, remove the prefix to create the stem
if sep then
stem = PAGENAME:gsub("^" .. sep, "")
table.insert(data.categories, "Afrikaans separable verbs")
end
local forms = {}
-- Is this the stem of an irregular verb?
-- If so, delegate all the work to its function.
if irregular_verbs[stem] then
irregular_verbs[stem](forms)
table.insert(data.categories, "Afrikaans irregular verbs")
else
forms["present"] = stem
forms["pres_part"] = pres_part or stem .. "ende"
forms["pres_part2"] = pres_part2
forms["past_part"] = past_part or "ge" .. stem
forms["past_part2"] = past_part2
end
-- Add the forms to the list
if forms["present"] then
forms["present"] = "[[".. forms["present"] .. (sep and "]] [[" .. sep or "") .. "]]"
table.insert(data.inflections, {label = "present", forms["present"]})
end
if forms["pres_part"] then
forms["pres_part"] = "[[" .. (sep or "") .. forms["pres_part"] .. "]]"
local infl_parts = {label = "present participle", accel = "present-participle-form-of", forms["pres_part"]}
if forms["pres_part2"] then
forms["pres_part2"] = "[[" .. (sep or "") .. forms["pres_part2"] .. "]]"
table.insert(infl_parts, forms["pres_part2"])
end
table.insert(data.inflections, infl_parts)
end
if forms["past"] then
forms["past"] = "[[".. forms["past"] .. (sep and "]] [[" .. sep or "") .. "]]"
local infl_parts = {label = "past", forms["past"]}
if forms["past2"] then
forms["past2"] = "[[" .. (sep or "") .. forms["past2"] .. "]]"
table.insert(infl_parts, forms["past2"])
end
table.insert(data.inflections, infl_parts)
end
if forms["past_part"] then
forms["past_part"] = "[[" .. (sep or "") .. forms["past_part"] .. "]]"
local infl_parts = {label = "past participle", accel = "past-participle-form-of", forms["past_part"]}
if forms["past_part2"] then
forms["past_part2"] = "[[" .. (sep or "") .. forms["past_part2"] .. "]]"
table.insert(infl_parts, forms["past_part2"])
end
if forms["past_part3"] then
forms["past_part3"] = "[[" .. (sep or "") .. forms["past_part3"] .. "]]"
table.insert(infl_parts, forms["past_part3"])
end
table.insert(data.inflections, infl_parts)
end
end
}
irregular_verbs["dink"] = function(forms)
forms["present"] = "dink"
forms["pres_part"] = "denkende"
forms["past"] = "dag"
forms["past2"] = "dog"
forms["past_part"] = "gedag"
forms["past_part2"] = "gedog"
forms["past_part3"] = "gedink"
end
irregular_verbs["hê"] = function(forms)
forms["present"] = "het"
forms["pres_part"] = "hebbende"
forms["past"] = "had"
forms["past_part"] = "gehad"
end
irregular_verbs["kan"] = function(forms)
forms["present"] = "kan"
forms["pres_part"] = nil
forms["past"] = "kon"
forms["past_part"] = nil
end
irregular_verbs["mag"] = function(forms)
forms["present"] = "mag"
forms["pres_part"] = nil
forms["past"] = "mog"
forms["past_part"] = nil
end
irregular_verbs["moet"] = function(forms)
forms["present"] = "moet"
forms["pres_part"] = nil
forms["past"] = "moes"
forms["past_part"] = nil
end
irregular_verbs["sal"] = function(forms)
forms["present"] = "sal"
forms["pres_part"] = nil
forms["past"] = "sou"
forms["past_part"] = nil
end
irregular_verbs["wees"] = function(forms)
forms["present"] = "is"
forms["pres_part"] = "synde"
forms["past"] = "was"
forms["past_part"] = "gewees"
end
irregular_verbs["weet"] = function(forms)
forms["present"] = "weet"
forms["pres_part"] = "wetende"
forms["past"] = "wis"
forms["past_part"] = "geweet"
end
irregular_verbs["wil"] = function(forms)
forms["present"] = "wil"
forms["pres_part"] = nil
forms["past"] = "wou"
forms["past_part"] = "gewil"
end
irregular_verbs["beter"] = function(forms)
forms["present"] = "beter"
forms["pres_part"] = nil
forms["past"] = nil
forms["past_part"] = nil
end
return export