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


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 lang = require("Module:languages").getByCode("ru")
local rfind = mw.ustring.find
local rmatch = mw.ustring.match
local rsubn = mw.ustring.gsub

-- version of rsubn() that discards all but the first return value
local function rsub(term, foo, bar)
	local retval = rsubn(term, foo, bar)
	return retval
end


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

labels["各類動詞"] = {
	description = "俄語動詞按類別分類。",
	parents = {{name = "依屈折分類的動詞", sort = "類"}},
}

labels["各類及重音型動詞"] = {
	description = "俄語動詞按類別及重音型分類",
	parents = {{name = "依屈折分類的動詞", sort = "類及重音型"}},
}

table.insert(handlers, function(data)
	local cls, variant, pattern = rmatch(data.label, "^([0-9]*)(°?)([abc]?)類動詞$")
	if cls then
		if pattern == "" then
			return {
				description = "俄語" .. cls .. "類動詞。",
				breadcrumb = cls,
				parents = {{name = "各類動詞", sort = cls .. variant}},
			}
		else
			return {
				description = "Russian class " .. cls .. " verbs of " ..
					"accent pattern " .. pattern .. (
					variant == "" and "" or " and variant " .. variant) .. ". " .. (
					pattern == "a" and "With this pattern, all forms are stem-stressed."
					or pattern == "b" and "With this pattern, all forms are ending-stressed."
					or "With this pattern, the first singular present indicative and all forms " ..
					"outside of the present indicative are ending-stressed, while the remaining " ..
					"forms of the present indicative are stem-stressed.") .. (
					variant == "" and "" or
					cls == "3" and " The variant code indicates that the -н of the stem " ..
					"is missing in most non-present-tense forms." or
					" The variant code indicates that the present tense is not " ..
					"[[Appendix:Glossary#iotation|iotated]]. (In most verbs of this class, " ..
					"the present tense is iotated, e.g. иска́ть with present tense " ..
					"ищу́, и́щешь, и́щет, etc.)"),
				breadcrumb = cls .. variant .. pattern,
				parents = {
					{name = cls .. "類動詞", sort = pattern},
					{name = "各類及重音型動詞", sort = cls .. pattern},
				},
			}
		end
	end
end)


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

local function lang_ru(text)
	return '<span class="Cyrl" lang="ru">' .. text .. "</span>"
end

local function term_ru(term, gloss)
	return require("Module:links").full_link({ lang = lang, term = term, gloss = gloss }, "term")
end

labels["adjectives by stem type and stress"] = {
	description = "Russian adjectives categorized by stem type and stress. " ..
		"Unlike for nouns, adjectives are consistently either stem-stressed or ending-stressed.",
	parents = {{name = "依屈折分類的形容詞", sort = "stem type and stress"}},
}

labels["ending-stressed adjectives"] = {
	description = "Russian adjectives where the ending is stressed. They end in " ..
		lang_ru("-о́й") .. ", or in some cases " .. lang_ru("-и́н") .. ", " .. lang_ru("-о́в") .. ", or " ..
		lang_ru("-ёв") .. ".",
	parents = {{name = "依屈折分類的形容詞", sort = "ending-stressed"}},
}

labels["adjectives with short forms"] = {
	description = "Russian adjectives that have short forms. Short forms are used " ..
		"[[Appendix:Glossary#predicative|predicatively]] and generally only for adjectives " ..
		"that are qualitative, i.e. can be modified with adverbs such as [[very]], [[completely]], " ..
		"[[somewhat]], [[more]], etc.",
	parents = {{name = "adjectives", sort = "short forms"}},
}

labels["adjectives with missing short forms"] = {
	description = "Russian adjectives that have short forms but where some of the short forms " ..
		"are missing. Short forms are used predicatively and generally only for adjectives that " ..
		"are qualitative, i.e. can be modified with adverbs such as [[very]], [[completely]], " ..
		"[[somewhat]], [[more]], etc.",
	parents = {{name = "adjectives", sort = "missing short forms"}},
}

