Module:User:Benwing2/category tree/poscatboiler/data/lang-specific/el

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

This is a private module sandbox of Benwing2, for their own experimentation. Items in this module may be added and removed at Benwing2's discretion; do not rely on this module's stability.


local labels = {}

local lang = require("Module:languages").getByCode("el")

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["1st conjugation verbs by inflection type"] = {
	description = "Greek 1st conjugation verbs, categorized by inflection type. See also [[Appendix:Greek verbs#1st_Conjugation|Appendix:Modern Greek verbs]].",
	breadcrumb = "1st conjugation",
	parents = {"verbs by inflection type"},
}

labels["1st conjugation groups"] = { -- this is[[:Category:Greek 1st conjugation groups]]
	description = "Greek 1st conjugation verb groups, listed alphabetically (Greek) by the characteristic '''ending of their [[stem]]'''.<br>See [[Appendix:Greek verbs#Vowel_ending_stems|Vowel ending]], [[Appendix:Greek verbs#Consonant_ending_stems|consonant ending]] stems at the [[Appendix:Greek verbs|Appendix:Modern Greek verbs]].",
	breadcrumb = "groups",
	parents = {"1st conjugation verbs by inflection type"}, -- [[:Category:Greek 1st conjugation verbs by inflection type]]
}


labels["vowel-stem verbs"] = {
	description = "Greek verb categories of the 1st conjugation with stems ending in a vowel. See [[Appendix:Greek verbs#Vowel_ending_stems|Appendix:Modern Greek verbs]].",
	breadcrumb = "vowel-stems",
	parents = {"1st conjugation groups"},
}

local cons_stems = {
	{"v(1)", "v<sup>1</sup>", "v1"},
	{"v(2)", "v<sup>2</sup>", "v2"},
	{"γ", "γ", "g"},
	{"z", "z", "z"},
	{"k", "k", "k"},
	{"l", "l", "l"},
	{"n", "n", "n"},
	{"pt", "pt", "pt"},
	{"p", "p", "p"},
	{"r", "r", "r"},
	{"ft", "ft", "ft"},
	{"f", "f", "f"},
}

for _, cons_stem_data in ipairs(cons_stems) do
	local cat_marker, display_form, appendix_anchor = unpack(cons_stem_data)
	labels["consonant-stem verbs in -" .. cat_marker .. "-"] = {
		description = "Greek verb categories of the 1st conjugation with stems ending in -" .. display_form .. "-. See [[Appendix:Greek verbs#" .. appendix_anchor .. "|Appendix:Modern Greek verbs]].",
		breadcrumb = {name = display_form .. "-stem", nocap = true},
		parents = {"1st conjugation groups"},
	}
end

--------------------------------- Verb group data --------------------------------

groups = {}
like_verbs = {}

