မာတိကာသို့ ခုန်သွားရန်

မဝ်ဂျူ:etymon/data

နူ ဝိက်ရှေန်နရဳ

Documentation for this module may be created at မဝ်ဂျူ:etymon/data/doc

local export = {}

export.STATUS = {
	OK = "ok",
	INLINE = "inline",
	MISSING = "missing",
	REDLINK = "redlink",
}

local function make_glossary_link(term, display_text)
	if not term then return display_text end
	return "[[အဆက်လက္ကရဴ:မသောၚ်ကၠးဝေါဟာ#" .. term:gsub(" ", "_") .. "|" .. display_text .. "]]"
end

local function create_keyword(opts)
	local entry = {
		is_group = opts.is_group or false,
		abbrev = opts.abbrev,
		glossary = opts.glossary,

		transitive = opts.transitive ~= false, -- default true
		inherited_chain = opts.inherited_chain or false,
		affix_categories = opts.affix_categories or false,
		borrowing_type = opts.borrowing_type,
		specialized_borrowing = opts.specialized_borrowing,
		top_level_category = opts.top_level_category,
		no_child_categories = opts.no_child_categories or false,
		source_category_type = opts.source_category_type,
		invisible = opts.invisible or false,
		pos_override = opts.pos_override,
		new_sentence = opts.new_sentence or false,
		separate_clause = opts.separate_clause or false,
	}

	-- Only set text/phrase for visible keywords
	if not opts.invisible then
		entry.phrase = opts.phrase
		if opts.text then
			if opts.glossary then
				local base_word = opts.text:match("^(.-)%s+of") or opts.text:match("^(.-)%s+from") or opts.text
				local rest = opts.text:sub(#base_word + 1)
				entry.text = make_glossary_link(opts.glossary, base_word) .. rest
			else
				entry.text = opts.text
			end
		end
	end

	return entry
end

export.keywords = {
	["from"] = create_keyword {
		text = "From", phrase = "from",
		transitive = true, inherited_chain = true,
	},
	["uder"] = create_keyword {
		text = "From", phrase = "from",
		transitive = true, top_level_category = "undefined derivations",
	},
	["inh"] = create_keyword {
		text = "မဂွံအာဲကၟာဲနူဝေါဟာ", phrase = "from", glossary = "inherited",
		transitive = true, inherited_chain = true,
	},
	["der"] = create_keyword {
		text = "မစှ်ေကၠုၚ်နူဝေါဟာ", phrase = "from", abbrev = "der.", glossary = "derived terms",
		transitive = true,
	},

	["af"] = create_keyword {
		text = "From", phrase = "from", is_group = true,
		transitive = true, affix_categories = true,
	},
	["blend"] = create_keyword {
		text = "Blend of", phrase = "a blend of", is_group = true, abbrev = "blend", glossary = "blend",
		transitive = true, affix_categories = true,
	},
	["univ"] = create_keyword {
		text = "Univerbation of", phrase = "univerbation of", is_group = true, abbrev = "univ.", glossary = "univerbation",
		transitive = true, affix_categories = true,
	},

	["bor"] = create_keyword {
		text = "မဂၠေံကေတ်လဝ်နူဝေါဟာ", phrase = "borrowed from", abbrev = "bor.", glossary = "loanword",
		transitive = true, borrowing_type = "borrowed",
	},
	["lbor"] = create_keyword {
		text = "မဂၠေံလဝ်ဗီုပြၚ်မကတ်လ္ၚတ်ကေတ်နူဝေါဟာ", phrase = "a learned borrowing from", abbrev = "lbor.", glossary = "learned borrowing",
		transitive = true, specialized_borrowing = "learned",
	},
	["obor"] = create_keyword {
		text = "Orthographic borrowing from", phrase = "an orthographic borrowing from", abbrev = "obor.", glossary = "orthographic borrowing",
		transitive = true, specialized_borrowing = "orthographic",
	},
	["slbor"] = create_keyword {
		text = "Semi-learned borrowing from", phrase = "a semi-learned borrowing from", abbrev = "slbor.", glossary = "semi-learned borrowing",
		transitive = true, specialized_borrowing = "semi-learned",
	},
	["ubor"] = create_keyword {
		text = "Unadapted borrowing from", phrase = "an unadapted borrowing from", abbrev = "ubor.", glossary = "unadapted borrowing",
		transitive = true, specialized_borrowing = "unadapted",
	},

	["calque"] = create_keyword {
		text = "Calque of", phrase = "a calque of", abbrev = "calq.", glossary = "calque",
		transitive = false, no_child_categories = true,
		specialized_borrowing = "calque",
		new_sentence = true,
	},
	["pcal"] = create_keyword {
		text = "Partial calque of", phrase = "a partial calque of", abbrev = "pcalq.", glossary = "partial calque",
		transitive = false, no_child_categories = true,
		specialized_borrowing = "partial-calque",
		new_sentence = true,
	},
	["sl"] = create_keyword {
		text = "Semantic loan of", phrase = "a semantic loan of", abbrev = "sl.", glossary = "semantic loan",
		transitive = false, no_child_categories = true,
		specialized_borrowing = "semantic-loan",
		new_sentence = true,
	},
	["influence"] = create_keyword {
		text = "Influenced by", phrase = "influenced by", abbrev = "influ.", glossary = "contamination",
		transitive = false, no_child_categories = true,
		separate_clause = true,
	},

	["clip"] = create_keyword {
		text = "Clipping of", phrase = "clipping of", abbrev = "clip.", glossary = "clipping",
		transitive = true,
	},
	["ellipsis"] = create_keyword {
		text = "Ellipsis of", phrase = "ellipsis of", abbrev = "ellip.", glossary = "ellipsis",
		transitive = true,
	},
	["bf"] = create_keyword {
		text = "Back-formation from", phrase = "a back-formation from", abbrev = "bf.", glossary = "back-formation",
		transitive = true,
		top_level_category = "back-formations",
	},
	["translit"] = create_keyword {
		text = "Transliteration of", phrase = "borrowed from", abbrev = "translit.", glossary = "transliteration",
		transitive = true,
	},
	["vrd"] = create_keyword {
		text = "Vṛddhi derivative of", phrase = "a vṛddhi derivative of", abbrev = "vṛd.", glossary = "vṛddhi derivative",
		transitive = true,
	},
	["aphetic"] = create_keyword {
		text = "Aphetic form of", phrase = "an aphetic form of", abbrev = "aph.", glossary = "aphesis",
		transitive = true,
	},
	["denominal"] = create_keyword {
		text = "Denominal verb of", phrase = "denominal verb of", abbrev = "denom.", glossary = "denominal",
		transitive = true, top_level_category = "denominal verbs",
	},
	["deverbal"] = create_keyword {
		text = "Deverbal from", phrase = "deverbal from", abbrev = "deverb.", glossary = "deverbal",
		transitive = true,
	},

	-- Invisible keywords
	["root"] = create_keyword {
		transitive = true,
		invisible = true,
		pos_override = "root",
	},
	["afeq"] = create_keyword {
		text = "From", phrase = "from", is_group = true,
		transitive = false, affix_categories = true,
		invisible = true,
	},
}

export.config = {
	lang_exceptions = {
		["zh"] = {
			disallow_tree = true,
			disallow_text = true,
			disallow_ref = "[[Wiktionary:Beer parlour/2025/May#Template:etymon for Chinese]]",
			suppress_tr = true,
			suppress_categories = true,
			normalize_to = "zh",
			normalize_from_families = { "zhx" },
			normalize_exclude_families = { "qfa-cnt" },
		},
		["fi"] = {
			keyword_overrides = {
				["af"] = { transitive = false },
			}
		},
		--[=[
		Example with all available options:
		["xx"] = {
			disallow_tree = true,                          -- Disallow etymology trees for this language
			disallow_text = true,                          -- Disallow etymology text generation for this language
			disallow_ref = "[[Wiktionary:Discussion]]",    -- Reference link shown when tree/text is disallowed
			suppress_tr = true,                            -- Suppress transliteration in links
			suppress_categories = true,                    -- Suppress all category generation
			normalize_to = "xx",                           -- Normalize language code to a different code
			normalize_from_families = { "xxx" },           -- Apply normalization to languages in these families
			normalize_exclude_families = { "yyy" },        -- Exclude these families from normalization
			keyword_overrides = {                          -- Per-keyword categorisation overrides
				["af"] = { transitive = true },            -- Override af to be transitive for this language
				["calque"] = { transitive = true },        -- Override calque to be transitive for this language
			},
		},
		]=]
	},
	colors = {
		GREY = "var(--wikt-palette-grey)",
		LIGHTGREY = "var(--wikt-palette-lightgrey)",
		BEIGE = "var(--wikt-palette-beige)",
		CYAN = "var(--wikt-palette-cyan)",
		PINK = "var(--wikt-palette-pink)",
		BLACK = "var(--wikt-palette-black)"
	},
}

return export