labels["adjectives with irregular short stem"] = {
	description = "Russian adjectives where the stem of the short forms is irregular compared " ..
		"with the stem of the remaining forms. Examples are " .. term_ru("солёный", "[[salty]]") ..
		" (short forms " .. lang_ru("со́лон, солона́, со́лоно, солоны́/со́лоны") .. "); " ..
		term_ru("ма́ленький", "[[small]]") .. " (short forms " .. lang_ru("мал, мала́, мало́, малы́") ..
		"); and " .. term_ru("большо́й", "[[big]]") .. " (short forms " ..
		lang_ru("вели́к, велика́, велико́, велики́") .. ". (In the latter two cases, the short forms " ..
		"come from the synonymous adjectives " .. term_ru("ма́лый") .. " and " .. term_ru("вели́кий") ..
		", respectively.)",
	parents = {{name = "irregular adjectives", sort = "short stem"}},
}

labels["adjectives with reducible short stem"] = {
	description = "Russian adjectives where the stem of the short forms is [[Appendix:Glossary#reducible|reducible]]; " ..
		"specifically, the short masculine singular has an extra vowel inserted before the final " ..
		"consonant, compared with all other forms. Examples are most adjectives in " .. term_ru("-кий") ..
		" and " .. term_ru("-ный") .. ", e.g. " .. term_ru("лёгкий", "[[light]], [[easy]]") ..
		" with short masculine singular " .. term_ru("лёгок") .. " and " ..
		term_ru("де́льный", "[[efficient]], [[sensible]]") .. " with short masculine singular " ..
		term_ru("де́лен") .. ".",
	parents = {{name = "adjectives", sort = "reducible short stem"}},
}

labels["adjectives with Zaliznyak short form special case 1"] = {
	description = "Russian adjectives where the lemma form ends in " .. lang_ru("-нный") .. " or " ..
		lang_ru("-нний") .. " (with two " .. lang_ru("н") .. "'s) but the short masculine singular ends " ..
		"in simply " .. lang_ru("-н") .. " (i.e. with only one " .. lang_ru("н") .. "). Examples are " ..
		term_ru("самоуве́ренный", "[[self-confident]]") .. ", with short masculine singular " ..
		term_ru("самоуве́рен") .. " (short feminine singular " .. term_ru("самоуве́ренна") .. ", etc.); and " ..
		term_ru("вы́спренний", "[[grandiloquent]]") .. ", with short masculine singular " ..
		term_ru("вы́спрен") .. " (short feminine singular " .. term_ru("вы́спрення") .. ", etc.). Contrast " ..
		"[[:Category:Russian adjectives with Zaliznyak short form special case 2|special case 2]], where " ..
		"only one " .. lang_ru("-н") .. " is present in '''all''' short forms.",
	parents = {{name = "adjectives", sort = "Zaliznyak short form special case 1"}},
}

