模組:Category tree/poscatboiler/data/lang-specific/cs


This module handles generating the descriptions and categorization for 捷克語 category pages of the format "捷克語 LABEL" where LABEL can be any text. Examples are Category:Bulgarian conjugation 2.1 verbs and Category:Russian velar-stem neuter-form nouns. 該模块是 poscatboiler 系統的一部分,該系統是用於生成分類頁面的描述和分類的通用框架。

有關更多資訊,請參閱Module:category tree/poscatboiler/data/lang-specific/doc

注意:如果您新增了特定語言的模块,請將語言代碼新增至 Module:category tree/poscatboiler/data/lang-specific 頂部的清單中,使程式碼能識別該模块。


local labels = {}
local handlers = {}

local rfind = mw.ustring.find
local rmatch = mw.ustring.match


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

local adj_like_poses = {"形容詞", "代詞", "限定詞", "數詞", "後綴"}
for _, pos in ipairs(adj_like_poses) do
	local plpos = pos
	labels["硬音" .. plpos] = {
		description = "捷克語硬音詞幹" .. plpos .. "。",
		parents = {{name = "依屈折分類的" .. plpos, sort = "hard-stem"}},
	}
	labels["軟音" .. plpos] = {
		description = "捷克語軟音詞幹" .. plpos .. "。",
		parents = {{name = "依屈折分類的" .. plpos, sort = "soft-stem"}},
	}
	labels["有短形式的" .. plpos] = {
		description = "捷克語" .. plpos .. " with short-form inflections.",
		parents = {{name = "依屈折分類的" .. plpos, sort = "short forms"}},
	}
end


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

local possible_genders = {"陽性有生", "陽性無生", "陰性", "中性"}

for _, pos in ipairs({"名詞", "代詞", "數詞"}) 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 = "捷克語" .. 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("形容詞性POS",
		"帶形容詞性詞尾。",
		{parents = {pos}}
	)

	make_label("依詞幹類型和性別分類",
		"依詞幹類型和性別分類。",
		{parents = {name = "依屈折分類的" .. pos, sort = "stem type and gender"}}
	)

	make_label("依詞幹類型和性別分類的形容詞性POS",
		"依詞幹類型和性別分類的形容詞性POS。",
		{
			parents = {
				{name = "依屈折分類的" .. pos, sort = "stem type and gender"},
				{name = "形容詞性" .. pos, sort = "stem type and gender"},
			}
		}
	)

	for _, gender in ipairs(possible_genders) do
		make_label(gender .. " POS by stem type",
			("依詞幹類型分類的%sPOS。"):format(gender),
			{
				breadcrumb = gender,
				parents = {"依詞幹類型和性別分類的" .. pos},
			}
		)
		make_label("依詞幹類型分類的" .. gender .. "形容詞性POS",
			("依詞幹類型分類的%s形容詞性POS。"):format(gender),
			{
				breadcrumb = gender,
				parents = {"依詞幹類型和性別分類的形容詞性" .. pos},
			}
		)
	end

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

	make_label("有簡化詞幹的",
		"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, sort = "reducible stem"}}
	)

	make_label("有多個詞幹的",
		"with multiple stems.",
		{parents = {name = "依屈折分類的" .. pos, sort = "multiple stems"}}
	)

	make_label("陽性有生POS",
		"陽性有生POS, i.e. POS referring (mostly) to male beings or animals.",
		{
			breadcrumb = "有生",
			parents = {{name = "陽性" .. pos, sort = "animate"}},
		}
	)

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

	make_label("有規則外來語變格的",
		"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, sort = "regular foreign declension"}}
	)

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