--[=[

The format of a group category [[:Category:Greek verb conjugation group 'GROUP']] is as follows:

groups[GROUP] = {CONJ, SORT_KEY, PARENT_CATEGORY, DESCRIPTION}

where
-- CONJ is the conjugation class (1st, 2nd);
-- SORT_KEY is the sort key used in the conjugation-group parent category
   (e.g. [[:Category:Greek 1st-conjugation groups]]);
-- PARENT_CATEGORY is the parent category used in the breadcrumbs at the top (minus the
   word "Greek " at the beginning);
-- DESCRIPTION is the description text. COMPULSORY

In the description text, you can use templates, and you can also use the following:

-- "like<<VERB>>" expands to "[[:Category:Greek verbs conjugating like 'LINK'|'''like''']] <<VERB>>",
   where LINK is the same as VERB minus any boldface in it, and <<VERB>> is expanded as below;
-- <<VERB>> expands to "[[LINK#Greek|VERB]]", where LINK is the same as VERB minus any
   boldface in it;
-- "like(VERB)" expands to "[[:Category:Greek verbs conjugating like 'LINK'|'''like''']]"",
   where LINK is the same as VERB minus any boldface in it.


The format of a "like-verb" category [[:Category:Greek verbs conjugating like 'VERB']] is as follows:

like_verbs[VERB] = {CONJ, GROUP, BREADCRUMB_TEXT, DESCRIPTION}

where
-- CONJ is the conjugation class (1st, 2nd);
-- GROUP is the conjugation group (e.g. "κλείω", "κόβω");
-- BREADCRUMB_TEXT is text that will appear in the breadcrumb at the top (e.g. the text
   "active only verbs" in the like-verb "ισχύω" will produce the breadcrumb text
   "active only verbs, like ισχύω", while the value 'nil' (without quotes around it)
   in the like-verb "ισχύω" will result in just the breadcrumb text "ισχύω);
   -- nil,  = erases the comma
-- DESCRIPTION is not compulsory.

With like-verbs, you can leave out the BREADCRUMB_TEXT and/or DESCRIPTION. but an automatic text will be added.
]=]

-- 1st vowels [[:Category:Greek verb conjugation group 'κλείω']]  -- [[:Category:Greek verbs conjugating like 'αποκλείω']]
groups["κλείω"] = {"1st", "vowel", "vowel-stem verbs", "" }
like_verbs["αποκλείω"] = {"1st", "κλείω", nil, "" } -- breadcrumv adds an unwanted comma


groups["λύω"] = {"1st", "vowel", "vowel-stem verbs", "" }
like_verbs["διαλύω"] = {"1st", "λύω", "", ""}
like_verbs["ισχύω"] = {"1st", "λύω", "active only verbs", "" }
like_verbs["καταδύομαι"] = {"1st", "λύω", "passive only verbs",	"" }
like_verbs["φύομαι"] = {"1st", "λύω", "passive only verbs imperfective", "" }


groups["πνέω"] = {"1st", "vowel", "vowel-stem verbs", ""}
like_verbs["εμπνέω"] = {"1st", "πνέω", nil, ""}
like_verbs["επιπλέω"] = {"1st", "πνέω", "active only verbs", ""}


groups["κόβω"] = {"1st", "βω", "consonant-stem verbs in -v(1)-", "" }
like_verbs["κόβω"] = {"1st", "κόβω", nil, ""}


groups["σκάβω"] = {"1st", "βω", "consonant-stem verbs in -v(1)-", ""}
like_verbs["σκάβω"] = {"1st", "σκάβω", nil, ""}


groups["τρίβω"] = {"1st", "βω", "consonant-stem verbs in -v(1)-", "" }


groups["-εύω combinations"] = {"1st", "βω2", "consonant-stem verbs in -v(2)-",	""}
like_verbs["γοητεύω"] = {"1st", "-εύω combinations", "verbs"}


groups["δημοσιεύω"] = {"1st", "βω2", "consonant-stem verbs in -v(2)-",	""}
like_verbs["αγορεύω"] = {"1st", "δημοσιεύω", "active only verbs"}
like_verbs["δημοσιεύω"] = {"1st", "δημοσιεύω", nil,	""}
like_verbs["ερωτεύομαι"] = {"1st", "δημοσιεύω", "passive only verbs"}


groups["μαζεύω"] = {"1st", "βω2", "consonant-stem verbs in -v(2)-",	"" }
like_verbs["μαζεύω"] = {"1st", "μαζεύω"}
like_verbs["ονειρεύομαι"] = {"1st", "μαζεύω", "passive only verbs"}
like_verbs["ταξιδεύω"] = {"1st", "μαζεύω", "active only verbs"}


groups["τυλίγω"] = {"1st", "γω", "consonant-stem verbs in -γ-",	"" }
like_verbs["λήγω"] = {"1st", "τυλίγω", "only active forms"}
like_verbs["τυλίγω"] = {"1st", "τυλίγω", "active & passive forms"}


groups["-άζω, -ίζω"] = {"1st", "ζω", "consonant-stem verbs in -z-",	"" }
like_verbs["αξίζω"] = {"1st", "-άζω, -ίζω", nil, "" }
like_verbs["εργάζομαι"] = {"1st", "-άζω, -ίζω", "passive only verbs without passive perfect participle", "" }
like_verbs["καθίζω"] = {"1st", "-άζω, -ίζω", "with active forms only", "" }
like_verbs["κατεργάζομαι"] = {"1st", "-άζω, -ίζω", "with passive forms only, plus passive perfect participle",	"" }
like_verbs["ορίζω"] = {"1st", "-άζω, -ίζω", nil, "" }


groups["αγγίζω"] = {"1st", "ζω", "consonant-stem verbs in -z-",	"" }
like_verbs["αγγίζω"] = {"1st", "αγγίζω"}
like_verbs["γκαρίζω"] = {"1st", "αγγίζω", "active only verbs"}


groups["αλλάζω"] = {"1st", "ζω", "consonant-stem verbs in -z-",	"" }
like_verbs["παίζω"] = {"1st", "αλλάζω"}
like_verbs["τρομάζω"] = {"1st", "αλλάζω", "active only verbs"}


groups["πρήζω"] = {"1st", "ζω", "consonant-stem verbs in -z-", "" }

groups["περιπλέκω"] = {"1st", "κω", "consonant-stem verbs in -k-", "" }

groups["πλέκω"] = {"1st", "κω", "consonant-stem verbs in -k-", ""}
like_verbs["πλέκω"] = {"1st", "πλέκω"}

groups["-σκω"] = {"1st", "κω2", "consonant-stem verbs in -k-", "" }

groups["αγγέλλω"] = {"1st", "λω", "consonant-stem verbs in -l-", "" }
like_verbs["αναγγέλλω"] = {"1st", "αγγέλλω", "active & passive forms"}


groups["-νω"] = {"1st", "νω", "consonant-stem verbs in -n-", "" }
like_verbs["αφοσιώνομαι"] = {"1st", "-νω", "with passive forms only"}
like_verbs["δηλώνω"] = {"1st", "-νω"}
like_verbs["θυμώνω"] = {"1st", "-νω", "with active forms only"}
like_verbs["λύνω"] = {"1st", "-νω"}


groups["κλείνω"] = {"1st", "νω", "consonant-stem verbs in -n-",	""}
like_verbs["κλείνω"] = {"1st", "κλείνω"}


groups["άπτω"] = {"1st", "πτω", "consonant-stem verbs in -pt-",	"" }


groups["κόπτω"] = {"1st", "πτω", "consonant-stem verbs in -pt-", "" }


groups["καλύπτω"] = {"1st", "πτω", "consonant-stem verbs in -pt-", ""}
like_verbs["καλύπτω"] = {"1st", "καλύπτω"}


groups["κλέπτω"] = {"1st", "πτω", "consonant-stem verbs in -pt-", ""}

groups["σκάπτω"] = {"1st", "πτω", "consonant-stem verbs in -pt-", "" }

groups["λείπω"] = {"1st", "πω", "consonant-stem verbs in -p-", "" }
like_verbs["λείπω"] = {"1st", "λείπω", "active only verbs"}
like_verbs["παραλείπω"] = {"1st", "λείπω"}

groups["τρέπω"] = {"1st", "πω", "consonant-stem verbs in -p-", "" }
like_verbs["τρέπω"] = {"1st", "τρέπω"}

groups["μαρκάρω"] = {"1st", "ρω", "consonant-stem verbs in -r-", "" }
like_verbs["καλμάρω"] = {"1st", "μαρκάρω", nil,	"" }
like_verbs["μαρκάρω"] = {"1st", "μαρκάρω"}


groups["πακετάρω"] = {"1st", "ρω", "consonant-stem verbs in -r-", "" }
like_verbs["μπιζάρω"] = {"1st", "πακετάρω", "active only verbs"}
like_verbs["πακετάρω"] = {"1st", "πακετάρω"}


groups["βλάφτω"] = {"1st", "φτω", "consonant-stem verbs in -ft-", "" }


groups["αλείφω"] = {"1st", "φω", "consonant-stem verbs in -f-", "" }
like_verbs["αλείφω"] = {"1st", "αλείφω"}


groups["γράφω"] = {"1st", "φω", "consonant-stem verbs in -f-",	"" }
like_verbs["γράφω"] = {"1st", "γράφω"}


groups["στρέφω"] = {"1st", "φω", "consonant-stem verbs in -f-",	"" }
like_verbs["στρέφω"] = {"1st", "στρέφω"}


--------------------------------- Process verb group data --------------------------------

local function link_el(link, display)
	-- For some reason, boldfaced characters don't display properly when done this way.
	--return require("Module:links").full_link { lang = lang, term = link, alt = display, tr = "-" }
	return "[[" .. link .. "#Greek|" .. (display or link) .. "]]"
end

local function expand_desc(desc)
	desc = rsub(desc, "like<<(.-)>>", function(like)
		return "like(" .. like:gsub("'", "") .. ") <<" .. like .. ">>"
	end)
	desc = rsub(desc, "like%((.-)%)", function(like)
		return "[[:Category:Greek verbs conjugating like '" .. like .. "'|'''like''']]"
	end)
	desc = rsub(desc, "<<([^<>]-)|([^<>]-)>>", function(link, display)
		return link_el(link, display)
	end)
	desc = rsub(desc, "<<([^<>]-)>>", function(link)
		return link_el(link:gsub("'", ""), link)
	end)
	return mw.getCurrentFrame():preprocess(desc)
end


for group, groupdata in pairs(groups) do
	local conj, conj_sort, breadcrumb_parent, desc = unpack(groupdata)
	labels["verb conjugation group '" .. group .. "'"] = {
		description = "Greek verb categories in conjugation group '" .. group .. "', in the " .. conj .. " conjugation.",
		additional = expand_desc(desc),
		breadcrumb = { name = group, nocap = true}, 
		parents = {
			{ name = breadcrumb_parent, sort = group },
			{ name = conj .. " conjugation groups", sort = conj_sort },
		},
	}
end


for likeverb, likedata in pairs(like_verbs) do
	-- Don't use unpack because it can't handle nil in the middle (e.g. in breadcrumb_desc).
	local conj = likedata[1]
	local group = likedata[2]
	local breadcrumb_desc = likedata[3]
	local like_desc = likedata[4]
	local additional

	local desc = "Greek verbs conjugating like " .. link_el(likeverb) .. ", in the '" .. group .. "' group, " ..
		conj .. " conjugation."
	if like_desc then
		additional = expand_desc(like_desc)
	end

	local breadcrumb
	if breadcrumb_desc then
		breadcrumb = breadcrumb_desc .. ", like " .. likeverb
	else
		breadcrumb = {name = likeverb, nocap = true}
	end

	labels["verbs conjugating like '" .. likeverb .. "'"] = {
		description = desc,
		additional = additional,
		breadcrumb = breadcrumb,
		parents = {
			{ name = "verb conjugation group '" .. group .. "'", sort = likeverb },
			{ name = conj .. " conjugation verbs by inflection type", sort = likeverb },
		},
	}
end


return {LABELS = labels}