labels["adjectives with Zaliznyak short form special case 2"] = {
	description = "Russian adjectives where the lemma form ends in " .. lang_ru("-нный") .. " (with two " ..
		lang_ru("н") .. "'s) but all short forms end in only one " .. lang_ru("-н") .. ". An example is " ..
		term_ru("подве́рженный", "[[subject]] to, [[liable]] to, [[prone]] to") .. ", with short forms " ..
		lang_ru("подве́ржен, подве́ржена, подве́ржено, подве́ржены") .. ". All past passive participles in " ..
		lang_ru("-нный") .. " decline this way in their short forms, and most or all adjectives that " ..
		"decline this way are past passive participles in origin. Contrast " ..
		"[[:Category:Russian adjectives with Zaliznyak short form special case 1|special case 1]], where " ..
		"only the short masculine singular is irregular in having only a single " .. lang_ru("-н") .. ". " ..
		"Note that many terms decline both ways, declining as special case 2 as a participle and as " ..
		"special case 1 as an adjective. An example is " .. term_ru("отвлечённый") .. ", with short forms " ..
		lang_ru("отвлечён, отвлечена́, отвлечено́, отвлечены́") .. " when functioning as the past passive " ..
		"participle of " .. term_ru("отвле́чь", "to [[distract]], to [[divert]]") .. " but with short forms " ..
		lang_ru("отвлечён, отвлечённа, отвлечённо, отвлечённы") .. " when functioning as an adjective meaning " ..
		'"abstract". For yet other terms, there are three possibilities: special case 2 as a participle, and ' ..
		"either special case 1 or 2 as an adjective, depending on meaning. Often the meaning difference is " ..
		"between experiencing a given feeling and expressing that feeling; for example, " ..
		term_ru("влюблённый") .. " has short forms " .. lang_ru("влюблён, влюблена́, влюблено́, влюблены́") ..
		" when functioning as the past passive participle of " .. term_ru("влюби́ть", "to [[cause]] to [[fall in love]]") ..
		' and also when functioning as an adjective meaning "amorous (i.e. experiencing feelings of love, of a person)"' ..
		", but has short forms " .. lang_ru("влюблён, влюблённа, влюблённо, влюблённы") .. " when functioning as " ..
		'an adjective meaning "amorous (i.e. expressing feelings of love, of a look, tone, etc.)".',
	parents = {{name = "adjectives", sort = "Zaliznyak short form special case 2"}},
}

labels["proper-name adjectives"] = {
	description = "Russian proper names (normally, surnames) that decline as adjectives. These are similar " ..
		"to possessive adjectives and have the same endings, i.e. " .. term_ru("-ин") .. " or " ..
		term_ru("-ов") .. "/" .. term_ru("-ев") .. "/" .. term_ru("-ёв") .. ", but lack the neuter gender and " ..
		"decline slightly differently from possessive adjectives. For example, the surname " .. term_ru("По́пов") ..
		" has prepositional singular " .. term_ru("По́пове") .. ", while the possessive adjective " ..
		term_ru("сы́нов", "[[son]]'s") .. " has prepositional singular " .. term_ru("сы́новом") .. ".",
	parents = {{name = "adjectives", sort = "proper-name"}},
}

labels["short-form-only adjectives"] = {
	description = "Russian adjectives that exist '''only''' as short forms. This means they function " ..
		"only as [[Appendix:Glossary#predicative|predicative]] adjectives. Examples are " ..
		term_ru("рад", "[[glad]]") .. ", " .. term_ru("до́лжен", "[[obligated]], [[must]], [[have to]], [[ought]]") ..
		", and " .. term_ru("гора́зд", "[[skillful]], [[capable]]") .. ".",
	parents = {{name = "adjectives", sort = "short-form-only"}},
}

labels["adjectives by short accent pattern"] = {
	description = "Russian adjectives categorized according to their short accent pattern.",
	parents = {{name = "依屈折分類的形容詞", sort = "short accent pattern"}},
}

labels["adjectives by irregularity"] = {
	description = "Russian adjectives categorized according to their irregularities.",
	parents = {{name = "irregular adjectives", sort = "irregularity"}},
}


local stem_expl = {
	["軟腭音詞幹"] = "軟腭音(-к、-г或–x)",
	["噝音詞幹"] = "噝音(-ш、ж、-ч或-щ)",
	["ц-詞幹"] = "-ц",
	["i-詞幹"] = "-и(舊式-і)",
	["元音詞幹"] = "除-и或-і、或-й或-ь以外的元音",
	["軟音詞幹"] = "軟輔音",
	["硬音詞幹"] = "硬輔音",
}

local zaliznyak_stem_type = {
	["軟腭音詞幹"] = "3",
	["噝音詞幹"] = "4",
	["ц-詞幹"] = "5",
	["i-詞幹"] = "7",
	["元音詞幹"] = "6",
	["軟音詞幹"] = "2",
	["硬音詞幹"] = "1",
	["第三格"] = "8",
}