local noun_stem_gender_endings = {
    ["陽性有生"] = {
		["硬音"]              = {"a paired hard or unpaired consonant", "''-a''", "''-i'', ''-ové'' or ''-é''"},
		["軟齶音詞幹"]        = {"a velar", "''-a''", "''-i'', ''-ové'' or ''-é''"},
		["半軟音"]          = {"''-ius'' or ''-eus''", "''-ia''", "''-іové''"},
		["軟音"]              = {"a paired soft or unpaired consonant", "''-e''/''-ě''", "''-i'' or ''-ové''"},
		["混合"]             = {"''-l'', ''-n'' or ''-t''", "''-a'' or ''-e''/''-ě''", "''-i'' or ''-ové''"},
		["-a"]                = {"''-a''", "''-y'' (''-i'' after a soft consonant)", "''-é'' or ''-ové''"},
		["-e"]                = {"''-e''", "''-e''", "''-i'' or ''-ové''"},
		["-i/-y"]             = {"''-i''/''-y''", "''-iho''/''-yho''", "''-iové''/''-yové'' or ''-i''/''-y''"},
		["-o"]                = {"''-o''", "''-a''", "''-ové''"},
		["-u"]                = {"''-u''", "''-ua''", "''-uové''"},
		["t-詞幹"]            = {"''-e''/''-ě''", "''-ete''/''-ěte''", "''-ata''"},
	},
    ["陽性無生"] = {
		["硬音"]              = {"a paired hard or unpaired consonant", "''-u'' or occasionally ''-a''", "''-y''"},
		["軟齶音詞幹"]        = {"a velar", "''-u'' or occasionally ''-a''", "''-y''"},
		["半軟音"]          = {"''-ius''", "''-a''", "''-e''"},
		["軟音"]              = {"a paired soft or unpaired consonant", "''-e''", "''-e''"},
		["混合"]             = {"''-l'', ''-n'' or ''-t''", "''-u'' or ''-e''", "''-e'' or ''-y''"},
		["-o"]                = {"''-o''", "''-a''", "''-ové''"},
	},
    feminine = {
		["硬音"]              = {"''-a''", "''-y'' (''-i'' after a soft consonant)", "''-y'' (''-i'' after a soft consonant)"},
		["軟音"]              = {"''-e''/'-ě''", "''-e''/''-ě''", "''-e''/''-ě''"},
		["混合"]             = {"''-a''", "''i'' or ''-e''/''-ě''", "''i'' or ''-e''/''-ě''"},
		["軟音零結尾"]  = {"a paired soft or unpaired consonant", "''-e''/''-ě''", "''-e''/''-ě''"},
		["i-詞幹"]            = {"a paired soft or unpaired consonant", "''-i''", "''-i''"},
		["混合i-詞幹"]      = {"a paired soft or unpaired consonant", "''-i'' or sometimes ''-e''/''-ě''", "''-i'' or sometimes ''-e''/''-ě''"},
		["-ea"]               = {"''-ea''", "''-ey'' or (if non-technical) ''-eje''",  "''-ey'' or (if non-technical) ''-eje''"},
		["technical-ea"]      = {"''-ea''", "''-ey''",  "''-ey''"},
		["-oa/-ua"]           = {"''-oa''/''-ua''", "''-oy''/''-uy''",  "''-oy''/''-uy''"},
		["-ia"]               = {"''-ia''", "''-ie''",  "''-ie''"},
	},
    neuter = {
		["硬音"]              = {"''-o''", "''-a''", "''-a''"},
		["軟齶音詞幹"]        = {"a velar + ''-o''", "''-a''", "''-a''"},
		["半軟音"]          = {"''-io''/''-ium'', ''-eo''/''-eum'' or ''-ion''", "''-ia'' or ''-ea''",  "''-ia'' or ''-ea''"},
		["軟音"]              = {"''-e''/''-ě''", "''-e''/''-ě''", "''-e''/''-ě''"},
		["-í/-ý"]             = {"''-í''/''-ý''", "''-í''/''-ý''", "''-í''/''-ý''"},
		["n-詞幹"]            = {"''-eno'' or ''-ě''", "''-ena'' or ''-ene''", "''-ena''"},
		["t-詞幹"]            = {"''-e''/''-ě''", "''-ete''/''-ěte''", "''-ata''"},
		["ma-詞幹"]           = {"''-ma''", "''-matu''", "''-mata''"},
	},
}

local adj_noun_stem_gender_endings = {
    ["陽性有生"] = {
		["硬音"]              = {"''-ý''", "''-ého''", "''-í''"},
		["軟音"]              = {"''-í''", "''-ího''", "''-í''"},
		["所有格-ův"]     = {"''-ův''", "''-ova''", "''-ovi''"},
		["所有格-in"]     = {"''-in''", "''-ina''", "''-ini''"},
	},
    ["陽性無生"] = {
		["硬音"]              = {"''-ý''", "''-ého''", "''-é''"},
		["軟音"]              = {"''-í''", "''-ího''", "''-í''"},
		["所有格-ův"]     = {"''-ův''", "''-ova''", "''-ovy''"},
		["所有格-in"]     = {"''-in''", "''-ina''", "''-iny''"},
	},
    feminine = {
		["硬音"]              = {"''-á''", "''-é''", "''-é''"},
		["軟音"]              = {"''-í''", "''-í''", "''-í''"},
		["所有格-ova"]    = {"''-ova''", "''-ovy''", "''-ovy''"},
		["所有格-ina"]    = {"''-ina''", "''-iny''", "''-iny''"},
	},
    neuter = {
		["硬音"]              = {"''-é''", "''-ého''", "''-á''"},
		["軟音"]              = {"''-í''", "''-ího''", "''-í''"},
		["所有格-ovo"]    = {"''-ovo''", "''-ova''", "''-ova''"},
		["所有格-ino"]    = {"''-ino''", "''-ina''", "''-ina''"},
	},
}

