Module:category tree/poscatboiler/data/lang-specific/zlw-ocs

From Wiktionary, the free dictionary
Jump to navigation Jump to search

This module handles generating the descriptions and categorization for Old Czech category pages of the format "Old Czech LABEL" where LABEL can be any text. Examples are Category:Bulgarian conjugation 2.1 verbs and Category:Russian velar-stem neuter-form nouns. This module is part of the poscatboiler system, which is a general framework for generating the descriptions and categorization of category pages.

For more information, see Module:category tree/poscatboiler/data/lang-specific/documentation.

NOTE: If you add a new language-specific module, you must add the language code to the list at the top of Module:category tree/poscatboiler/data/lang-specific in order for the module to be recognized.


local labels = {}
local handlers = {}

local rfind = mw.ustring.find


--------------------------------- Nouns/Pronouns/Numerals --------------------------------

local noun_decls = {
	["hard masculine a-stem"] = {
		singular = "-а",
		plural = "-y",
		gender = "masculine",
		sortkey = "a-stem",
	},
	["hard feminine a-stem"] = {
		singular = "-а",
		plural = "-y",
		gender = "feminine",
		sortkey = "a-stem",
	},
	["soft masculine a-stem"] = {
		singular = "-ě",
		plural = "-ě",
		gender = "masculine",
		sortkey = "a-stem",
	},
	["soft feminine a-stem"] = {
		singular = "-ě",
		plural = "-ě",
		gender = "feminine",
		sortkey = "a-stem",
	},
	["masculine i-stem"] = {
		singular = "-",
		plural = "-i",
		gender = "masculine",
	},
	["feminine i-stem"] = {
		singular = "-",
		plural = "-i",
		gender = "feminine",
	},
	["ī-stem"] = {
		singular = "-ии or -ьи",
		plural = "-иѭ or -ьѩ",
		gender = "feminine (masculine when referring to a person)",
		parent = "soft a-stem",
	},
	["hard masculine o-stem"] = {
		singular = "-",
		plural = "-i",
		gender = "masculine",
		sortkey = "o-stem",
	},
	["soft masculine o-stem"] = {
		singular = "-",
		plural = "-i",
		gender = "masculine",
		sortkey = "o-stem",
	},
	["hard neuter o-stem"] = {
		singular = "-o",
		plural = "-а",
		gender = "neuter",
		sortkey = "o-stem",
	},
	["soft neuter o-stem"] = {
		singular = "-e",
		plural = "-ě",
		gender = "neuter",
		sortkey = "o-stem",
	},
	["u-stem"] = {
		singular = "-",
		plural = "-оvé",
		gender = "masculine",
	},
	["masculine n-stem"] = {
		singular = "-n",
		plural = "-ni",
		gender = "masculine",
		parent = "consonant-stem",
	},
	["neuter n-stem"] = {
		singular = "-ě",
		plural = "-ena",
		gender = "neuter",
		parent = "consonant-stem",
	},
	["masculine t-stem"] = {
		singular = "et",
		plural = "-ty",
		gender = "masculine",
		parent = "consonant-stem",
	},
	["neuter t-stem"] = {
		singular = "-ě",
		plural = "-ata",
		gender = "neuter",
		parent = "consonant-stem",
	},
	["r-stem"] = {
		singular = "-i",
		plural = "-ery",
		gender = "feminine",
		parent = "consonant-stem",
	},
	["v-stem"] = {
		singular = "-ev",
		plural = "-ve",
		gender = "feminine",
		parent = "consonant-stem",
	}
}