local adjective_stem_gender_endings = {
    ["陽性"] = {
		["硬音詞幹"]         = {"-ый", "-о́й"},
		["ц-詞幹"]            = {"-ый", "-о́й"},
		["軟腭音詞幹"]        = {"-ий", "-о́й"},
		["噝音詞幹"]     = {"-ий", "-о́й"},
		["long possessive"]   = {"-ий", "-и́й"},
		["short possessive"]  = {"a consonant (-ъ old-style)", "a consonant (-ъ old-style)"},
		["mixed possessive"]  = {"a consonant (-ъ old-style)", "a consonant (-ъ old-style)"},
		["proper possessive"] = {"a consonant (-ъ old-style)", "a consonant (-ъ old-style)"},
		["軟音詞幹"] = "-ий",
		["元音詞幹"] = "-ий",
	},
    ["陰性"] = {
		["硬音詞幹"]         = {"-ая", "-а́я"},
		["ц-詞幹"]            = {"-ая", "-а́я"},
		["軟腭音詞幹"]        = {"-ая", "-а́я"},
		["噝音詞幹"]     = {"-ая", "-а́я"},
		["long possessive"]   = {"-ья", "-ья́"},
		["short possessive"]  = {"-а", "-а́"},
		["mixed possessive"]  = {"-а", "-а́"},
		["proper possessive"] = {"-а", "-а́"},
		["軟音詞幹"] = "-яя",
		["元音詞幹"] = "-яя",
	},
    ["中性"] = {
		["硬音詞幹"]         = {"-ое", "-о́е"},
		["ц-詞幹"]            = {"-ее", "-о́е"},
		["軟腭音詞幹"]        = {"-ое", "-о́е"},
		["噝音詞幹"]     = {"-ее", "-о́е"},
		["long possessive"]   = {"-ье", "-ье́"},
		["short possessive"]  = {"-о", "-о́"},
		["mixed possessive"]  = {"-о", "-о́"},
		["proper possessive"] = {"-о", "-о́"},
		["軟音詞幹"] = "-ее",
		["元音詞幹"] = "-ее",
	},
	["複數"] = {
		["硬音詞幹"]         = {"-ые", "-ы́е"},
		["ц-詞幹"]            = {"-ые", "-ы́е"},
		["軟腭音詞幹"]        = {"-ие", "-и́е"},
		["噝音詞幹"]     = {"-ие", "-и́е"},
		["long possessive"]   = {"-ьи", "-ьи́"},
		["short possessive"]  = {"-ы", "-ы́"},
		["mixed possessive"]  = {"-ы", "-ы́"},
		["proper possessive"] = {"-ы", "-ы́"},
		["軟音詞幹"] = "-ие",
		["元音詞幹"] = "-ие",
	},
}

local adjective_numeral_stem_gender_endings = {
	plural = {
		["硬音詞幹"]         = {nil, "-еро"},
	}
}

local short_adjective_desc = {
	["a"] = "stem stress on all short forms",
	["aʹ"] = "stem or ending stress on the feminine singular, stem stress on the other forms",
	["b"] = "ending stress on all short forms (except the masculine singular)",
	["bʹ"] = "stem or ending stress on the plural, ending stress on the other forms (except the masculine singular)",
	["c"] = "ending stress on the feminine singular, stem stress on the other forms",
	["cʹ"] = "stem or ending stress on the plural, ending stress on the feminine singular and stem stress on the neuter singular",
	["cʺ"] = "stem or ending stress on the neuter singular and plural, ending stress on the feminine singular",
}