table.insert(handlers, function(data)
	for _, gender in ipairs(possible_genders) do
		local in_ending = "in (%-[aeiouyůvn]+)"
		local breadcrumb
		-- check for e.g. '捷克語所有格陰性形容詞性名詞 in -ova'
		local stemtype, pos, ending = rmatch(data.label, "^(.-) " .. gender .. "形容詞性(.*)" .. in_ending .. "$")
		if stemtype then
			stemtype = stemtype .. ending
			breadcrumb = stemtype .. " in " .. ending
		end
		if not stemtype then
			-- check for e.g. '捷克語硬音陽性有生形容詞性名詞'
			stemtype, pos = rmatch(data.label, "^(.-) " .. gender .. "形容詞性(.*)$")
			breadcrumb = stemtype
		end
		if stemtype then
			if adj_noun_stem_gender_endings[gender] then
				local endings = adj_noun_stem_gender_endings[gender][stemtype]
				if endings then
					local nom_s, gen_s, nom_p = unpack(endings)
					local additional =
						("This type declines like an adjective. It normally ends in %s in the nominative singular; %s in the genitive singular; and %s in the nominative plural."):
						format(nom_s, gen_s, nom_p)
					return {
						description = "捷克語" .. data.label .. "。",
						additional = additional,
						breadcrumb = breadcrumb,
						parents = {
							{name = "依詞幹分類的" .. gender .. "形容詞性" .. pos, sort = stemtype:gsub("%-", "")}
						},
					}
				end
			end
		end
	end

	local pos, mixed_istem_type = rmatch(data.label, "^mixed i%-stem feminine (.*)s %(type '(.*)'%)$")
	if mixed_istem_type then
		return {
			description = "Czech mixed i-stem feminine " .. pos .. "s, declined like {{m|cs|" .. mixed_istem_type .. "}}.",
			additional = "These nouns have a mixture of soft-stem and i-stem endings in the genitive singular, " ..
				"nominative/accusative/vocative plural, dative plural, instrumental plural and locative plural. The particular endings used depend on the subtype.",
			breadcrumb = mixed_istem_type,
			parents = {
				{name = "混合i-詞幹陰性" .. pos, sort = mixed_istem_type}
			},
		}
	end
		
	for _, gender in ipairs(possible_genders) do
		local in_ending = "in (%-[aeiouyíý/%-]+)"
		local breadcrumb
		-- check for e.g. 'Czech technical feminine nouns in -ea'
		local stemtype, pos, ending = rmatch(data.label, "^(.-) " .. gender .. " (.*)s " .. in_ending .. "$")
		if stemtype then
			stemtype = stemtype .. ending
			breadcrumb = stemtype .. " in " .. ending
		end
		if not stemtype then
			-- check for e.g. 'Czech 陽性有生nouns in -u' or 'Czech feminine nouns in -oa/-ua'
			pos, ending = rmatch(data.label, "^" .. gender .. " (.*)s " .. in_ending .. "$")
			if pos then
				stemtype = ending
				breadcrumb = " in " .. ending
			end
		end
		if not stemtype then
			-- check for e.g. 'Czech soft 陽性有生nouns' or 'Czech soft zero-ending feminine nouns'
			stemtype, pos = rmatch(data.label, "^(.-) " .. gender .. " (.*)$")
			breadcrumb = stemtype
		end
		if stemtype then
			if noun_stem_gender_endings[gender] then
				local endings = noun_stem_gender_endings[gender][stemtype]
				if endings then
					local nom_s, gen_s, nom_p = unpack(endings)
					local additional =
						("This type normally ends in %s in the nominative singular; %s in the genitive singular; and %s in the nominative plural."):
						format(nom_s, gen_s, nom_p)
					return {
						description = "捷克語" .. data.label .. "。",
						additional = additional,
						breadcrumb = breadcrumb,
						parents = {
							{name = "依詞幹類型分類的" .. gender .. pos, sort = stemtype:gsub("%-", "")}
						},
					}
				end
			end
		end
	end
end)

return {LABELS = labels, HANDLERS = handlers}