for _, pos in ipairs({"nouns"}) do
	local sgpos = pos:gsub("s$", "")
	labels["consonant-stem " .. pos] = {
		description = "Old Czech consonant-stem " .. pos .. ".",
		additional = "This is not a single declension class, but a set of related declension classes, with endings that are"
			.. " largely identical outside of the nominative, accusative and vocative.",
		breadcrumb = "consonant-stem",
		parents = pos .. " by stem type and gender",
	}
	for decl, spec in pairs(noun_decls) do
		labels[decl .. " " .. pos] = {
			description = "Old Czech " .. decl .. " " .. pos .. ".",
			additional = "These " .. pos .. " normally end in " .. spec.singular .. " in the singular and " .. spec.plural .. " in the"
				.. " plural, and are most commonly " .. spec.gender .. ".",
			breadcrumb = decl,
			parents = {{
				name = spec.parent and spec.parent .. " " .. pos or pos .. " by stem type and gender",
				sort = spec.sortkey or decl,
			}},
		}
	end
end


--------------------------------- Verbs --------------------------------

local verb_classes = {
	["1"] = "whose infinitive ends in <<-ti>> directly following the root (or <<-ci>> for roots ending in a velar) and ending in <<-e>>, <<-é>> or <<-ie>> in the third singular present",
	["2"] = "ending in <<-núti>> in the infinitive and <<-ne>> in the third singular present",
	["3"] = "ending in <<-ěti>>, <<-éti>>, <<-ieti>> or <<-áti>> in the infinitive and <<-í>> or <<-ie>> in the third singular present",
	["4"] = "ending in <<-iti>> in the infinitive and <<-í>> in the third singular present",
	["5"] = "ending in Proto-Slavic {{m|sla-pro||*-ati}} or {{m|sla-pro||*-ěti}} in the infinitive (Old Czech <<-ati>>, <<-áti>>, <<-ěti>> or <<-ieti>>) and Old Czech <<-e>> or <<-á>> in the third singular present",
	["6"] = "ending in <<-ovati>> in the infinitive and <<-uje>> in the third singular present",
}

for class, desc in pairs(verb_classes) do
	desc = desc:gsub("<<(.-)>>", "{{m|zlw-ocs||%1}}")
	labels["class " .. class .. " verbs"] = {
		description = ("Old Czech class %s verbs, %s."):format(class, desc),
		breadcrumb = "class " .. class,
		parents = {{name = "verbs by inflection type", sort = class}},
	}
end


--------------------------------- Adjectives --------------------------------

local adj_like_poses = {"adjective", "pronoun", "determiner", "numeral", "suffix"}
for _, pos in ipairs(adj_like_poses) do
	local plpos = require("Module:string utilities").pluralize(pos)
	labels["hard " .. plpos] = {
		description = "Old Czech hard " .. plpos .. ".",
		parents = {{name = plpos .. " by inflection type", sort = "hard-stem"}},
	}
	labels["soft " .. plpos] = {
		description = "Old Czech soft " .. plpos .. ".",
		parents = {{name = plpos .. " by inflection type", sort = "soft-stem"}},
	}
	labels[plpos .. " with short forms"] = {
		description = "Old Czech " .. plpos .. " with short-form inflections.",
		parents = {{name = plpos .. " by inflection type", sort = "short forms"}},
	}
end


--------------------------------- Nouns/Pronouns/Numerals --------------------------------

local possible_genders = {"masculine personal", "masculine animal", "masculine inanimate", "feminine", "neuter"}

