Module: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 .. "。",
		breadcrumb = "硬音",
		parents = {{name = "依屈折分類的" .. plpos, sort = "hard-stem"}},
	}
	labels["軟音" .. plpos] = {
		description = "捷克語軟音詞幹" .. plpos .. "。",
		breadcrumb = "軟音",
		parents = {{name = "依屈折分類的" .. plpos, sort = "soft-stem"}},
	}
	labels["有短形式的" .. plpos] = {
		description = "捷克語" .. plpos .. " with short-form inflections.",
		breadcrumb = "有短形式",
		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("依詞幹類型和性別分類的POS",
		"依詞幹類型和性別分類。",
		{parents = {name = "依屈折分類的" .. pos, sort = "stem type and gender"}}
	)

	make_label("複數改變性別的POS",
		"with a different gender in the singular vs. the plural, as determined by adjective concord.",
		{
			breadcrumb = "複數改變性別",
			parents = {
				{name = "依詞幹類型和性別分類的" .. pos, sort = "changing gender in the plural"},
				{name = "不規則" .. pos, sort = "changing gender in the plural"},
			},
		}
	)

	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",
			("依詞幹類型分類的%sPOS。"):format(gender),
			{
				breadcrumb = gender,
				parents = {"依詞幹類型和性別分類的" .. pos},
			}
		)
		make_label("依詞幹類型分類的" .. gender .. "形容詞性POS",
			("依詞幹類型分類的%s形容詞性POS。"):format(gender),
			{
				breadcrumb = gender,
				parents = {"依詞幹類型和性別分類的形容詞性" .. pos},
			}
		)
		make_label("無屈折" .. gender .. "POS",
			("indeclinable %s POS. Currently only POS with multiple declensions including at least one that is "
				.. "declinable are included."):format(gender),
			{
				breadcrumb = gender,
				parents = {"無屈折" .. pos},
			}
		)
		make_label("通常無屈折" .. gender .. "POS",
			("mostly indeclinable %s POS, i.e. indeclinable in all but a few case/number combinations."
				):format(gender),
			{
				breadcrumb = "通常無屈折",
				parents = {"無屈折" .. gender .. pos},
			}
		)
	end

	make_label("有元音數量變化的POS",
		"with stem alternation between a long vowel (''á'', ''é'', ''í'', ''ou'' 或 ''ů'') and the corresponding " ..
		"short vowel (''a'', ''e'', ''i'', ''o'' 或 ''u''), depending on the form.",
		{
			additional = ("See also [[:Category:Czech %s with í-ě alternation]]."):format(pos),
			parents = {name = pos, sort = "quantitative vowel alternation"},
		}
	)

	make_label("有í-ě變化的POS",
		"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("有可簡化詞幹的POS",
		"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("有多種詞幹的POS",
		"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("遵循規則外來詞變格的POS",
		"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("詞幹不規則的POS",
		"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''", "''-i'', ''-ové'' 或 ''-é''"},
		["軟齶音詞幹"]        = {"軟齶音", "''-a''", "''-i'', ''-ové'' 或 ''-é''"},
		["半軟音"]          = {"''-ius'' 或 ''-eus''", "''-ia''", "''-іové''"},
		["軟音"]              = {"成對的軟音或不成對的輔音", "''-e''/''-ě''", "''-i'' 或 ''-ové''"},
		["混合"]             = {"''-l'', ''-n'' 或 ''-t''", "''-a'' 或 ''-e''/''-ě''", "''-i'' 或 ''-ové''"},
		["-a"]                = {"''-a''", "''-y'' (軟輔音後則為 ''-i'')", "''-é'' 或 ''-ové''"},
		["-e"]                = {"''-e''", "''-e''", "''-i'' 或 ''-ové''"},
		["-ee"]               = {"''-ee''", "''-eeho''", "''-eeové''"},
		["-i/-y"]             = {"''-i''/''-y''", "''-iho''/''-yho''", "''-iové''/''-yové'' 或 ''-i''/''-y''"},
		["-í/-ý"]             = {"''-i''/''-y''", "''-ího''/''-ýho''", "''-íové''/''-ýové'' 或 ''-í''/''-ý''"},
		["-ie"]               = {"''-ie''", "''-ieho''", "''-iové'' 或 ''-ies''"},
		["-o"]                = {"''-o''", "''-a''", "''-ové''"},
		["-u"]                = {"''-u''", "''-ua''", "''-uové''"},
		["t-詞幹"]            = {"''-e''/''-ě''", "''-ete''/''-ěte''", "''-ata''"},
	},
    ["陽性無生"] = {
		["硬音"]              = {"成對的硬音或不成對的輔音", "''-u''、偶爾為 ''-a''", "''-y''"},
		["軟齶音詞幹"]        = {"軟齶音", "''-u''、偶爾為 ''-a''", "''-y''"},
		["半軟音"]          = {"''-ius''", "''-a''", "''-e''"},
		["軟音"]              = {"成對的軟音或不成對的輔音", "''-e''", "''-e''"},
		["混合"]             = {"''-l'', ''-n'' 或 ''-t''", "''-u'' 或 ''-e''", "''-e'' 或 ''-y''"},
		["-e"]                = {"''-e''", "''-e''", "''-e''"},
		["-o"]                = {"''-o''", "''-a''", "''-ové''"},
	},
    ["陰性"] = {
		["硬音"]              = {"''-a''", "''-y'' (軟輔音後則為 ''-i'')", "''-y'' (軟輔音後則為 ''-i'')"},
		["軟音"]              = {"''-e''/'-ě''", "''-e''/''-ě''", "''-e''/''-ě''"},
		["混合"]             = {"''-a''", "''i'' 或 ''-e''/''-ě''", "''i'' 或 ''-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'' 或 (若為非技術詞) ''-eje''",  "''-ey'' 或 (若為非技術詞) ''-eje''"},
		["技術-ea"]      = {"''-ea''", "''-ey''",  "''-ey''"},
		["-i"]                = {"''-i''", "''-i'' 或 ''eře'' (古舊)", "不存在"},
		["-ia"]               = {"''-ia''", "''-ie''",  "''-ie''"},
		["-oa/-ua"]           = {"''-oa''/''-ua''", "''-oy''/''-uy''",  "''-oy''/''-uy''"},
	},
    ["中性"] = {
		["硬音"]              = {"''-o''", "''-a''", "''-a''"},
		["軟齶音詞幹"]        = {"a velar + ''-o''", "''-a''", "''-a''"},
		["半軟音"]          = {"''-io''/''-ium'', ''-eo''/''-eum'' 或 ''-ion''", "''-ia'' 或 ''-ea''",  "''-ia'' 或 ''-ea''"},
		["軟音"]              = {"''-e''/''-ě''", "''-e''/''-ě''", "''-e''/''-ě''"},
		["-í/-ý"]             = {"''-í''/''-ý''", "''-í''/''-ý''", "''-í''/''-ý''"},
		["n-詞幹"]            = {"''-eno'' 或 ''-ě''", "''-ena'' 或 ''-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''"},
	},
    ["陰性"] = {
		["硬音"]              = {"''-á''", "''-é''", "''-é''"},
		["軟音"]              = {"''-í''", "''-í''", "''-í''"},
		["所有格-ova"]    = {"''-ova''", "''-ovy''", "''-ovy''"},
		["所有格-ina"]    = {"''-ina''", "''-iny''", "''-iny''"},
	},
    ["中性"] = {
		["硬音"]              = {"''-é''", "''-é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 = "以(%-[aeiouyůvn]+)結尾的"
		local breadcrumb
		-- check for e.g. 'Czech possessive feminine adjectival nouns in -ova'
		local ending, stemtype, pos = rmatch(data.label, "^" .. in_ending .. "(.-)" .. gender .. "形容詞性(.*)" .. "$")
		if stemtype then
			stemtype = stemtype .. ending
			breadcrumb = "以" .. 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, "^混合i%-詞幹陰性(.*)%('(.*)'類%)$")
	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:gsub(" ", ""), sort = mixed_istem_type} -- L10N: remove space
			},
		}
	end
		
	for _, gender in ipairs(possible_genders) do
	local in_ending = "以(%-[aeiouyíý/%-]+)結尾的"
		local breadcrumb
		-- check for e.g. 'Czech technical feminine nouns in -ea'
		local ending, stemtype, pos = rmatch(data.label, "^" .. in_ending .. "(.-)" .. gender .. "(.*)" .. "$")
		if stemtype then
			stemtype = stemtype .. ending
			breadcrumb = "以" .. ending .. "結尾"
		end
		if not stemtype then
			-- check for e.g. 'Czech masculine animate nouns in -u' or 'Czech feminine nouns in -oa/-ua'
			pos, ending = rmatch(data.label, "^" .. in_ending .. gender .. "(.*)" .. "$")
			if pos then
				stemtype = ending
				breadcrumb = "以" .. ending .. "結尾"
			end
		end
		if not stemtype then
			-- check for e.g. 'Czech soft masculine animate 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 =
						("此類型單數主格通常以%s結尾;單數屬格以%s結尾;主格複數以%s結尾。"):
						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}
Category:Category tree資料模塊/poscatboiler Category:捷克語模塊 Category:捷克語資料模塊