table.insert(handlers, function(data)
	local function fetch_endings(gender, stem, stress)
		if not adjective_stem_gender_endings[gender] then
			return nil
		end
		if stress == "possessive" then
			stem = stem .. " possessive"
			stress = "stem"
		end
		local endings = adjective_stem_gender_endings[gender][stem]
		if endings then
			if type(endings) == "string" then
				return endings
			elseif stress == "stem" then
				return endings[1]
			elseif stress == "ending" then
				return endings[2]
			end
		end
		return nil
	end

	local breadcrumb, stem, stress = rmatch(data.label, "^(([^ ]*) ([^ *]*)-stressed) adjectives")
	if not stem then
		breadcrumb, stem, stress = rmatch(data.label, "^(([^ ]*) (possessive)) adjectives")
	end
	if not stem then
		breadcrumb, stem = rmatch(data.label, "^(([^ ]*)) adjectives")
		stress = ""
	end
	if stem and (stress == "possessive" or stem_expl[stem]) then
		local stresstext = stress == "stem" and
			"This adjective has stress on the stem, corresponding to Zaliznyak's type a." or
			stress == "ending" and
			"This adjective has stress on the endings, corresponding to Zaliznyak's type b." or
			"All adjectives of this type have stress on the stem."
		local m = fetch_endings("陽性", stem, stress)
		local f = fetch_endings("陰性", stem, stress)
		local n = fetch_endings("中性", stem, stress)
		local p = fetch_endings("複數", stem, stress)
		local endingtext = "ending in the nominative in masculine singular " .. m ..
			", feminine singular " .. f .. ", neuter singular " .. n .. " and plural " .. p .. "."
		local stemtext, posstext
		if stress == "possessive" then
			posstext = " possessive"
			if stem == "long" then
				stemtext = " The stem ends in a yod, which disappears in the nominative singular but appears in all other forms as a soft sign ь followed by a vowel."
			else
				stemtext = ""
			end
		else
			posstext = ""
			stemtext = "詞幹以" .. stem_expl[stem] .. "結尾,是扎利兹尼亚克第" .. zaliznyak_stem_type[stem] .. "型。"
		end
		return {
			description = "俄語" .. stem .. posstext .. "形容詞," .. endingtext .. stemtext .. " " .. stresstext,
			breadcrumb = breadcrumb,
			parents = {"adjectives by stem type and stress"},
		}
	end

	local shortaccent = rmatch(data.label, "^adjectives with short accent pattern ([^ ]*)$")
	if shortaccent and short_adjective_desc[shortaccent] then
		local escaped_accent = rsub(shortaccent, "'", "&#39;")
		return {
			description = "Russian adjectives with short accent pattern " .. escaped_accent .. ", with " ..
				short_adjective_desc[shortaccent] .. ".",
			breadcrumb = { name = escaped_accent, nocap = true },
			parents = {{ name = "adjectives by short accent pattern", sort = shortaccent }},
		}
	end

	local irregularity = rmatch(data.label, "^adjectives with irregular (.*)$")
	if irregularity then
		return {
			description = "Russian adjectives with irregular " .. irregularity .. " (possibly along with other cases).",
			breadcrumb = irregularity,
			parents = {{ name = "adjectives by irregularity", sort = irregularity }},
		}
	end
end)


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

