Wikisłownik
hsbwiktionary
https://hsb.wiktionary.org/wiki/Wikis%C5%82ownik:H%C5%82owna_strona
MediaWiki 1.47.0-wmf.4
case-sensitive
Media
Specialnje
Diskusija
Wužiwar
Diskusija z wužiwarjom
Wikisłownik
Diskusija k Wikisłownikej
Dataja
Diskusija k dataji
MediaWiki
MediaWiki diskusija
Předłoha
Diskusija k předłoze
Pomoc
Pomoc diskusija
Kategorija
Diskusija ke kategoriji
Přidawk
Diskusija k přidawkej
Rymy
Diskusija k rymam
Tezawrus
Diskusija k tezawrusej
Citaty
Diskusija k citatam
Rekonstrukcija
Diskusija k rekonstrukciji
TimedText
TimedText talk
Modul
Modul diskusija
Veranstaltung
Veranstaltung Diskussion
Modul:hsb-dsb-headword
828
6147
20396
17615
2026-06-01T14:21:53Z
Sławobóg
2519
20396
Scribunto
text/plain
local export = {}
local pos_functions = {}
local force_cat = false -- for testing; if true, categories appear in non-mainspace pages
local rfind = mw.ustring.find
local require_when_needed = require("Module:utilities/require when needed")
local m_table = require("Module:table")
local en_utilities_module = "Module:en-utilities"
local headword_utilities_module = "Module:headword utilities"
local m_headword_utilities = require_when_needed(headword_utilities_module)
local m_string_utilities = require_when_needed("Module:string utilities")
local glossary_link = require_when_needed(headword_utilities_module, "glossary_link")
local list_param = {list = true, disallow_holes = true}
local boolean_param = {type = "boolean"}
local unpack = unpack or table.unpack -- Lua 5.2 compatibility
local insert = table.insert
local concat = table.concat
local langs_supported = {
["hsb"] = {
peri_comp = "bóle",
sup = "naj",
abs_sup_prefix = "na",
excessive = "pře",
},
["dsb"] = {
peri_comp = "wěcej",
sup = "nej",
},
}
-- Table of all valid aspects.
local valid_aspects = m_table.listToSet {
"impf", "pf", "biasp", "?",
}
local valid_verb_types = {
semelfactive = true,
durative = true,
frequentative = true,
continuative = true,
unidirectional = true,
multidirectional = true,
concrete = "unidirectional",
abstract = "multidirectional",
}
local function track(page)
require("Module:debug").track("hsb-dsb-headword/" .. page)
return true
end
local function replace_hash_with_lemma(term, lemma)
-- If there is a % sign in the lemma, we have to replace it with %% so it doesn't get interpreted as a capture
-- replace expression.
lemma = m_string_utilities.replacement_escape(lemma)
return (term:gsub("#", lemma)) -- discard second retval
end
local function frob_term_with_hash(term, lemma)
if term:find("#") then
term = replace_hash_with_lemma(term, lemma)
end
return term
end
-- Parse and insert an inflection not requiring additional processing into `data.inflections`. The raw arguments come
-- from `args[field]`, which is parsed for inline modifiers. `label` is the label that the inflections are given;
-- sections enclosed in <<...>> are linked to the glossary. `accel` is the accelerator form, or nil.
local function parse_and_insert_inflection(data, args, field, label, accel, frob)
m_headword_utilities.parse_and_insert_inflection {
headdata = data,
forms = args[field],
paramname = field,
splitchar = ",",
label = label,
include_mods = {"t"},
accel = accel and {form = accel} or nil,
frob = function(term)
term = frob_term_with_hash(term, data.pagename)
if frob then
term = frob(term)
end
return term
end,
}
end
-- Parse and return an inflection not requiring additional processing. The raw arguments come from `args[field]`, which
-- is parsed for inline modifiers.
local function parse_inflection(data, paramname, forms)
return m_headword_utilities.parse_term_list_with_modifiers {
paramname = paramname,
forms = forms,
splitchar = ",",
include_mods = {"t"},
frob = function(term)
return frob_term_with_hash(term, data.pagename)
end,
}
end
-- Insert the parsed inflections in `infls` (as parsed by `parse_inflection`) into `data.inflections`, with label
-- `label` and optional accelerator spec `accel`.
local function insert_inflection(data, terms, label, accel)
m_headword_utilities.insert_inflection {
headdata = data,
terms = terms,
label = label,
accel = accel and {form = accel} or nil,
}
end
-- The main entry point.
-- This is the only function that can be invoked from a template.
function export.show(frame)
local iparams = {
[1] = {required = true},
["lang"] = {required = true},
}
local iargs = require("Module:parameters").process(frame.args, iparams)
local poscat = iargs[1]
langcode = iargs.lang
if langcode ~= "hsb" and langcode ~= "dsb" then
error("This module currently only works for lang=hsb and lang=dsb")
end
local lang = require("Module:languages").getByCode(langcode)
local langname = lang:getCanonicalName()
local params = {
["head"] = {list = true},
["nolink"] = {type = "boolean"},
["nolinkhead"] = {type = "boolean", alias_of = "nolink"},
["id"] = {},
["sort"] = {},
["suffix"] = {type = "boolean"},
["nosuffix"] = {type = "boolean"},
["json"] = {type = "boolean"},
["pagename"] = {}, -- for testing
}
if pos_functions[poscat] then
for key, val in pairs(pos_functions[poscat].params) do
params[key] = val
end
end
local parargs = frame:getParent().args
local args = require("Module:parameters").process(parargs, params)
local pagename = args.pagename or mw.loadData("Module:headword/data").pagename
local user_specified_heads = args.head
local heads = user_specified_heads
if args.nolink then
if #heads == 0 then
heads = {pagename}
end
end
local data = {
lang = lang,
langname = langname,
langcode = langcode,
pos_category = poscat,
categories = {},
heads = heads,
user_specified_heads = user_specified_heads,
no_redundant_head_cat = #user_specified_heads == 0,
genders = {},
inflections = {},
categories = {},
pagename = pagename,
id = args.id,
sort_key = args.sort,
force_cat_output = force_cat,
}
data.is_suffix = false
if args.suffix or (
not args.nosuffix and pagename:find("^%-") and poscat ~= "suffixes" and poscat ~= "suffix forms"
) then
data.is_suffix = true
data.pos_category = "suffixes"
local singular_poscat = require(en_utilities_module).singularize(poscat)
insert(data.categories, langname .. " " .. singular_poscat .. "-forming suffixes")
insert(data.inflections, {label = singular_poscat .. "-forming suffix"})
end
if pos_functions[poscat] then
pos_functions[poscat].func(args, data)
end
if args.json then
return require("Module:JSON").toJSON(data)
end
return require("Module:headword").full_headword(data)
end
local function get_noun_pos(is_proper)
local noun_inflection_specs = {
{"gen", "genitive singular"},
{"du", "nominative dual"},
{"pl", "nominative plural"},
{"genpl", "genitive plural"},
{"m", "male equivalent"},
{"f", "female equivalent"},
{"adj", "<<relational adjective>>"},
{"poss", "<<possessive adjective>>"},
{"dim", "<<diminutive>>"},
{"aug", "<<augmentative>>"},
{"pej", "<<pejorative>>"},
{"dem", "<<demonym>>"},
{"fdem", "female <<demonym>>"},
}
local params = {
[1] = {type = "genders", required = true, template_default = "?"},
["g"] = {list = true, disallow_holes = true, replaced_by = false,
instead = "use multiple comma-separated genders in |1="},
["indecl"] = {type = "boolean"},
}
for _, spec in ipairs(noun_inflection_specs) do
local param, desc = unpack(spec)
params[param] = list_param
end
return {
params = params,
func = function(args, data)
-- Compute allowed genders, and map incomplete genders to specs with a "?" in them.
local masc_genders = {"m", "mf", "mfbysense"}
local non_masc_genders = {false, "f", "n"}
local hsb_masc_animacies = {false, "in", "anml", "pr"}
local dsb_masc_animacies = {false, "in", "an"}
local numbers = {false, "d", "p"}
local allowed_genders = {}
local function insert_genders(genders, animacies, numbers, is_masc)
for _, g in ipairs(genders) do
for _, an in ipairs(animacies) do
for _, num in ipairs(numbers) do
local source_gender_parts = {}
local dest_gender_parts = {}
local function ins_part(part, partname)
if part then
insert(source_gender_parts, part)
insert(dest_gender_parts, part)
elseif partname == "g" and num == false or partname == "an" and is_masc then
-- allow incomplete gender duale tantum and plurale tantum nouns; also allow
-- incomplete animacy for fem/neut; otherwise insert a ? to indicate incomplete
-- gender spec
insert(dest_gender_parts, "?")
end
end
ins_part(g, "g")
ins_part(an, "an")
ins_part(num, "num")
if #source_gender_parts == 0 then
allowed_genders["?"] = "?"
else
allowed_genders[concat(source_gender_parts, "-")] =
concat(dest_gender_parts, "-")
end
end
end
end
end
if data.lang:getCode() == "hsb" then
insert_genders(masc_genders, hsb_masc_animacies, numbers, true)
else
insert_genders(masc_genders, dsb_masc_animacies, numbers, true)
end
insert_genders(non_masc_genders, {false}, numbers, false)
-- allow inanimate dual/plural; no gender distinction here
allowed_genders["in-d"] = "in-d"
allowed_genders["in-p"] = "in-p"
-- Validate and canonicalize genders.
for _, gspec in ipairs(args[1]) do
local g = gspec.spec
local canon_g = allowed_genders[g]
if canon_g then
g = canon_g
else
error("Unrecognized " .. data.langname .. " gender: " .. g)
end
gspec.spec = g
end
data.genders = args[1]
local function process_inflection(label, infls, qs, frob)
infls.label = label
for i, infl in ipairs(infls) do
if frob then
infl = frob(infl)
end
if qs[i] then
infls[i] = {term = infl, q = {qs[i]}}
end
end
if #infls > 0 then
insert(data.inflections, infls)
end
end
if args.indecl then
insert(data.inflections, {label = glossary_link("indeclinable")})
insert(data.categories, data.langname .. " indeclinable nouns")
end
-- Parse and insert an inflection not requiring additional processing into `data.inflections`. The raw
-- arguments come from `args[field]`, which is parsed for inline modifiers. `label` is the label that the
-- inflections are given, which is linked to the glossary if preceded by * (which is removed).
local function handle_infl(field, label)
parse_and_insert_inflection(data, args, field, label)
end
-- Process all inflections.
for _, spec in ipairs(noun_inflection_specs) do
local param, desc = unpack(spec)
handle_infl(param, desc)
end
end
}
end
pos_functions["nouns"] = get_noun_pos(false)
pos_functions["proper nouns"] = get_noun_pos(true)
pos_functions["verbs"] = {
params = {
[1] = {type = "genders", default = "?"},
["type"] = {set = valid_verb_types},
["pf"] = list_param,
["impf"] = list_param,
},
func = function(args, data)
-- Validate genders.
for _, gspec in ipairs(args[1]) do
local g = gspec.spec
if not valid_aspects[g] then
error("Unrecognized " .. data.langname .. " aspect: " .. g)
end
end
data.genders = args[1]
if args.type then
m_headword_utilities.insert_fixed_inflection {
headdata = data,
label = ("<<%s>>"):format(args.type),
}
insert(data.categories, ("%s %s verbs"):format(data.langname, args.type))
end
parse_and_insert_inflection(data, args, "pf", "perfective")
parse_and_insert_inflection(data, args, "impf", "imperfective")
end,
}
local function get_adj_adv_pos(pos)
local params = {
[1] = list_param,
["dim"] = list_param,
["sup"] = list_param,
["nodefsup"] = boolean_param,
}
if pos == "adjective" then
params["adv"] = list_param
params["indecl"] = boolean_param
end
return {
params = params,
func = function(args, data)
if pos == "adjective" and args.indecl then
insert(data.inflections, {label = glossary_link("indeclinable")})
insert(data.categories, data.langname .. " indeclinable adjectives")
end
local default_sups = {}
local default_abs_sups = {}
local comps = parse_inflection(data, 1, args[1])
local is_comparable = false
local lang_data = langs_supported[data.langcode]
if comps[1] then
if comps[1].term == "-" then
if not comps[2] then
m_headword_utilities.insert_fixed_inflection {
headdata = data,
label = "not <<comparable>>",
originating_term = comps[1],
}
insert(data.categories, data.langname .. " uncomparable " .. data.pos_category)
else
m_headword_utilities.insert_fixed_inflection {
headdata = data,
label = "not generally <<comparable>>",
originating_term = comps[1],
}
end
table.remove(comps, 1)
end
for i, comp in ipairs(comps) do
if not is_comparable then
is_comparable = true
insert(data.categories, data.langname .. " comparable " .. data.pos_category)
end
if comp.term == "peri" then
if not lang_data.peri_comp then
error("Don't know how to form periphrastic comparatives for " .. data.langname)
end
comp.term = ("[[%s]] [[%s]]"):format(lang_data.peri_comp, data.pagename)
if lang_data.sup then
local default_sup = m_table.shallowCopy(comp)
default_sup.term = ("[[%s%s]] [[%s]]"):format(lang_data.sup, lang_data.peri_comp,
data.pagename)
insert(default_sups, default_sup)
if lang_data.abs_sup_prefix then
local default_abs_sup = m_table.shallowCopy(comp)
default_abs_sup.term = ("[[%s%s%s]] [[%s]]"):format(lang_data.abs_sup_prefix,
lang_data.sup, lang_data.peri_comp, data.pagename)
insert(default_abs_sups, default_abs_sup)
end
end
else
if lang_data.sup then
local default_sup = m_table.shallowCopy(comp)
default_sup.term = ("%s%s"):format(lang_data.sup, comp.term)
insert(default_sups, default_sup)
if lang_data.abs_sup_prefix then
local default_abs_sup = m_table.shallowCopy(comp)
default_abs_sup.term = ("%s%s%s"):format(lang_data.abs_sup_prefix, lang_data.sup,
comp.term)
insert(default_abs_sups, default_abs_sup)
end
end
end
end
end
insert_inflection(data, comps, "comparative", "comparative")
local sups = parse_inflection(data, "sup", args.sup)
if not sups[1] then
sups = args.nodefsup and {} or {{term = "+"}}
end
local combined_sups = {}
for _, sup in ipairs(sups) do
if sup.term == "+" then
for _, def_sup in ipairs(default_sups) do
def_sup = m_table.shallowCopy(def_sup)
m_headword_utilities.combine_termobj_qualifiers_labels(def_sup, sup)
insert(combined_sups, def_sup)
end
else
insert(combined_sups, sup)
end
end
-- Compute the absolute superlative before inserting any inflections because the process of inserting
-- inflections may modify the superlatives that we base the absolute superlatives off of.
local combined_abs_sups = {}
if lang_data.abs_sup_prefix then
for _, sup in ipairs(sups) do
if sup.term == "+" then
for _, def_abs_sup in ipairs(default_abs_sups) do
def_abs_sup = m_table.shallowCopy(def_abs_sup)
m_headword_utilities.combine_termobj_qualifiers_labels(def_abs_sup, sup)
insert(combined_abs_sups, def_abs_sup)
end
else
sup = m_table.shallowCopy(sup)
if sup.term:find("%[%[") then
sup.term = "[[" .. lang_data.abs_sup_prefix .. sup.term:sub(3)
else
sup.term = lang_data.abs_sup_prefix .. sup.term
end
insert(combined_abs_sups, sup)
end
end
end
insert_inflection(data, combined_sups, "superlative", "superlative")
insert_inflection(data, combined_abs_sups, "<<absolute superlative>>", "absolute superlative")
if is_comparable and lang_data.excessive then
insert_inflection(data, {{term = lang_data.excessive .. data.pagename}}, "<<excessive>>", "excessive")
end
if pos == "adjective" then
parse_and_insert_inflection(data, args, "adv", "derived adverb")
end
parse_and_insert_inflection(data, args, "dim", "diminutive")
end,
}
end
pos_functions["adjectives"] = get_adj_adv_pos("adjective")
pos_functions["adverbs"] = get_adj_adv_pos("adverb")
return export
lhwgu8jqaffnq1jp1jbfku83i0m8zzn
20397
20396
2026-06-01T14:32:15Z
Sławobóg
2519
20397
Scribunto
text/plain
local export = {}
local pos_functions = {}
local force_cat = false -- for testing; if true, categories appear in non-mainspace pages
local rfind = mw.ustring.find
local require_when_needed = require("Module:utilities/require when needed")
local m_table = require("Module:table")
local en_utilities_module = "Module:en-utilities"
local headword_utilities_module = "Module:headword utilities"
local m_headword_utilities = require_when_needed(headword_utilities_module)
local m_string_utilities = require_when_needed("Module:string utilities")
local glossary_link = require_when_needed(headword_utilities_module, "glossary_link")
local list_param = {list = true, disallow_holes = true}
local boolean_param = {type = "boolean"}
local unpack = unpack or table.unpack -- Lua 5.2 compatibility
local insert = table.insert
local concat = table.concat
local langs_supported = {
["hsb"] = {
peri_comp = "bóle",
sup = "naj",
abs_sup_prefix = "na",
excessive = "pře",
},
["dsb"] = {
peri_comp = "wěcej",
sup = "nej",
},
}
-- Table of all valid aspects.
local valid_aspects = m_table.listToSet {
"impf", "pf", "biasp", "?",
}
local valid_verb_types = {
semelfactive = true,
durative = true,
frequentative = true,
continuative = true,
unidirectional = true,
multidirectional = true,
concrete = "unidirectional",
abstract = "multidirectional",
}
local function track(page)
require("Module:debug").track("hsb-dsb-headword/" .. page)
return true
end
local function replace_hash_with_lemma(term, lemma)
-- If there is a % sign in the lemma, we have to replace it with %% so it doesn't get interpreted as a capture
-- replace expression.
lemma = m_string_utilities.replacement_escape(lemma)
return (term:gsub("#", lemma)) -- discard second retval
end
local function frob_term_with_hash(term, lemma)
if term:find("#") then
term = replace_hash_with_lemma(term, lemma)
end
return term
end
-- Parse and insert an inflection not requiring additional processing into `data.inflections`. The raw arguments come
-- from `args[field]`, which is parsed for inline modifiers. `label` is the label that the inflections are given;
-- sections enclosed in <<...>> are linked to the glossary. `accel` is the accelerator form, or nil.
local function parse_and_insert_inflection(data, args, field, label, accel, frob)
m_headword_utilities.parse_and_insert_inflection {
headdata = data,
forms = args[field],
paramname = field,
splitchar = ",",
label = label,
include_mods = {"t"},
accel = accel and {form = accel} or nil,
frob = function(term)
term = frob_term_with_hash(term, data.pagename)
if frob then
term = frob(term)
end
return term
end,
}
end
-- Parse and return an inflection not requiring additional processing. The raw arguments come from `args[field]`, which
-- is parsed for inline modifiers.
local function parse_inflection(data, paramname, forms)
return m_headword_utilities.parse_term_list_with_modifiers {
paramname = paramname,
forms = forms,
splitchar = ",",
include_mods = {"t"},
frob = function(term)
return frob_term_with_hash(term, data.pagename)
end,
}
end
-- Insert the parsed inflections in `infls` (as parsed by `parse_inflection`) into `data.inflections`, with label
-- `label` and optional accelerator spec `accel`.
local function insert_inflection(data, terms, label, accel)
m_headword_utilities.insert_inflection {
headdata = data,
terms = terms,
label = label,
accel = accel and {form = accel} or nil,
}
end
-- The main entry point.
-- This is the only function that can be invoked from a template.
function export.show(frame)
local iparams = {
[1] = {required = true},
["lang"] = {required = true},
}
local iargs = require("Module:parameters").process(frame.args, iparams)
local poscat = iargs[1]
langcode = iargs.lang
if langcode ~= "hsb" and langcode ~= "dsb" then
error("This module currently only works for lang=hsb and lang=dsb")
end
local lang = require("Module:languages").getByCode(langcode)
local langname = lang:getCanonicalName()
local params = {
["head"] = {list = true},
["nolink"] = {type = "boolean"},
["nolinkhead"] = {type = "boolean", alias_of = "nolink"},
["id"] = {},
["sort"] = {},
["suffix"] = {type = "boolean"},
["nosuffix"] = {type = "boolean"},
["json"] = {type = "boolean"},
["pagename"] = {}, -- for testing
}
if pos_functions[poscat] then
for key, val in pairs(pos_functions[poscat].params) do
params[key] = val
end
end
local parargs = frame:getParent().args
local args = require("Module:parameters").process(parargs, params)
local pagename = args.pagename or mw.loadData("Module:headword/data").pagename
local user_specified_heads = args.head
local heads = user_specified_heads
if args.nolink then
if #heads == 0 then
heads = {pagename}
end
end
local data = {
lang = lang,
langname = langname,
langcode = langcode,
pos_category = poscat,
categories = {},
heads = heads,
user_specified_heads = user_specified_heads,
no_redundant_head_cat = #user_specified_heads == 0,
genders = {},
inflections = {},
categories = {},
pagename = pagename,
id = args.id,
sort_key = args.sort,
force_cat_output = force_cat,
}
data.is_suffix = false
if args.suffix or (
not args.nosuffix and pagename:find("^%-") and poscat ~= "suffixes" and poscat ~= "suffix forms"
) then
data.is_suffix = true
data.pos_category = "suffixes"
local singular_poscat = require(en_utilities_module).singularize(poscat)
insert(data.categories, langname .. " " .. singular_poscat .. "-forming suffixes")
insert(data.inflections, {label = singular_poscat .. "-forming suffix"})
end
if pos_functions[poscat] then
pos_functions[poscat].func(args, data)
end
if args.json then
return require("Module:JSON").toJSON(data)
end
return require("Module:headword").full_headword(data)
end
local function get_noun_pos(is_proper)
local noun_inflection_specs = {
{"gen", "genitive singular"},
{"du", "nominative dual"},
{"pl", "nominative plural"},
{"genpl", "genitive plural"},
{"m", "male equivalent"},
{"f", "female equivalent"},
{"adj", "<<relational adjective>>"},
{"poss", "<<possessive adjective>>"},
{"dim", "<<diminutive>>"},
{"aug", "<<augmentative>>"},
{"pej", "<<pejorative>>"},
{"dem", "<<demonym>>"},
{"fdem", "female <<demonym>>"},
}
local params = {
[1] = {type = "genders", required = true, template_default = "?"},
["g"] = {list = true, disallow_holes = true, replaced_by = false,
instead = "use multiple comma-separated genders in |1="},
["indecl"] = {type = "boolean"},
}
for _, spec in ipairs(noun_inflection_specs) do
local param, desc = unpack(spec)
params[param] = list_param
end
return {
params = params,
func = function(args, data)
-- Compute allowed genders, and map incomplete genders to specs with a "?" in them.
local masc_genders = {"m", "mf", "mfbysense"}
local non_masc_genders = {false, "f", "n"}
local hsb_masc_animacies = {false, "in", "anml", "pr"}
local dsb_masc_animacies = {false, "in", "an"}
local numbers = {false, "d", "p"}
local allowed_genders = {}
local function insert_genders(genders, animacies, numbers, is_masc)
for _, g in ipairs(genders) do
for _, an in ipairs(animacies) do
for _, num in ipairs(numbers) do
local source_gender_parts = {}
local dest_gender_parts = {}
local function ins_part(part, partname)
if part then
insert(source_gender_parts, part)
insert(dest_gender_parts, part)
elseif partname == "g" and num == false or partname == "an" and is_masc then
-- allow incomplete gender duale tantum and plurale tantum nouns; also allow
-- incomplete animacy for fem/neut; otherwise insert a ? to indicate incomplete
-- gender spec
insert(dest_gender_parts, "?")
end
end
ins_part(g, "g")
ins_part(an, "an")
ins_part(num, "num")
if #source_gender_parts == 0 then
allowed_genders["?"] = "?"
else
allowed_genders[concat(source_gender_parts, "-")] =
concat(dest_gender_parts, "-")
end
end
end
end
end
if data.lang:getCode() == "hsb" then
insert_genders(masc_genders, hsb_masc_animacies, numbers, true)
else
insert_genders(masc_genders, dsb_masc_animacies, numbers, true)
end
insert_genders(non_masc_genders, {false}, numbers, false)
-- allow inanimate dual/plural; no gender distinction here
allowed_genders["in-d"] = "in-d"
allowed_genders["in-p"] = "in-p"
-- Validate and canonicalize genders.
for _, gspec in ipairs(args[1]) do
local g = gspec.spec
local canon_g = allowed_genders[g]
if canon_g then
g = canon_g
else
error("Unrecognized " .. data.langname .. " gender: " .. g)
end
gspec.spec = g
end
data.genders = args[1]
local function process_inflection(label, infls, qs, frob)
infls.label = label
for i, infl in ipairs(infls) do
if frob then
infl = frob(infl)
end
if qs[i] then
infls[i] = {term = infl, q = {qs[i]}}
end
end
if #infls > 0 then
insert(data.inflections, infls)
end
end
if args.indecl then
insert(data.inflections, {label = glossary_link("indeclinable")})
insert(data.categories, data.langname .. " indeclinable nouns")
end
-- Parse and insert an inflection not requiring additional processing into `data.inflections`. The raw
-- arguments come from `args[field]`, which is parsed for inline modifiers. `label` is the label that the
-- inflections are given, which is linked to the glossary if preceded by * (which is removed).
local function handle_infl(field, label)
parse_and_insert_inflection(data, args, field, label)
end
-- Process all inflections.
for _, spec in ipairs(noun_inflection_specs) do
local param, desc = unpack(spec)
handle_infl(param, desc)
end
end
}
end
pos_functions["nouns"] = get_noun_pos(false)
pos_functions["proper nouns"] = get_noun_pos(true)
pos_functions["verbs"] = {
params = {
[1] = {type = "genders", default = "?"},
["type"] = {set = valid_verb_types},
["pf"] = list_param,
["impf"] = list_param,
},
func = function(args, data)
-- Validate genders.
for _, gspec in ipairs(args[1]) do
local g = gspec.spec
if not valid_aspects[g] then
error("Unrecognized " .. data.langname .. " aspect: " .. g)
end
end
data.genders = args[1]
if args.type then
m_headword_utilities.insert_fixed_inflection {
headdata = data,
label = ("<<%s>>"):format(args.type),
}
insert(data.categories, ("%s %s verbs"):format(data.langname, args.type))
end
parse_and_insert_inflection(data, args, "pf", "perfective")
parse_and_insert_inflection(data, args, "impf", "imperfective")
end,
}
local function get_adj_adv_pos(pos)
local params = {
[1] = list_param,
["dim"] = list_param,
["sup"] = list_param,
["nodefsup"] = boolean_param,
}
if pos == "adjective" then
params["adv"] = list_param
params["indecl"] = boolean_param
end
return {
params = params,
func = function(args, data)
if pos == "adjective" and args.indecl then
insert(data.inflections, {label = glossary_link("indeclinable")})
insert(data.categories, data.langname .. " indeclinable adjectives")
end
local default_sups = {}
local default_abs_sups = {}
local comps = parse_inflection(data, 1, args[1])
local is_comparable = false
local lang_data = langs_supported[data.langcode]
if comps[1] then
if comps[1].term == "-" then
if not comps[2] then
m_headword_utilities.insert_fixed_inflection {
headdata = data,
label = "not <<comparable>>",
originating_term = comps[1],
}
insert(data.categories, data.langname .. " uncomparable " .. data.pos_category)
else
m_headword_utilities.insert_fixed_inflection {
headdata = data,
label = "not generally <<comparable>>",
originating_term = comps[1],
}
end
table.remove(comps, 1)
end
for i, comp in ipairs(comps) do
if not is_comparable then
is_comparable = true
insert(data.categories, data.langname .. " comparable " .. data.pos_category)
end
if comp.term == "peri" then
if not lang_data.peri_comp then
error("Don't know how to form periphrastic comparatives for " .. data.langname)
end
comp.term = ("[[%s]] [[%s]]"):format(lang_data.peri_comp, data.pagename)
if lang_data.sup then
local default_sup = m_table.shallowCopy(comp)
default_sup.term = ("[[%s%s]] [[%s]]"):format(lang_data.sup, lang_data.peri_comp,
data.pagename)
insert(default_sups, default_sup)
if lang_data.abs_sup_prefix then
local default_abs_sup = m_table.shallowCopy(comp)
default_abs_sup.term = ("[[%s%s%s]] [[%s]]"):format(lang_data.abs_sup_prefix,
lang_data.sup, lang_data.peri_comp, data.pagename)
insert(default_abs_sups, default_abs_sup)
end
end
else
if lang_data.sup then
local default_sup = m_table.shallowCopy(comp)
default_sup.term = ("%s%s"):format(lang_data.sup, comp.term)
insert(default_sups, default_sup)
if lang_data.abs_sup_prefix then
local default_abs_sup = m_table.shallowCopy(comp)
default_abs_sup.term = ("%s%s%s"):format(lang_data.abs_sup_prefix, lang_data.sup,
comp.term)
insert(default_abs_sups, default_abs_sup)
end
end
end
end
end
insert_inflection(data, comps, "komparatiw", "komparatiw")
local sups = parse_inflection(data, "komp", args.sup)
if not sups[1] then
sups = args.nodefsup and {} or {{term = "+"}}
end
local combined_sups = {}
for _, sup in ipairs(sups) do
if sup.term == "+" then
for _, def_sup in ipairs(default_sups) do
def_sup = m_table.shallowCopy(def_sup)
m_headword_utilities.combine_termobj_qualifiers_labels(def_sup, sup)
insert(combined_sups, def_sup)
end
else
insert(combined_sups, sup)
end
end
-- Compute the absolute superlative before inserting any inflections because the process of inserting
-- inflections may modify the superlatives that we base the absolute superlatives off of.
local combined_abs_sups = {}
if lang_data.abs_sup_prefix then
for _, sup in ipairs(sups) do
if sup.term == "+" then
for _, def_abs_sup in ipairs(default_abs_sups) do
def_abs_sup = m_table.shallowCopy(def_abs_sup)
m_headword_utilities.combine_termobj_qualifiers_labels(def_abs_sup, sup)
insert(combined_abs_sups, def_abs_sup)
end
else
sup = m_table.shallowCopy(sup)
if sup.term:find("%[%[") then
sup.term = "[[" .. lang_data.abs_sup_prefix .. sup.term:sub(3)
else
sup.term = lang_data.abs_sup_prefix .. sup.term
end
insert(combined_abs_sups, sup)
end
end
end
insert_inflection(data, combined_sups, "superlatiw", "superlatiw")
insert_inflection(data, combined_abs_sups, "<<absolutiw>>", "absolutiw")
if is_comparable and lang_data.excessive then
insert_inflection(data, {{term = lang_data.excessive .. data.pagename}}, "<<ekscesiw>>", "ekscesiw")
end
if pos == "adjective" then
parse_and_insert_inflection(data, args, "přisł", "wotwodźeny přisłowjesnik")
end
parse_and_insert_inflection(data, args, "pom", "pomjeńšenka")
end,
}
end
pos_functions["adjectives"] = get_adj_adv_pos("adjective")
pos_functions["adverbs"] = get_adj_adv_pos("adverb")
return export
l87p5dod29b6liiv4uc9b7h4y99tv5h
20398
20397
2026-06-01T15:37:15Z
Sławobóg
2519
20398
Scribunto
text/plain
local export = {}
local pos_functions = {}
local force_cat = false -- for testing; if true, categories appear in non-mainspace pages
local rfind = mw.ustring.find
local require_when_needed = require("Module:utilities/require when needed")
local m_table = require("Module:table")
local en_utilities_module = "Module:en-utilities"
local headword_utilities_module = "Module:headword utilities"
local m_headword_utilities = require_when_needed(headword_utilities_module)
local m_string_utilities = require_when_needed("Module:string utilities")
local glossary_link = require_when_needed(headword_utilities_module, "glossary_link")
local list_param = {list = true, disallow_holes = true}
local boolean_param = {type = "boolean"}
local unpack = unpack or table.unpack -- Lua 5.2 compatibility
local insert = table.insert
local concat = table.concat
local langs_supported = {
["hsb"] = {
peri_comp = "bóle",
sup = "naj",
abs_sup_prefix = "na",
excessive = "pře",
},
["dsb"] = {
peri_comp = "wěcej",
sup = "nej",
},
}
-- Table of all valid aspects.
local valid_aspects = m_table.listToSet {
"impf", "pf", "biasp", "?",
}
local valid_verb_types = {
semelfactive = true,
durative = true,
frequentative = true,
continuative = true,
unidirectional = true,
multidirectional = true,
concrete = "unidirectional",
abstract = "multidirectional",
}
local function track(page)
require("Module:debug").track("hsb-dsb-headword/" .. page)
return true
end
local function replace_hash_with_lemma(term, lemma)
-- If there is a % sign in the lemma, we have to replace it with %% so it doesn't get interpreted as a capture
-- replace expression.
lemma = m_string_utilities.replacement_escape(lemma)
return (term:gsub("#", lemma)) -- discard second retval
end
local function frob_term_with_hash(term, lemma)
if term:find("#") then
term = replace_hash_with_lemma(term, lemma)
end
return term
end
-- Parse and insert an inflection not requiring additional processing into `data.inflections`. The raw arguments come
-- from `args[field]`, which is parsed for inline modifiers. `label` is the label that the inflections are given;
-- sections enclosed in <<...>> are linked to the glossary. `accel` is the accelerator form, or nil.
local function parse_and_insert_inflection(data, args, field, label, accel, frob)
m_headword_utilities.parse_and_insert_inflection {
headdata = data,
forms = args[field],
paramname = field,
splitchar = ",",
label = label,
include_mods = {"t"},
accel = accel and {form = accel} or nil,
frob = function(term)
term = frob_term_with_hash(term, data.pagename)
if frob then
term = frob(term)
end
return term
end,
}
end
-- Parse and return an inflection not requiring additional processing. The raw arguments come from `args[field]`, which
-- is parsed for inline modifiers.
local function parse_inflection(data, paramname, forms)
return m_headword_utilities.parse_term_list_with_modifiers {
paramname = paramname,
forms = forms,
splitchar = ",",
include_mods = {"t"},
frob = function(term)
return frob_term_with_hash(term, data.pagename)
end,
}
end
-- Insert the parsed inflections in `infls` (as parsed by `parse_inflection`) into `data.inflections`, with label
-- `label` and optional accelerator spec `accel`.
local function insert_inflection(data, terms, label, accel)
m_headword_utilities.insert_inflection {
headdata = data,
terms = terms,
label = label,
accel = accel and {form = accel} or nil,
}
end
-- The main entry point.
-- This is the only function that can be invoked from a template.
function export.show(frame)
local iparams = {
[1] = {required = true},
["lang"] = {required = true},
}
local iargs = require("Module:parameters").process(frame.args, iparams)
local poscat = iargs[1]
langcode = iargs.lang
if langcode ~= "hsb" and langcode ~= "dsb" then
error("This module currently only works for lang=hsb and lang=dsb")
end
local lang = require("Module:languages").getByCode(langcode)
local langname = lang:getCanonicalName()
local params = {
["head"] = {list = true},
["nolink"] = {type = "boolean"},
["nolinkhead"] = {type = "boolean", alias_of = "nolink"},
["id"] = {},
["sort"] = {},
["suffix"] = {type = "boolean"},
["nosuffix"] = {type = "boolean"},
["json"] = {type = "boolean"},
["pagename"] = {}, -- for testing
}
if pos_functions[poscat] then
for key, val in pairs(pos_functions[poscat].params) do
params[key] = val
end
end
local parargs = frame:getParent().args
local args = require("Module:parameters").process(parargs, params)
local pagename = args.pagename or mw.loadData("Module:headword/data").pagename
local user_specified_heads = args.head
local heads = user_specified_heads
if args.nolink then
if #heads == 0 then
heads = {pagename}
end
end
local data = {
lang = lang,
langname = langname,
langcode = langcode,
pos_category = poscat,
categories = {},
heads = heads,
user_specified_heads = user_specified_heads,
no_redundant_head_cat = #user_specified_heads == 0,
genders = {},
inflections = {},
categories = {},
pagename = pagename,
id = args.id,
sort_key = args.sort,
force_cat_output = force_cat,
}
data.is_suffix = false
if args.suffix or (
not args.nosuffix and pagename:find("^%-") and poscat ~= "suffixes" and poscat ~= "suffix forms"
) then
data.is_suffix = true
data.pos_category = "suffixes"
local singular_poscat = require(en_utilities_module).singularize(poscat)
insert(data.categories, langname .. " " .. singular_poscat .. "-forming suffixes")
insert(data.inflections, {label = singular_poscat .. "-forming suffix"})
end
if pos_functions[poscat] then
pos_functions[poscat].func(args, data)
end
if args.json then
return require("Module:JSON").toJSON(data)
end
return require("Module:headword").full_headword(data)
end
local function get_noun_pos(is_proper)
local noun_inflection_specs = {
{"gen", "genitive singular"},
{"du", "nominative dual"},
{"pl", "nominative plural"},
{"genpl", "genitive plural"},
{"m", "male equivalent"},
{"f", "female equivalent"},
{"adj", "<<relational adjective>>"},
{"poss", "<<possessive adjective>>"},
{"dim", "<<diminutive>>"},
{"aug", "<<augmentative>>"},
{"pej", "<<pejorative>>"},
{"dem", "<<demonym>>"},
{"fdem", "female <<demonym>>"},
}
local params = {
[1] = {type = "genders", required = true, template_default = "?"},
["g"] = {list = true, disallow_holes = true, replaced_by = false,
instead = "use multiple comma-separated genders in |1="},
["indecl"] = {type = "boolean"},
}
for _, spec in ipairs(noun_inflection_specs) do
local param, desc = unpack(spec)
params[param] = list_param
end
return {
params = params,
func = function(args, data)
-- Compute allowed genders, and map incomplete genders to specs with a "?" in them.
local masc_genders = {"m", "mf", "mfbysense"}
local non_masc_genders = {false, "f", "n"}
local hsb_masc_animacies = {false, "in", "anml", "pr"}
local dsb_masc_animacies = {false, "in", "an"}
local numbers = {false, "d", "p"}
local allowed_genders = {}
local function insert_genders(genders, animacies, numbers, is_masc)
for _, g in ipairs(genders) do
for _, an in ipairs(animacies) do
for _, num in ipairs(numbers) do
local source_gender_parts = {}
local dest_gender_parts = {}
local function ins_part(part, partname)
if part then
insert(source_gender_parts, part)
insert(dest_gender_parts, part)
elseif partname == "g" and num == false or partname == "an" and is_masc then
-- allow incomplete gender duale tantum and plurale tantum nouns; also allow
-- incomplete animacy for fem/neut; otherwise insert a ? to indicate incomplete
-- gender spec
insert(dest_gender_parts, "?")
end
end
ins_part(g, "g")
ins_part(an, "an")
ins_part(num, "num")
if #source_gender_parts == 0 then
allowed_genders["?"] = "?"
else
allowed_genders[concat(source_gender_parts, "-")] =
concat(dest_gender_parts, "-")
end
end
end
end
end
if data.lang:getCode() == "hsb" then
insert_genders(masc_genders, hsb_masc_animacies, numbers, true)
else
insert_genders(masc_genders, dsb_masc_animacies, numbers, true)
end
insert_genders(non_masc_genders, {false}, numbers, false)
-- allow inanimate dual/plural; no gender distinction here
allowed_genders["in-d"] = "in-d"
allowed_genders["in-p"] = "in-p"
-- Validate and canonicalize genders.
for _, gspec in ipairs(args[1]) do
local g = gspec.spec
local canon_g = allowed_genders[g]
if canon_g then
g = canon_g
else
error("Unrecognized " .. data.langname .. " gender: " .. g)
end
gspec.spec = g
end
data.genders = args[1]
local function process_inflection(label, infls, qs, frob)
infls.label = label
for i, infl in ipairs(infls) do
if frob then
infl = frob(infl)
end
if qs[i] then
infls[i] = {term = infl, q = {qs[i]}}
end
end
if #infls > 0 then
insert(data.inflections, infls)
end
end
if args.indecl then
insert(data.inflections, {label = glossary_link("indeclinable")})
insert(data.categories, data.langname .. " indeclinable nouns")
end
-- Parse and insert an inflection not requiring additional processing into `data.inflections`. The raw
-- arguments come from `args[field]`, which is parsed for inline modifiers. `label` is the label that the
-- inflections are given, which is linked to the glossary if preceded by * (which is removed).
local function handle_infl(field, label)
parse_and_insert_inflection(data, args, field, label)
end
-- Process all inflections.
for _, spec in ipairs(noun_inflection_specs) do
local param, desc = unpack(spec)
handle_infl(param, desc)
end
end
}
end
pos_functions["nouns"] = get_noun_pos(false)
pos_functions["proper nouns"] = get_noun_pos(true)
pos_functions["verbs"] = {
params = {
[1] = {type = "genders", default = "?"},
["type"] = {set = valid_verb_types},
["pf"] = list_param,
["impf"] = list_param,
},
func = function(args, data)
-- Validate genders.
for _, gspec in ipairs(args[1]) do
local g = gspec.spec
if not valid_aspects[g] then
error("Unrecognized " .. data.langname .. " aspect: " .. g)
end
end
data.genders = args[1]
if args.type then
m_headword_utilities.insert_fixed_inflection {
headdata = data,
label = ("<<%s>>"):format(args.type),
}
insert(data.categories, ("%s %s verbs"):format(data.langname, args.type))
end
parse_and_insert_inflection(data, args, "pf", "perfective")
parse_and_insert_inflection(data, args, "impf", "imperfective")
end,
}
local function get_adj_adv_pos(pos)
local params = {
[1] = list_param,
["dim"] = list_param,
["sup"] = list_param,
["nodefsup"] = boolean_param,
}
if pos == "adjective" then
params["přisł"] = list_param
params["indecl"] = boolean_param
end
return {
params = params,
func = function(args, data)
if pos == "adjective" and args.indecl then
insert(data.inflections, {label = glossary_link("indeclinable")})
insert(data.categories, data.langname .. " indeclinable adjectives")
end
local default_sups = {}
local default_abs_sups = {}
local comps = parse_inflection(data, 1, args[1])
local is_comparable = false
local lang_data = langs_supported[data.langcode]
if comps[1] then
if comps[1].term == "-" then
if not comps[2] then
m_headword_utilities.insert_fixed_inflection {
headdata = data,
label = "not <<comparable>>",
originating_term = comps[1],
}
insert(data.categories, data.langname .. " uncomparable " .. data.pos_category)
else
m_headword_utilities.insert_fixed_inflection {
headdata = data,
label = "not generally <<comparable>>",
originating_term = comps[1],
}
end
table.remove(comps, 1)
end
for i, comp in ipairs(comps) do
if not is_comparable then
is_comparable = true
insert(data.categories, data.langname .. " comparable " .. data.pos_category)
end
if comp.term == "peri" then
if not lang_data.peri_comp then
error("Don't know how to form periphrastic comparatives for " .. data.langname)
end
comp.term = ("[[%s]] [[%s]]"):format(lang_data.peri_comp, data.pagename)
if lang_data.sup then
local default_sup = m_table.shallowCopy(comp)
default_sup.term = ("[[%s%s]] [[%s]]"):format(lang_data.sup, lang_data.peri_comp,
data.pagename)
insert(default_sups, default_sup)
if lang_data.abs_sup_prefix then
local default_abs_sup = m_table.shallowCopy(comp)
default_abs_sup.term = ("[[%s%s%s]] [[%s]]"):format(lang_data.abs_sup_prefix,
lang_data.sup, lang_data.peri_comp, data.pagename)
insert(default_abs_sups, default_abs_sup)
end
end
else
if lang_data.sup then
local default_sup = m_table.shallowCopy(comp)
default_sup.term = ("%s%s"):format(lang_data.sup, comp.term)
insert(default_sups, default_sup)
if lang_data.abs_sup_prefix then
local default_abs_sup = m_table.shallowCopy(comp)
default_abs_sup.term = ("%s%s%s"):format(lang_data.abs_sup_prefix, lang_data.sup,
comp.term)
insert(default_abs_sups, default_abs_sup)
end
end
end
end
end
insert_inflection(data, comps, "komparatiw", "komparatiw")
local sups = parse_inflection(data, "komp", args.sup)
if not sups[1] then
sups = args.nodefsup and {} or {{term = "+"}}
end
local combined_sups = {}
for _, sup in ipairs(sups) do
if sup.term == "+" then
for _, def_sup in ipairs(default_sups) do
def_sup = m_table.shallowCopy(def_sup)
m_headword_utilities.combine_termobj_qualifiers_labels(def_sup, sup)
insert(combined_sups, def_sup)
end
else
insert(combined_sups, sup)
end
end
-- Compute the absolute superlative before inserting any inflections because the process of inserting
-- inflections may modify the superlatives that we base the absolute superlatives off of.
local combined_abs_sups = {}
if lang_data.abs_sup_prefix then
for _, sup in ipairs(sups) do
if sup.term == "+" then
for _, def_abs_sup in ipairs(default_abs_sups) do
def_abs_sup = m_table.shallowCopy(def_abs_sup)
m_headword_utilities.combine_termobj_qualifiers_labels(def_abs_sup, sup)
insert(combined_abs_sups, def_abs_sup)
end
else
sup = m_table.shallowCopy(sup)
if sup.term:find("%[%[") then
sup.term = "[[" .. lang_data.abs_sup_prefix .. sup.term:sub(3)
else
sup.term = lang_data.abs_sup_prefix .. sup.term
end
insert(combined_abs_sups, sup)
end
end
end
insert_inflection(data, combined_sups, "superlatiw", "superlatiw")
insert_inflection(data, combined_abs_sups, "<<absolutiw>>", "absolutiw")
if is_comparable and lang_data.excessive then
insert_inflection(data, {{term = lang_data.excessive .. data.pagename}}, "<<ekscesiw>>", "ekscesiw")
end
if pos == "adjective" then
parse_and_insert_inflection(data, args, "přisł", "wotwodźeny přisłowjesnik")
end
parse_and_insert_inflection(data, args, "pom", "pomjeńšenka")
end,
}
end
pos_functions["adjectives"] = get_adj_adv_pos("adjective")
pos_functions["adverbs"] = get_adj_adv_pos("adverb")
return export
f63f844tii8yqk78qnkma851l5ale02
20399
20398
2026-06-01T17:33:59Z
Sławobóg
2519
20399
Scribunto
text/plain
local export = {}
local pos_functions = {}
local force_cat = false -- for testing; if true, categories appear in non-mainspace pages
local rfind = mw.ustring.find
local require_when_needed = require("Module:utilities/require when needed")
local m_table = require("Module:table")
local en_utilities_module = "Module:en-utilities"
local headword_utilities_module = "Module:headword utilities"
local m_headword_utilities = require_when_needed(headword_utilities_module)
local m_string_utilities = require_when_needed("Module:string utilities")
local glossary_link = require_when_needed(headword_utilities_module, "glossary_link")
local list_param = {list = true, disallow_holes = true}
local boolean_param = {type = "boolean"}
local unpack = unpack or table.unpack -- Lua 5.2 compatibility
local insert = table.insert
local concat = table.concat
local langs_supported = {
["hsb"] = {
peri_comp = "bóle",
sup = "naj",
abs_sup_prefix = "na",
excessive = "pře",
},
["dsb"] = {
peri_comp = "wěcej",
sup = "nej",
},
}
-- Table of all valid aspects.
local valid_aspects = m_table.listToSet {
"ndk", "dk", "biasp", "?",
}
local valid_verb_types = {
semelfactive = true,
durative = true,
frequentative = true,
continuative = true,
unidirectional = true,
multidirectional = true,
concrete = "unidirectional",
abstract = "multidirectional",
}
local function track(page)
require("Module:debug").track("hsb-dsb-headword/" .. page)
return true
end
local function replace_hash_with_lemma(term, lemma)
-- If there is a % sign in the lemma, we have to replace it with %% so it doesn't get interpreted as a capture
-- replace expression.
lemma = m_string_utilities.replacement_escape(lemma)
return (term:gsub("#", lemma)) -- discard second retval
end
local function frob_term_with_hash(term, lemma)
if term:find("#") then
term = replace_hash_with_lemma(term, lemma)
end
return term
end
-- Parse and insert an inflection not requiring additional processing into `data.inflections`. The raw arguments come
-- from `args[field]`, which is parsed for inline modifiers. `label` is the label that the inflections are given;
-- sections enclosed in <<...>> are linked to the glossary. `accel` is the accelerator form, or nil.
local function parse_and_insert_inflection(data, args, field, label, accel, frob)
m_headword_utilities.parse_and_insert_inflection {
headdata = data,
forms = args[field],
paramname = field,
splitchar = ",",
label = label,
include_mods = {"t"},
accel = accel and {form = accel} or nil,
frob = function(term)
term = frob_term_with_hash(term, data.pagename)
if frob then
term = frob(term)
end
return term
end,
}
end
-- Parse and return an inflection not requiring additional processing. The raw arguments come from `args[field]`, which
-- is parsed for inline modifiers.
local function parse_inflection(data, paramname, forms)
return m_headword_utilities.parse_term_list_with_modifiers {
paramname = paramname,
forms = forms,
splitchar = ",",
include_mods = {"t"},
frob = function(term)
return frob_term_with_hash(term, data.pagename)
end,
}
end
-- Insert the parsed inflections in `infls` (as parsed by `parse_inflection`) into `data.inflections`, with label
-- `label` and optional accelerator spec `accel`.
local function insert_inflection(data, terms, label, accel)
m_headword_utilities.insert_inflection {
headdata = data,
terms = terms,
label = label,
accel = accel and {form = accel} or nil,
}
end
-- The main entry point.
-- This is the only function that can be invoked from a template.
function export.show(frame)
local iparams = {
[1] = {required = true},
["lang"] = {required = true},
}
local iargs = require("Module:parameters").process(frame.args, iparams)
local poscat = iargs[1]
langcode = iargs.lang
if langcode ~= "hsb" and langcode ~= "dsb" then
error("This module currently only works for lang=hsb and lang=dsb")
end
local lang = require("Module:languages").getByCode(langcode)
local langname = lang:getCanonicalName()
local params = {
["head"] = {list = true},
["nolink"] = {type = "boolean"},
["nolinkhead"] = {type = "boolean", alias_of = "nolink"},
["id"] = {},
["sort"] = {},
["suffix"] = {type = "boolean"},
["nosuffix"] = {type = "boolean"},
["json"] = {type = "boolean"},
["pagename"] = {}, -- for testing
}
if pos_functions[poscat] then
for key, val in pairs(pos_functions[poscat].params) do
params[key] = val
end
end
local parargs = frame:getParent().args
local args = require("Module:parameters").process(parargs, params)
local pagename = args.pagename or mw.loadData("Module:headword/data").pagename
local user_specified_heads = args.head
local heads = user_specified_heads
if args.nolink then
if #heads == 0 then
heads = {pagename}
end
end
local data = {
lang = lang,
langname = langname,
langcode = langcode,
pos_category = poscat,
categories = {},
heads = heads,
user_specified_heads = user_specified_heads,
no_redundant_head_cat = #user_specified_heads == 0,
genders = {},
inflections = {},
categories = {},
pagename = pagename,
id = args.id,
sort_key = args.sort,
force_cat_output = force_cat,
}
data.is_suffix = false
if args.suffix or (
not args.nosuffix and pagename:find("^%-") and poscat ~= "suffixes" and poscat ~= "suffix forms"
) then
data.is_suffix = true
data.pos_category = "suffixes"
local singular_poscat = require(en_utilities_module).singularize(poscat)
insert(data.categories, langname .. " " .. singular_poscat .. "-forming suffixes")
insert(data.inflections, {label = singular_poscat .. "-forming suffix"})
end
if pos_functions[poscat] then
pos_functions[poscat].func(args, data)
end
if args.json then
return require("Module:JSON").toJSON(data)
end
return require("Module:headword").full_headword(data)
end
local function get_noun_pos(is_proper)
local noun_inflection_specs = {
{"gen", "genitive singular"},
{"du", "nominative dual"},
{"pl", "nominative plural"},
{"genpl", "genitive plural"},
{"ž", "žónski"},
{"m", "muski"},
{"pom", "pomjeńšenka"},
{"pej", "pejoratiwnje"},
{"pow", "powjetšenka"},
{"kajk", "kajkostnik"},
{"poss", "<<possessive adjective>>"},
{"dem", "demonym"},
{"ždem", "žónski demonym"},
}
local params = {
[1] = {type = "genders", required = true, template_default = "?"},
["g"] = {list = true, disallow_holes = true, replaced_by = false,
instead = "use multiple comma-separated genders in |1="},
["indecl"] = {type = "boolean"},
}
for _, spec in ipairs(noun_inflection_specs) do
local param, desc = unpack(spec)
params[param] = list_param
end
return {
params = params,
func = function(args, data)
-- Compute allowed genders, and map incomplete genders to specs with a "?" in them.
local masc_genders = {"m", "mž", "mžsens"}
local non_masc_genders = {false, "ž", "n"}
local hsb_masc_animacies = {false, "wěc", "zwj", "wos"}
local dsb_masc_animacies = {false, "žiw", "nžiw"}
local numbers = {false, "dw", "mn"}
local allowed_genders = {}
local function insert_genders(genders, animacies, numbers, is_masc)
for _, g in ipairs(genders) do
for _, an in ipairs(animacies) do
for _, num in ipairs(numbers) do
local source_gender_parts = {}
local dest_gender_parts = {}
local function ins_part(part, partname)
if part then
insert(source_gender_parts, part)
insert(dest_gender_parts, part)
elseif partname == "g" and num == false or partname == "an" and is_masc then
-- allow incomplete gender duale tantum and plurale tantum nouns; also allow
-- incomplete animacy for fem/neut; otherwise insert a ? to indicate incomplete
-- gender spec
insert(dest_gender_parts, "?")
end
end
ins_part(g, "g")
ins_part(an, "an")
ins_part(num, "num")
if #source_gender_parts == 0 then
allowed_genders["?"] = "?"
else
allowed_genders[concat(source_gender_parts, "-")] =
concat(dest_gender_parts, "-")
end
end
end
end
end
if data.lang:getCode() == "hsb" then
insert_genders(masc_genders, hsb_masc_animacies, numbers, true)
else
insert_genders(masc_genders, dsb_masc_animacies, numbers, true)
end
insert_genders(non_masc_genders, {false}, numbers, false)
-- allow inanimate dual/plural; no gender distinction here
allowed_genders["nžiw-dw"] = "nžiw-dw"
allowed_genders["nžiw-mn"] = "nžiw-mn"
-- Validate and canonicalize genders.
for _, gspec in ipairs(args[1]) do
local g = gspec.spec
local canon_g = allowed_genders[g]
if canon_g then
g = canon_g
else
error("Unrecognized " .. data.langname .. " gender: " .. g)
end
gspec.spec = g
end
data.genders = args[1]
local function process_inflection(label, infls, qs, frob)
infls.label = label
for i, infl in ipairs(infls) do
if frob then
infl = frob(infl)
end
if qs[i] then
infls[i] = {term = infl, q = {qs[i]}}
end
end
if #infls > 0 then
insert(data.inflections, infls)
end
end
if args.indecl then
insert(data.inflections, {label = glossary_link("indeclinable")})
insert(data.categories, data.langname .. " indeclinable nouns")
end
-- Parse and insert an inflection not requiring additional processing into `data.inflections`. The raw
-- arguments come from `args[field]`, which is parsed for inline modifiers. `label` is the label that the
-- inflections are given, which is linked to the glossary if preceded by * (which is removed).
local function handle_infl(field, label)
parse_and_insert_inflection(data, args, field, label)
end
-- Process all inflections.
for _, spec in ipairs(noun_inflection_specs) do
local param, desc = unpack(spec)
handle_infl(param, desc)
end
end
}
end
pos_functions["nouns"] = get_noun_pos(false)
pos_functions["proper nouns"] = get_noun_pos(true)
pos_functions["verbs"] = {
params = {
[1] = {type = "genders", default = "?"},
["type"] = {set = valid_verb_types},
["pf"] = list_param,
["impf"] = list_param,
},
func = function(args, data)
-- Validate genders.
for _, gspec in ipairs(args[1]) do
local g = gspec.spec
if not valid_aspects[g] then
error("Unrecognized " .. data.langname .. " aspect: " .. g)
end
end
data.genders = args[1]
if args.type then
m_headword_utilities.insert_fixed_inflection {
headdata = data,
label = ("<<%s>>"):format(args.type),
}
insert(data.categories, ("%s %s verbs"):format(data.langname, args.type))
end
parse_and_insert_inflection(data, args, "pf", "perfective")
parse_and_insert_inflection(data, args, "impf", "imperfective")
end,
}
local function get_adj_adv_pos(pos)
local params = {
[1] = list_param,
["dim"] = list_param,
["sup"] = list_param,
["nodefsup"] = boolean_param,
}
if pos == "adjective" then
params["přisł"] = list_param
params["indecl"] = boolean_param
end
return {
params = params,
func = function(args, data)
if pos == "adjective" and args.indecl then
insert(data.inflections, {label = glossary_link("indeclinable")})
insert(data.categories, data.langname .. " indeclinable adjectives")
end
local default_sups = {}
local default_abs_sups = {}
local comps = parse_inflection(data, 1, args[1])
local is_comparable = false
local lang_data = langs_supported[data.langcode]
if comps[1] then
if comps[1].term == "-" then
if not comps[2] then
m_headword_utilities.insert_fixed_inflection {
headdata = data,
label = "not <<comparable>>",
originating_term = comps[1],
}
insert(data.categories, data.langname .. " uncomparable " .. data.pos_category)
else
m_headword_utilities.insert_fixed_inflection {
headdata = data,
label = "not generally <<comparable>>",
originating_term = comps[1],
}
end
table.remove(comps, 1)
end
for i, comp in ipairs(comps) do
if not is_comparable then
is_comparable = true
insert(data.categories, data.langname .. " comparable " .. data.pos_category)
end
if comp.term == "peri" then
if not lang_data.peri_comp then
error("Don't know how to form periphrastic comparatives for " .. data.langname)
end
comp.term = ("[[%s]] [[%s]]"):format(lang_data.peri_comp, data.pagename)
if lang_data.sup then
local default_sup = m_table.shallowCopy(comp)
default_sup.term = ("[[%s%s]] [[%s]]"):format(lang_data.sup, lang_data.peri_comp,
data.pagename)
insert(default_sups, default_sup)
if lang_data.abs_sup_prefix then
local default_abs_sup = m_table.shallowCopy(comp)
default_abs_sup.term = ("[[%s%s%s]] [[%s]]"):format(lang_data.abs_sup_prefix,
lang_data.sup, lang_data.peri_comp, data.pagename)
insert(default_abs_sups, default_abs_sup)
end
end
else
if lang_data.sup then
local default_sup = m_table.shallowCopy(comp)
default_sup.term = ("%s%s"):format(lang_data.sup, comp.term)
insert(default_sups, default_sup)
if lang_data.abs_sup_prefix then
local default_abs_sup = m_table.shallowCopy(comp)
default_abs_sup.term = ("%s%s%s"):format(lang_data.abs_sup_prefix, lang_data.sup,
comp.term)
insert(default_abs_sups, default_abs_sup)
end
end
end
end
end
insert_inflection(data, comps, "komparatiw", "komparatiw")
local sups = parse_inflection(data, "komp", args.sup)
if not sups[1] then
sups = args.nodefsup and {} or {{term = "+"}}
end
local combined_sups = {}
for _, sup in ipairs(sups) do
if sup.term == "+" then
for _, def_sup in ipairs(default_sups) do
def_sup = m_table.shallowCopy(def_sup)
m_headword_utilities.combine_termobj_qualifiers_labels(def_sup, sup)
insert(combined_sups, def_sup)
end
else
insert(combined_sups, sup)
end
end
-- Compute the absolute superlative before inserting any inflections because the process of inserting
-- inflections may modify the superlatives that we base the absolute superlatives off of.
local combined_abs_sups = {}
if lang_data.abs_sup_prefix then
for _, sup in ipairs(sups) do
if sup.term == "+" then
for _, def_abs_sup in ipairs(default_abs_sups) do
def_abs_sup = m_table.shallowCopy(def_abs_sup)
m_headword_utilities.combine_termobj_qualifiers_labels(def_abs_sup, sup)
insert(combined_abs_sups, def_abs_sup)
end
else
sup = m_table.shallowCopy(sup)
if sup.term:find("%[%[") then
sup.term = "[[" .. lang_data.abs_sup_prefix .. sup.term:sub(3)
else
sup.term = lang_data.abs_sup_prefix .. sup.term
end
insert(combined_abs_sups, sup)
end
end
end
insert_inflection(data, combined_sups, "superlatiw", "superlatiw")
insert_inflection(data, combined_abs_sups, "<<absolutiw>>", "absolutiw")
if is_comparable and lang_data.excessive then
insert_inflection(data, {{term = lang_data.excessive .. data.pagename}}, "<<ekscesiw>>", "ekscesiw")
end
if pos == "adjective" then
parse_and_insert_inflection(data, args, "přisł", "wotwodźeny přisłowjesnik")
end
parse_and_insert_inflection(data, args, "pom", "pomjeńšenka")
end,
}
end
pos_functions["adjectives"] = get_adj_adv_pos("adjective")
pos_functions["adverbs"] = get_adj_adv_pos("adverb")
return export
gi7j1hrby2bqzopv5zkn68ifjpq3g98
20400
20399
2026-06-01T17:34:58Z
Sławobóg
2519
20400
Scribunto
text/plain
local export = {}
local pos_functions = {}
local force_cat = false -- for testing; if true, categories appear in non-mainspace pages
local rfind = mw.ustring.find
local require_when_needed = require("Module:utilities/require when needed")
local m_table = require("Module:table")
local en_utilities_module = "Module:en-utilities"
local headword_utilities_module = "Module:headword utilities"
local m_headword_utilities = require_when_needed(headword_utilities_module)
local m_string_utilities = require_when_needed("Module:string utilities")
local glossary_link = require_when_needed(headword_utilities_module, "glossary_link")
local list_param = {list = true, disallow_holes = true}
local boolean_param = {type = "boolean"}
local unpack = unpack or table.unpack -- Lua 5.2 compatibility
local insert = table.insert
local concat = table.concat
local langs_supported = {
["hsb"] = {
peri_comp = "bóle",
sup = "naj",
abs_sup_prefix = "na",
excessive = "pře",
},
["dsb"] = {
peri_comp = "wěcej",
sup = "nej",
},
}
-- Table of all valid aspects.
local valid_aspects = m_table.listToSet {
"ndk", "dk", "biasp", "?",
}
local valid_verb_types = {
semelfactive = true,
durative = true,
frequentative = true,
continuative = true,
unidirectional = true,
multidirectional = true,
concrete = "unidirectional",
abstract = "multidirectional",
}
local function track(page)
require("Module:debug").track("hsb-dsb-headword/" .. page)
return true
end
local function replace_hash_with_lemma(term, lemma)
-- If there is a % sign in the lemma, we have to replace it with %% so it doesn't get interpreted as a capture
-- replace expression.
lemma = m_string_utilities.replacement_escape(lemma)
return (term:gsub("#", lemma)) -- discard second retval
end
local function frob_term_with_hash(term, lemma)
if term:find("#") then
term = replace_hash_with_lemma(term, lemma)
end
return term
end
-- Parse and insert an inflection not requiring additional processing into `data.inflections`. The raw arguments come
-- from `args[field]`, which is parsed for inline modifiers. `label` is the label that the inflections are given;
-- sections enclosed in <<...>> are linked to the glossary. `accel` is the accelerator form, or nil.
local function parse_and_insert_inflection(data, args, field, label, accel, frob)
m_headword_utilities.parse_and_insert_inflection {
headdata = data,
forms = args[field],
paramname = field,
splitchar = ",",
label = label,
include_mods = {"t"},
accel = accel and {form = accel} or nil,
frob = function(term)
term = frob_term_with_hash(term, data.pagename)
if frob then
term = frob(term)
end
return term
end,
}
end
-- Parse and return an inflection not requiring additional processing. The raw arguments come from `args[field]`, which
-- is parsed for inline modifiers.
local function parse_inflection(data, paramname, forms)
return m_headword_utilities.parse_term_list_with_modifiers {
paramname = paramname,
forms = forms,
splitchar = ",",
include_mods = {"t"},
frob = function(term)
return frob_term_with_hash(term, data.pagename)
end,
}
end
-- Insert the parsed inflections in `infls` (as parsed by `parse_inflection`) into `data.inflections`, with label
-- `label` and optional accelerator spec `accel`.
local function insert_inflection(data, terms, label, accel)
m_headword_utilities.insert_inflection {
headdata = data,
terms = terms,
label = label,
accel = accel and {form = accel} or nil,
}
end
-- The main entry point.
-- This is the only function that can be invoked from a template.
function export.show(frame)
local iparams = {
[1] = {required = true},
["lang"] = {required = true},
}
local iargs = require("Module:parameters").process(frame.args, iparams)
local poscat = iargs[1]
langcode = iargs.lang
if langcode ~= "hsb" and langcode ~= "dsb" then
error("This module currently only works for lang=hsb and lang=dsb")
end
local lang = require("Module:languages").getByCode(langcode)
local langname = lang:getCanonicalName()
local params = {
["head"] = {list = true},
["nolink"] = {type = "boolean"},
["nolinkhead"] = {type = "boolean", alias_of = "nolink"},
["id"] = {},
["sort"] = {},
["suffix"] = {type = "boolean"},
["nosuffix"] = {type = "boolean"},
["json"] = {type = "boolean"},
["pagename"] = {}, -- for testing
}
if pos_functions[poscat] then
for key, val in pairs(pos_functions[poscat].params) do
params[key] = val
end
end
local parargs = frame:getParent().args
local args = require("Module:parameters").process(parargs, params)
local pagename = args.pagename or mw.loadData("Module:headword/data").pagename
local user_specified_heads = args.head
local heads = user_specified_heads
if args.nolink then
if #heads == 0 then
heads = {pagename}
end
end
local data = {
lang = lang,
langname = langname,
langcode = langcode,
pos_category = poscat,
categories = {},
heads = heads,
user_specified_heads = user_specified_heads,
no_redundant_head_cat = #user_specified_heads == 0,
genders = {},
inflections = {},
categories = {},
pagename = pagename,
id = args.id,
sort_key = args.sort,
force_cat_output = force_cat,
}
data.is_suffix = false
if args.suffix or (
not args.nosuffix and pagename:find("^%-") and poscat ~= "suffixes" and poscat ~= "suffix forms"
) then
data.is_suffix = true
data.pos_category = "suffixes"
local singular_poscat = require(en_utilities_module).singularize(poscat)
insert(data.categories, langname .. " " .. singular_poscat .. "-forming suffixes")
insert(data.inflections, {label = singular_poscat .. "-forming suffix"})
end
if pos_functions[poscat] then
pos_functions[poscat].func(args, data)
end
if args.json then
return require("Module:JSON").toJSON(data)
end
return require("Module:headword").full_headword(data)
end
local function get_noun_pos(is_proper)
local noun_inflection_specs = {
{"gen", "genitive singular"},
{"du", "nominative dual"},
{"pl", "nominative plural"},
{"genpl", "genitive plural"},
{"ž", "žónski"},
{"m", "muski"},
{"pom", "pomjeńšenka"},
{"pej", "pejoratiwnje"},
{"pow", "powjetšenka"},
{"kajk", "kajkostnik"},
{"poss", "<<possessive adjective>>"},
{"dem", "demonym"},
{"ždem", "žónski demonym"},
}
local params = {
[1] = {type = "genders", required = true, template_default = "?"},
["g"] = {list = true, disallow_holes = true, replaced_by = false,
instead = "use multiple comma-separated genders in |1="},
["indecl"] = {type = "boolean"},
}
for _, spec in ipairs(noun_inflection_specs) do
local param, desc = unpack(spec)
params[param] = list_param
end
return {
params = params,
func = function(args, data)
-- Compute allowed genders, and map incomplete genders to specs with a "?" in them.
local masc_genders = {"m", "mž", "mžsens"}
local non_masc_genders = {false, "ž", "n"}
local hsb_masc_animacies = {false, "wěc", "zwj", "wos"}
local dsb_masc_animacies = {false, "žiw", "nžiw"}
local numbers = {false, "dw", "mn"}
local allowed_genders = {}
local function insert_genders(genders, animacies, numbers, is_masc)
for _, g in ipairs(genders) do
for _, an in ipairs(animacies) do
for _, num in ipairs(numbers) do
local source_gender_parts = {}
local dest_gender_parts = {}
local function ins_part(part, partname)
if part then
insert(source_gender_parts, part)
insert(dest_gender_parts, part)
elseif partname == "g" and num == false or partname == "an" and is_masc then
-- allow incomplete gender duale tantum and plurale tantum nouns; also allow
-- incomplete animacy for fem/neut; otherwise insert a ? to indicate incomplete
-- gender spec
insert(dest_gender_parts, "?")
end
end
ins_part(g, "g")
ins_part(an, "an")
ins_part(num, "num")
if #source_gender_parts == 0 then
allowed_genders["?"] = "?"
else
allowed_genders[concat(source_gender_parts, "-")] =
concat(dest_gender_parts, "-")
end
end
end
end
end
if data.lang:getCode() == "hsb" then
insert_genders(masc_genders, hsb_masc_animacies, numbers, true)
else
insert_genders(masc_genders, dsb_masc_animacies, numbers, true)
end
insert_genders(non_masc_genders, {false}, numbers, false)
-- allow inanimate dual/plural; no gender distinction here
allowed_genders["nžiw-dw"] = "nžiw-dw"
allowed_genders["nžiw-mn"] = "nžiw-mn"
-- Validate and canonicalize genders.
for _, gspec in ipairs(args[1]) do
local g = gspec.spec
local canon_g = allowed_genders[g]
if canon_g then
g = canon_g
else
error("Unrecognized " .. data.langname .. " gender: " .. g)
end
gspec.spec = g
end
data.genders = args[1]
local function process_inflection(label, infls, qs, frob)
infls.label = label
for i, infl in ipairs(infls) do
if frob then
infl = frob(infl)
end
if qs[i] then
infls[i] = {term = infl, q = {qs[i]}}
end
end
if #infls > 0 then
insert(data.inflections, infls)
end
end
if args.indecl then
insert(data.inflections, {label = glossary_link("indeclinable")})
insert(data.categories, data.langname .. " indeclinable nouns")
end
-- Parse and insert an inflection not requiring additional processing into `data.inflections`. The raw
-- arguments come from `args[field]`, which is parsed for inline modifiers. `label` is the label that the
-- inflections are given, which is linked to the glossary if preceded by * (which is removed).
local function handle_infl(field, label)
parse_and_insert_inflection(data, args, field, label)
end
-- Process all inflections.
for _, spec in ipairs(noun_inflection_specs) do
local param, desc = unpack(spec)
handle_infl(param, desc)
end
end
}
end
pos_functions["nouns"] = get_noun_pos(false)
pos_functions["proper nouns"] = get_noun_pos(true)
pos_functions["verbs"] = {
params = {
[1] = {type = "genders", default = "?"},
["type"] = {set = valid_verb_types},
["pf"] = list_param,
["impf"] = list_param,
},
func = function(args, data)
-- Validate genders.
for _, gspec in ipairs(args[1]) do
local g = gspec.spec
if not valid_aspects[g] then
error("Unrecognized " .. data.langname .. " aspect: " .. g)
end
end
data.genders = args[1]
if args.type then
m_headword_utilities.insert_fixed_inflection {
headdata = data,
label = ("<<%s>>"):format(args.type),
}
insert(data.categories, ("%s %s verbs"):format(data.langname, args.type))
end
parse_and_insert_inflection(data, args, "pf", "perfective")
parse_and_insert_inflection(data, args, "impf", "imperfective")
end,
}
local function get_adj_adv_pos(pos)
local params = {
[1] = list_param,
["pom"] = list_param,
["sup"] = list_param,
["nodefsup"] = boolean_param,
}
if pos == "adjective" then
params["přisł"] = list_param
params["indecl"] = boolean_param
end
return {
params = params,
func = function(args, data)
if pos == "adjective" and args.indecl then
insert(data.inflections, {label = glossary_link("indeclinable")})
insert(data.categories, data.langname .. " indeclinable adjectives")
end
local default_sups = {}
local default_abs_sups = {}
local comps = parse_inflection(data, 1, args[1])
local is_comparable = false
local lang_data = langs_supported[data.langcode]
if comps[1] then
if comps[1].term == "-" then
if not comps[2] then
m_headword_utilities.insert_fixed_inflection {
headdata = data,
label = "not <<comparable>>",
originating_term = comps[1],
}
insert(data.categories, data.langname .. " uncomparable " .. data.pos_category)
else
m_headword_utilities.insert_fixed_inflection {
headdata = data,
label = "not generally <<comparable>>",
originating_term = comps[1],
}
end
table.remove(comps, 1)
end
for i, comp in ipairs(comps) do
if not is_comparable then
is_comparable = true
insert(data.categories, data.langname .. " comparable " .. data.pos_category)
end
if comp.term == "peri" then
if not lang_data.peri_comp then
error("Don't know how to form periphrastic comparatives for " .. data.langname)
end
comp.term = ("[[%s]] [[%s]]"):format(lang_data.peri_comp, data.pagename)
if lang_data.sup then
local default_sup = m_table.shallowCopy(comp)
default_sup.term = ("[[%s%s]] [[%s]]"):format(lang_data.sup, lang_data.peri_comp,
data.pagename)
insert(default_sups, default_sup)
if lang_data.abs_sup_prefix then
local default_abs_sup = m_table.shallowCopy(comp)
default_abs_sup.term = ("[[%s%s%s]] [[%s]]"):format(lang_data.abs_sup_prefix,
lang_data.sup, lang_data.peri_comp, data.pagename)
insert(default_abs_sups, default_abs_sup)
end
end
else
if lang_data.sup then
local default_sup = m_table.shallowCopy(comp)
default_sup.term = ("%s%s"):format(lang_data.sup, comp.term)
insert(default_sups, default_sup)
if lang_data.abs_sup_prefix then
local default_abs_sup = m_table.shallowCopy(comp)
default_abs_sup.term = ("%s%s%s"):format(lang_data.abs_sup_prefix, lang_data.sup,
comp.term)
insert(default_abs_sups, default_abs_sup)
end
end
end
end
end
insert_inflection(data, comps, "komparatiw", "komparatiw")
local sups = parse_inflection(data, "komp", args.sup)
if not sups[1] then
sups = args.nodefsup and {} or {{term = "+"}}
end
local combined_sups = {}
for _, sup in ipairs(sups) do
if sup.term == "+" then
for _, def_sup in ipairs(default_sups) do
def_sup = m_table.shallowCopy(def_sup)
m_headword_utilities.combine_termobj_qualifiers_labels(def_sup, sup)
insert(combined_sups, def_sup)
end
else
insert(combined_sups, sup)
end
end
-- Compute the absolute superlative before inserting any inflections because the process of inserting
-- inflections may modify the superlatives that we base the absolute superlatives off of.
local combined_abs_sups = {}
if lang_data.abs_sup_prefix then
for _, sup in ipairs(sups) do
if sup.term == "+" then
for _, def_abs_sup in ipairs(default_abs_sups) do
def_abs_sup = m_table.shallowCopy(def_abs_sup)
m_headword_utilities.combine_termobj_qualifiers_labels(def_abs_sup, sup)
insert(combined_abs_sups, def_abs_sup)
end
else
sup = m_table.shallowCopy(sup)
if sup.term:find("%[%[") then
sup.term = "[[" .. lang_data.abs_sup_prefix .. sup.term:sub(3)
else
sup.term = lang_data.abs_sup_prefix .. sup.term
end
insert(combined_abs_sups, sup)
end
end
end
insert_inflection(data, combined_sups, "superlatiw", "superlatiw")
insert_inflection(data, combined_abs_sups, "<<absolutiw>>", "absolutiw")
if is_comparable and lang_data.excessive then
insert_inflection(data, {{term = lang_data.excessive .. data.pagename}}, "<<ekscesiw>>", "ekscesiw")
end
if pos == "adjective" then
parse_and_insert_inflection(data, args, "přisł", "wotwodźeny přisłowjesnik")
end
parse_and_insert_inflection(data, args, "pom", "pomjeńšenka")
end,
}
end
pos_functions["adjectives"] = get_adj_adv_pos("adjective")
pos_functions["adverbs"] = get_adj_adv_pos("adverb")
return export
jw9jj65ed8dt4jh9xa8w18hw790mdvz
Předłoha:hsb-kajk
10
7484
20395
2026-06-01T14:19:08Z
Sławobóg
2519
nowa strona
20395
wikitext
text/x-wiki
{{#invoke:hsb-dsb-headword|show|adjectives|lang=hsb}}<!--
--><noinclude>{{dokumentacija}}</noinclude>
4ictjvkpvqmyucva8ubqk3vmjmmh4wy