Пређи на садржај

Модул:category tree/poscatboiler/data/lang-specific/mt

Документацију овог модула можете да направите на страници Модул:category tree/poscatboiler/data/lang-specific/mt/док

local labels = {}
local handlers = {}

local m_table = require("Module:table")

-----------------------------------------------------------------------------
--                                                                         --
--                                   NOUNS                                 --
--                                                                         --
-----------------------------------------------------------------------------

labels["nouns by derivation type"] = {
	description = "{{{langname}}} nouns categorized by type of derivation.",
	parents = {{name = "nouns", sort = "derivation type"}},
	breadcrumb = "by derivation type",
}

labels["instance nouns"] = {
	description = "{{{langname}}} instance nouns, i.e. nouns having the meaning \"an instance of doing X\" for some verb.",
	parents = {{name = "nouns by derivation type", sort = "instance nouns"}},
	breadcrumb = "instance nouns",
}

labels["nouns of place"] = {
	description = "{{{langname}}} nouns of place, i.e. nouns having the approximate meaning \"the place for doing X\" for some verb.",
	parents = {{name = "nouns by derivation type", sort = "nouns of place"}},
	breadcrumb = "nouns of place",
}

labels["occupational nouns"] = {
	description = "{{{langname}}} occupational nouns, i.e. nouns referring to people employed in doing something.",
	parents = {{name = "nouns by derivation type", sort = "occupational nouns"}},
	breadcrumb = "occupational nouns",
}

labels["tool nouns"] = {
	description = "{{{langname}}} tool nouns, i.e. nouns having the approximate meaning \"tool for doing X\" for some verb.",
	parents = {{name = "nouns by derivation type", sort = "tool nouns"}},
	breadcrumb = "tool nouns",
}

--------------------------------- Verb labels --------------------------------

labels["verbs with quadriliteral roots"] = {
	description = "{{{langname}}} verbs built on roots consisting of four radicals (instead of the more common triliteral roots), categorized by form.",
	parents = {{name = "verbs by inflection type", sort = "quadriliteral roots"}},
	breadcrumb = "with quadriliteral roots",
}

labels["verbs by conjugation"] = {
	description = "{{{langname}}} verbs categorized by type of weakness displayed in their conjugation (as opposed to weakness determined by form, i.e. by the presence of certain \"weak\" radicals in certain positions).",
	parents = {{name = "verbs by inflection type", sort = "conjugation"}},
	breadcrumb = "by conjugation",
}

--------------------------------- Verb handlers --------------------------------

local weakness_desc = {
	["geminate"] = "the second and third radicals are identical",
	["hollow"] = "the second radical is {{lang|mt|w}} or {{lang|mt|j}}, which is replaced with a long or short vowel in some forms",
	["final-weak"] = "the last radical is {{lang|mt|w}} or {{lang|mt|j}}, normally leading to irregular endings",
	["sound"] = "none of the radicals is {{lang|mt|w}} or {{lang|mt|j}} , nor are the second and third radicals identical",
}

local weakness_desc_by_conjugation = {
	["hollow"] = "This includes verbs where the second radical is {{lang|mt|w}} or {{lang|mt|j}} and appears as a vowel in most parts of the conjugation.",
	["final-weak"] = "This includes verbs where the the last radical is {{lang|mt|w}} or {{lang|mt|j}}.",
	["sound"] = "This includes regular verbs without any irregularities.",
}

local trilit_form_to_number = {
	["I"] = 1,
	["II"] = 2,
	["III"] = 3,
	["IV"] = 4,
	["V"] = 5,
	["VI"] = 6,
	["VII"] = 7,
	["VIII"] = 8,
	["IX"] = 9,
	["X"] = 10,
}

local quadlit_form_to_number = {
	["Iq"] = 1,
	["IIq"] = 2,
}

local function form_to_sort_key(form, with_space)
	if trilit_form_to_number[form] then
		if with_space then
			return (" %02d"):format(trilit_form_to_number[form])
		else
			return "" .. trilit_form_to_number[form]
		end
	elseif quadlit_form_to_number[form] then
		if with_space then
			return (" %02dq"):format(quadlit_form_to_number[form])
		else
			return "" .. quadlit_form_to_number[form]
		end
	else
		return nil
	end
end

-- Entries for e.g. [[:Category:Maltese final-weak verbs]]. Use entries instead of a handler
-- so that children show up in [[:Category:Maltese verbs by inflection type]].
for weakness, desc in pairs(weakness_desc) do
	labels[weakness .. " verbs"] = {
		description = "{{{langname}}} verbs with " .. weakness .. " roots, where " .. desc .. ".",
		parents = {
			{name = "verbs by inflection type", sort = weakness},
		},
		breadcrumb = weakness,
	}
end

-- Entries for e.g. [[:Category:Maltese final-weak verbs by conjugation]]. Use entries instead of a handler
-- so that children show up in [[:Category:Maltese verbs by conjugation].
for weakness, desc in pairs(weakness_desc_by_conjugation) do
	labels[weakness .. " verbs by conjugation"] = {
		description = "{{{langname}}} verbs conjugated as " .. weakness .. ". " .. weakness_desc_by_conjugation[weakness],
		parents = {
			{name = "verbs by conjugation", sort = weakness},
		},
		breadcrumb = weakness,
	}
end

-- Handler for e.g. [[:Category:Maltese form-VIII verbs]].
table.insert(handlers, function(data)
	local form = data.label:match("^form%-([IVX]+q?) verbs$")
	if not form then
		return nil
	end
	local form_sort_key = form_to_sort_key(form, "with space")
	if not form_sort_key then
		return nil
	end
	local parents = {
		{name = "verbs by inflection type", sort = form_sort_key},
	}
	if form:find("q$") then
		table.insert(parents, {name = "verbs with quadriliteral roots", sort = form_sort_key})
	end
	return {
		description = "{{{langname}}} form-" .. form .. " verbs.",
		parents = parents,
		breadcrumb = "form " .. form,
	}
end)

-- Handler for [[:Category:Maltese unadapted loaned verbs]].
table.insert(handlers, function(data)
	local form = data.label:match("^unadapted loaned verbs$")
	if not form then
		return nil
	end
	local parents = {
		{name = "verbs by inflection type"},
	}
	return {
		description = "{{{langname}}} unadapted loaned verbs.",
		parents = parents,
		breadcrumb = "unadapted loaned",
	}
end)

-- Handler for e.g. [[:Category:Maltese final-weak form-VIII verbs]].
table.insert(handlers, function(data)
	local weakness, form = data.label:match("^([a-z+-]+) form%-([IVX]+q?) verbs$")
	if not weakness or not weakness_desc[weakness] then
		return nil
	end
	local form_sort_key = form_to_sort_key(form)
	if not form_sort_key then
		return nil
	end
	return {
		description = "{{{langname}}} form-" .. form .. " verbs with " .. weakness ..
		" roots, where " .. weakness_desc[weakness] .. ".",
		parents = {
			{name = "form-" .. form .. " verbs", sort = weakness},
			{name = weakness .. " verbs", sort = form_sort_key},
		},
		breadcrumb = weakness,
	}
end)

return {LABELS = labels, HANDLERS = handlers}