for _, pos in ipairs({"名詞", "代詞", "數詞"}) do
	labels["各詞幹及詞性" .. pos] = {
		description = "Russian " .. pos .. " categorized by stem type and typical gender. " ..
			"Note that \"typical gender\" means the gender that is typical for the " .. pos .. "'s ending (e.g. most " .. pos .. " in ''-а'' are " ..
			"feminine, and hence all such " .. pos .. " are considered to be \"typically feminine\"; but some are in fact masculine).",
		parents = {{name = "依屈折分類的" .. pos, sort = "詞幹及詞性"}},
	}

	labels["各詞幹、詞性及重音型" .. pos] = {
		description = "Russian " .. pos .. " categorized by stem type, typical gender and " ..
			"accent pattern. Note that \"typical gender\" means the gender that is typical for the " .. pos .. "'s ending (e.g. most " ..
			pos .. " in ''-а'' are feminine, and hence all such " .. pos .. " are considered to be \"typically feminine\"; but some are in " ..
			"fact masculine). See [[Appendix:Russian stress patterns - nouns]] for further information on accent patterns.",
		parents = {{name = "依屈折分類的" .. pos, sort = "詞幹、詞性及重音型"}},
	}

	labels[pos .. " by case form"] = {
		description = "Russian " .. pos .. " categorized according to the presence of " ..
			"an irregular case or an unusual case (locative, partitive or vocative).",
		parents = {{name = pos, sort = "case form"}},
	}

	labels["各重音型" .. pos] = {
		description = "俄語" .. pos .. "依其重音型進行分類(見[[Appendix:俄語重音型——名詞]])。",
		parents = {{name = "依屈折分類的" .. pos, sort = "重音型"}},
	}

	labels[pos .. " by singular ending"] = {
		description = "Russian " .. pos .. " categorized by the ending in the nominative " ..
			"singular. This is currently used only for certain exceptional types of endings.",
		parents = {{name = pos, sort = "singular ending"}},
	}

	labels[pos .. " by singular and plural ending"] = {
		description = "Russian " .. pos .. " categorized by nominative singular and " ..
			"plural ending. This is used only for " .. pos .. " where one one of the endings is either irregular or a declensional " ..
			"suffix such as ''-ёнок'' or ''-ин''.",
		parents = {{name = pos, sort = "singular and plural ending"}},
	}

	labels[pos .. " by plural ending"] = {
		description = "Russian " .. pos .. " categorized by the ending in the nominative " ..
			"plural. This is currently used only for certain exceptional types of endings.",
		parents = {{name = pos, sort = "plural ending"}},
	}

	labels[pos .. " with reducible stem"] = {
		description = "Russian " .. 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"}},
	}

	labels[pos .. " with multiple argument sets"] = {
		description = "Russian " .. pos .. " with multiple argument sets (i.e. which can be declined according to multiple " ..
			"declensions that differ more than just in accent pattern).",
		parents = {{name = "依屈折分類的" .. pos, sort = "multiple argument sets"}},
	}

	labels[pos .. " with multiple accent patterns"] = {
		description = "Russian " .. pos .. " with multiple accent patterns. See [[Appendix:Russian stress patterns - nouns]].",
		parents = {{name = "依屈折分類的" .. pos, sort = "multiple accent patterns"}},
	}

	labels["adjectival " .. pos] = {
		description = "Russian " .. pos .. " with adjectival endings.",
		parents = {pos},
	}

	labels[pos .. " with irregular plural stem"] = {
		description = "Russian " .. pos .. " with an irregular plural stem, which occurs in all cases.",
		parents = {{name = "irregular " .. pos, sort = "plural stem"}},
	}

	labels[pos .. " with mixed declension"] = {
		description = "Russian " .. pos .. " with mixed declension (i.e. with a different declension in the plural as compared " ..
			"with the singular).",
		parents = {{name = "irregular " .. pos, sort = "mixed declension"}},
	}

	labels[pos .. " with alternative genitive plural"] = {
		description = "Russian " .. pos .. " using a specific alternative ending in the genitive plural: for masculine " ..
			pos .. ", no ending; for feminine " .. pos .. ", ''-ей'' (when this ending isn't otherwise expected); for neuter " ..
			pos .. ", ''-ев''. These " .. pos .. " are indicated by a ② in Zaliznyak's dictionary.",
		parents = {{name = "irregular " .. pos, sort = "alternative genitive plural"}},
	}
end