for _, pos in ipairs({"nouns", "pronouns", "numerals"}) do
	local sgpos = pos:gsub("s$", "")
	
	local function make_label(label, description, props)
		local full_label
		if rfind(label, "POS") then
			full_label = label:gsub("POS", pos)
		else
			full_label = pos .. " " .. label
		end
		local full_description
		if rfind(description, "POS") then
			full_description = description:gsub("POS", pos)
		else
			full_description = pos .. " " .. description
		end
		full_description = "Old Czech " .. full_description
		props.description = full_description
		if not props.breadcrumb then
			props.breadcrumb = label:gsub(" *POS *", " ")
			props.breadcrumb = mw.text.trim(props.breadcrumb)
		end
		labels[full_label] = props
	end

	make_label("adjectival POS",
		"with adjectival endings.",
		{parents = {pos}}
	)

	make_label("by stem type and gender",
		"categorized by stem type and gender.",
		{parents = {name = pos .. " by inflection type", sort = "stem type and gender"}}
	)

	make_label("adjectival POS by stem type and gender",
		"adjectival POS categorized by stem type and gender.",
		{
			parents = {
				{name = pos .. " by inflection type", sort = "stem type and gender"},
				{name = "adjectival " .. pos, sort = "stem type and gender"},
			}
		}
	)

	for _, gender in ipairs(possible_genders) do
		make_label(gender .. " POS by stem type",
			("%s POS categorized by stem type."):format(gender),
			{
				breadcrumb = gender,
				parents = {pos .. " by stem type and gender"},
			}
		)
		make_label(gender .. " adjectival POS by stem type",
			("%s adjectival POS categorized by stem type."):format(gender),
			{
				breadcrumb = gender,
				parents = {"adjectival " .. pos .. " by stem type and gender"},
			}
		)
	end

	make_label("with quantitative vowel alternation",
		"with stem alternation between a long vowel (''á'', ''é'', ''í'', ''ó'' or ''ú'') and the corresponding " ..
		"short vowel (''a'', ''e'', ''i'', ''o'' or ''u''), depending on the form.",
		{
			additional = ("See also [[:Category:Old Czech %s with í-ě alternation]]."):format(pos),
			parents = {name = pos, sort = "quantitative vowel alternation"},
		}
	)

	make_label("with í-ě alternation",
		"with stem alternation between ''í'' and ''ě'', depending on the form.",
		{
			additional = ("See also [[:Category:Old Czech %s with quantitative vowel alternation]]."):format(pos),
			parents = {name = pos, sort = "í-ě alternation"},
		}
	)

	make_label("with actual gender different from declined gender",
		"declined with the endings of a particular gender but actually with a different gender, as shown by "
			.. "agreement patterns.",
		{
			additional = ("See also [[:Category:Old Czech %s with í-ě alternation]]."):format(pos),
			parents = {name = "irregular " .. pos, sort = "change gender"}
		}
	)

	make_label("that change gender in the plural",
		"with a different gender in the plural as compared with the singular, as shown by agreement patterns.",
		{
			additional = ("See also [[:Category:Old Czech %s with í-ě alternation]]."):format(pos),
			parents = {name = "irregular " .. pos, sort = "change gender"}
		}
	)

	make_label("with reducible stem",
		"with a reducible stem, where an extra vowel is inserted " ..
			"before the last stem consonant in the nominative singular and/or genitive plural.",
		{parents = {name = pos .. " by inflection type", sort = "reducible stem"}}
	)

	make_label("with multiple stems",
		"with multiple stems.",
		{parents = {name = pos .. " by inflection type", sort = "multiple stems"}}
	)

	make_label("masculine personal POS",
		"masculine personal POS, i.e. POS referring (mostly) to male human beings.",
		{
			breadcrumb = "personal",
			parents = {{name = "masculine " .. pos, sort = "personal"}},
		}
	)

	make_label("masculine animal POS",
		"masculine animal POS, i.e. POS referring (mostly) to male animals.",
		{
			breadcrumb = "animal",
			parents = {{name = "masculine " .. pos, sort = "animal"}},
		}
	)

	make_label("masculine inanimate POS",
		"masculine inanimate POS, i.e. POS referring to inanimate objects that have masculine agreement patterns.",
		{
			breadcrumb = "inanimate",
			parents = {{name = "masculine " .. pos, sort = "inanimate"}},
		}
	)

	make_label("with regular foreign declension",
		"with a foreign ending such as ''-us'', ''-os'', ''-es'', ''-um'', ''-on'' or silent ''-e'', which is dropped in " ..
		"all cases except the nominative singular and maybe the accusative singular and vocative singular.",
		{parents = {name = pos .. " by inflection type", sort = "regular foreign declension"}}
	)

	make_label("with irregular stem",
		"with an irregular stem, which occurs in all cases except the nominative singular and maybe the accusative "
		.. "singular and vocative singular.",
		{parents = {name = "irregular " .. pos, sort = "stem"}}
	)
end

return {LABELS = labels, HANDLERS = handlers}