local noun_stem_gender_endings = {
    ["陽性"] = {
		["硬音詞幹"]      = {"硬輔音(舊式-ъ)", "-ы"},
		["ц-詞幹"]         = {"-ц(舊式-цъ)", "-ы"},
		["軟腭音詞幹"]     = {"軟腭音(以及舊式-ъ)", "-и"},
		["噝音詞幹"]  = {"噝音(以及舊式-ъ)", "-и"},
		["軟音詞幹"]      = {"-ь", "-и"},
		["i-詞幹"]         = {"-й", "-и"},
		["元音詞幹"]     = {"-й", "-и"},
		["第三格"] = {"-ь", "-и"},
	},
    ["陰性"] = {
		["硬音詞幹"]      = {"-а", "-ы"},
		["ц-詞幹"]         = {"-а", "-ы"},
		["軟腭音詞幹"]     = {"-а", "-и"},
		["噝音詞幹"]  = {"-а", "-и"},
		["軟音詞幹"]      = {"-я", "-и"},
		["i-詞幹"]         = {"-я", "-и"},
		["元音詞幹"]     = {"-я", "-и"},
		["第三格"] = {"-ь", "-и"},
	},
    ["中性"] = {
		["硬音詞幹"]      = {"-о", "-а"},
		["ц-詞幹"]         = {"-е", "-а"},
		["軟腭音詞幹"]     = {"-о", "-а"},
		["噝音詞幹"]  = {"-е", "-а"},
		["軟音詞幹"]      = {"-е", "-я"},
		["i-詞幹"]         = {"-е", "-я"},
		["元音詞幹"]     = {"-е", "-я"},
		["第三格"] = {"-мя", "-мена"},
	},
}

table.insert(handlers, function(data)
	local function escape_accent(accent)
		return rsub(accent, "'", "&#39;")
	end

	local function get_stem_gender_text(stem, gender, pos)
		if not noun_stem_gender_endings[gender] then
			return nil
		end
		local endings = noun_stem_gender_endings[gender][stem]
		if not endings then
			return nil
		end
		local sgending, plending = endings[1], endings[2]
		local stemtext =
			stem == "第三格" and "" or
			"詞幹以" .. stem_expl[stem] .. "結尾,是扎利兹尼亚克第" .. zaliznyak_stem_type[stem] .. "型。"
		local decltext =
			stem == "第三格" and "" or
			"傳統上被認為屬於第" .. (gender == "陰性" and "1" or "2") .. "類變格。"
		return stem .. ",通常為" .. gender .. pos .. ",主格單數一般以" .. sgending .. "結尾,主格複數一般以" .. plending .. "結尾。" .. stemtext .. decltext
	end

	local stem, gender, accent, pos = rmatch(data.label, "^(.*) (.-) accent%-(.-) adjectival (.*)s$")
	if not stem then
		stem, gender, pos = rmatch(data.label, "^(.*) (.-) adjectival (.*)s$")
	end
	if stem then
		local possessive, stemtext
		local endings, sg, pl

		local function fetch_endings_1(endings_table, gender, stem, accent)
			if not endings_table[gender] then
				return nil
			end
			local endings = endings_table[gender][stem]
			if endings then
				if type(endings) == "string" then
					return endings
				elseif accent == "a" then
					return endings[1]
				elseif accent == "b" then
					return endings[2]
				end
			end
			return nil
		end

		local function fetch_endings(gender, stem, accent)
			if pos == "numeral" then
				local retval = fetch_endings_1(adjective_numeral_stem_gender_endings, gender, stem, accent)
				if retval then
					return retval
				end
			end
			return fetch_endings_1(adjective_stem_gender_endings, gender, stem, accent)
		end

		sg = fetch_endings(gender, stem, accent)
		pl = fetch_endings("複數", stem, accent)

		if rfind(stem, "possessive") then
			possessive = "possessive "
			stem = rsub(stem, " possessive", "")
			stemtext = ""
		elseif stem_expl[stem] then
			possessive = ""
			stemtext = "詞幹以" .. stem_expl[stem] .. "結尾,是扎利兹尼亚克第" .. zaliznyak_stem_type[stem] .. "型。"
		end

		if (sg or gender == "plural-only") and pl and stemtext then
			local accentdesc = accent == "a" and
				"這種" .. pos .. "采用重音型a,即在詞幹上重讀。" or
				accent == "b" and
				"這種" .. pos .. "采用重音型b,即在詞尾重讀。" or
				"All " .. pos .. "s of this class are stressed according to accent pattern a (stress on the stem)."
			local accenttext = accent and " accent-" .. accent or ""
			return {
				description = "Russian " .. stem .. " " .. gender .. " " .. pos .. "s, with " .. possessive ..
					"adjectival endings, ending in " .. (
						gender == "plural-only" and "" or sg .. " in the nominative singular and ") ..
					pl .. " in the nominative plural." .. stemtext .. " " .. accentdesc,
				breadcrumb = stem .. " " .. gender .. accenttext,
				parents = {
					{name = "adjectival " .. pos .. "s", sort = stem .. " " .. gender .. accenttext},
					pos .. "s by stem type, gender and accent pattern",
				},
			}
		end
	end

	local stem, gender, accent, pos = rmatch(data.label, "^(.-詞幹)(.性)重音型([A-Za-zʹʺ]+)(.詞)$")
	if stem then
		local stem_gender_text = get_stem_gender_text(stem, gender, pos)
		if stem_gender_text then
			local accent_text = "這種" .. pos .. "按照重音型" .. escape_accent(accent) .. "進行重讀。"
			return {
				description = "俄語" .. stem_gender_text .. accent_text,
				breadcrumb = "重音型" .. escape_accent(accent),
				parents = {
					{name = stem .. gender .. pos, sort = accent},
					"各詞幹、詞性及重音型" .. pos,
				}
			}
		end
	end

	local stem, gender, pos = rmatch(data.label, "^(.-詞幹)(.性)(.詞)$")
	if stem then
		local stem_gender_text = get_stem_gender_text(stem, gender, pos)
		if stem_gender_text then
			return {
				description = "俄語" .. stem_gender_text,
				breadcrumb = stem .. gender,
				parents = {"各詞幹及詞性" .. pos},
			}
		end
	end

	local pos, sg, pl = rmatch(data.label, "^(.*)s ending in (.*) with plural (.*)$")
	if sg then
		return {
			description = "Russian " .. pos .. "s ending in " .. sg .. " in the nominative singular, and " .. pl .. " in the nominative plural.",
			breadcrumb = {name = "singular " .. sg .. ", plural " .. pl, nocap = true},
			parents = {{name = pos .. "s by singular and plural ending", sort = sg .. " " .. pl}},
		}
	end

	local pos, sg = rmatch(data.label, "^(.*)s ending in (.*)$")
	if sg then
		return {
			description = "Russian " .. pos .. "s ending in " .. sg .. " in the nominative singular.",
			breadcrumb = {name = sg, nocap = true},
			parents = {{name = pos .. "s by singular ending", sort = sg}},
		}
	end

	local pos, pl = rmatch(data.label, "^(.*)s with plural (.*)$")
	if pl then
		return {
			description = "Russian " .. pos .. "s ending in " .. pl .. " in the nominative plural.",
			breadcrumb = {name = pl, nocap = true},
			parents = {{name = pos .. "s by plural ending", sort = pl}},
		}
	end

	local accent, pos = rmatch(data.label, "^重音型([a-zA-Zʹʺ]+)(.*)$")
	if accent then
		return {
			description = "俄語重音型" .. escape_accent(accent) .. pos .. "。",
			breadcrumb = {name = escape_accent(accent), nocap = true},
			parents = {{name = "各重音型" .. pos, sort = accent}},
		}
	end

	local pos, case = rmatch(data.label, "^(.*)s with ([a-z]+tive)$")
	if case then
		-- partitive, locative, vocative
		return {
			description = "Russian " .. pos .. "s with a separate " .. case .. " singular case.",
			breadcrumb = case,
			parents = {{name = pos .. "s by case form", sort = case}},
		}
	end

	local pos, case = rmatch(data.label, "^(.*)s with irregular (.*)$")
	if case then
		return {
			description = "Russian " .. pos .. "s with an irregular " .. case .. " case.",
			breadcrumb = case,
			parents = {{name = pos .. "s by case form", sort = case}},
		}
	end
end)


return {LABELS = labels, HANDLERS = handlers}