Module:accel/mk

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

This module contains new entry creation rules for Macedonian; see WT:ACCEL for an overview, and Module:accel for information on creating new rules.


return {generate = function (params, entry)
	-- Because Module:mk-pronunciation is not fully automatic,
	-- for words with irregular stress or other idiosyncrasies,
	-- manual respellings are required.
	-- Therefore, in all other cases:
	entry.pronunc = "* {{rfp|mk}}" -- Add it manually!
	local usub = mw.ustring.sub
	local vOrigPN = params.origin_pagename
	local vTargPN = params.target_pagename
	-- Macedonian adjectival participles
	if params.form == "m|sg|adj|part" then
		entry.pronunc = "* {{mk-IPA}}"
		entry.pos_header = "Participle"
		entry.head = "{{head|mk|participle}}"
		entry.declension = "{{mk-decl-adj}}"
	end
	-- Macedonian perfect participles
	if params.form == "perf|part" then
		entry.pronunc = "* {{mk-IPA}}"
		entry.pos_header = "Participle"
		entry.head = "{{head|mk|participle}}"
	end
	-- Macedonian l-participles
	if params.form == "m|sg|impf|lptcp" or params.form == "m|sg|aor|lptcp" then
		entry.pronunc = "* {{rfp|mk}}" -- Prevent wrong pron! Double check in 'Verb forms'.
		entry.pos_header = "Participle"
		entry.head = "{{head|mk|participle}}"
	elseif params.form == "f|sg|impf|lptcp" or params.form == "f|sg|aor|lptcp" or params.form == "n|sg|impf|lptcp" or params.form == "n|sg|aor|lptcp" or params.form == "pl|impf|lptcp" or params.form == "pl|aor|lptcp" then
		entry.pronunc = "* {{mk-IPA}}"
		entry.pos_header = "Participle"
		entry.head = "{{head|mk|participle form}}"
	end
	-- Verb forms
	if params.pos == "verb" then
		-- Prevent wrong pron for verbs ending in -ира.
		local vira = usub(vOrigPN, -3)
		if vira == "ира" then
			if params.form == "m|sg|impf|lptcp" or params.form == "m|sg|aor|lptcp" or params.form == "1|sg|pres" or params.form == "2|sg|pres" or params.form == "1|sg|impf" or params.form == "1|sg|aor" or params.form == "2|sg|aor" or params.form == "3|sg|aor" or params.form == "m|sg|adj|part" or params.form == "2|sg|imp" then
			entry.pronunc = "* {{rfp|mk}}" -- Add it manually!
			else
			entry.pronunc = "* {{mk-IPA}}"
			end
		else
			entry.pronunc = "* {{mk-IPA}}"
		end
		-- Correct the pron of imp forms of ref verbs.
		local vjse = usub(vTargPN, -4)
		local vimpse = usub(vTargPN, 1, -5)
		if vjse == "ј_се" or vjse == "ј се" then
			entry.pronunc = "* {{mk-IPA|" .. vimpse .. "ј‿се" .. "}}"
		elseif vjse == "и_се" or vjse == "и се" then
			entry.pronunc = "* {{mk-IPA|" .. vimpse .. "и‿се" .. "}}"
		elseif vjse == "е_се" or vjse == "е се" then
			entry.pronunc = "* {{mk-IPA|" .. vimpse .. "е‿се" .. "}}"
		elseif vjse == "ј_си" or vjse == "ј си" then
			entry.pronunc = "* {{mk-IPA|" .. vimpse .. "ј‿си" .. "}}"
		elseif vjse == "и_си" or vjse == "и си" then
			entry.pronunc = "* {{mk-IPA|" .. vimpse .. "и‿си" .. "}}"
		elseif vjse == "е_си" or vjse == "е си" then
			entry.pronunc = "* {{mk-IPA|" .. vimpse .. "е‿си" .. "}}"
		end
	end
	-- Macedonian adverbial participles
	if params.form == "adv|part" then
		entry.pos_header = "Participle"
		local vjki = usub(vTargPN, -4)
		local vjkise = usub(vTargPN, -7)
		local vap = usub(vTargPN, 1, -5)
		local vapse = usub(vTargPN, 1, -8)
		if vjki == "ајќи" then
			entry.pronunc = "* {{mk-IPA|" .. vap .. "а́јќи" .. "}}"
			entry.head = "{{head|mk|participle|head=" .. vap .. "а́јќи" .. "}}"
		elseif  vjki == "ејќи" then
			entry.pronunc = "* {{mk-IPA|" .. vap .. "е́јќи" .. "}}"
			entry.head = "{{head|mk|participle|head=" .. vap .. "е́јќи" .. "}}"
		elseif vjkise == "ајќи_се" or vjkise == "ајќи се" then
			entry.pronunc = "* {{mk-IPA|" .. vapse .. "а́јќи‿се" .. "}}"
			entry.head = "{{head|mk|participle|head=" .. vapse .. "а́јќи се" .. "}}"
		elseif  vjkise == "ејќи_се" or vjkise == "ејќи се" then
			entry.pronunc = "* {{mk-IPA|" .. vapse .. "е́јќи‿се" .. "}}"
			entry.head = "{{head|mk|participle|head=" .. vapse .. "е́јќи се" .. "}}"
		elseif vjkise == "ајќи_си" or vjkise == "ајќи си" then
			entry.pronunc = "* {{mk-IPA|" .. vapse .. "а́јќи‿си" .. "}}"
			entry.head = "{{head|mk|participle|head=" .. vapse .. "а́јќи си" .. "}}"
		elseif  vjkise == "ејќи_си" or vjkise == "ејќи си" then
			entry.pronunc = "* {{mk-IPA|" .. vapse .. "е́јќи‿си" .. "}}"
			entry.head = "{{head|mk|participle|head=" .. vapse .. "е́јќи си" .. "}}"
		end
	end
	-- Macedonian verbal nouns
	if params.form == "vnoun" then
		entry.pronunc = "* {{mk-IPA}}"
		entry.pos_header = "Noun"
		entry.declension = "{{mk-decl-noun-n-е}}"
	end
	-- Comd and supd of adj's. Prevent double entries if there are stress marks.
	-- Stress marks are supported in headword lines, but not in inflection tables.
	if params.form == "indef|m|sg|comd" or params.form == "indef|m|sg|supd" then
		entry.head = "{{head|mk|adjective form}}"
	end
	-- Noun forms. Prevent double entries if there are stress marks.
	-- Stress marks are supported in headword lines, but not in inflection tables.
	if params.form == "indef|pl|;|voc|pl" then
		if entry.pos_header == "Noun" then
			entry.head = "{{head|mk|noun form}}"
		elseif entry.pos_header == "Proper noun" then
			entry.head = "{{head|mk|proper noun form}}"
		end
	end
	-- Macedonian augmentatives (lemmas)
	if params.form == "augmentative" then
		local vaug = usub(vTargPN, 1, -2)
		local vsuf_1 = usub(vTargPN, -4)
		local vsuf_2 = usub(vTargPN, -5)
		entry.pronunc = "* {{mk-IPA}}"
		if vsuf_1 == "иште" then
			entry.etymology = "{{af|mk|" .. params.origin .. "|-иште}}"
			entry.head = "{{mk-noun|n|" .. vaug .. "а" .. "}}"
			entry.declension = "{{mk-decl-noun-n-е}}"
		elseif vsuf_2 == "етина" then
			entry.etymology = "{{af|mk|" .. params.origin .. "|-етина}}"
			entry.head = "{{mk-noun|f|" .. vaug .. "и" .. "}}"
			entry.declension = "{{mk-decl-noun-f}}"
		end
	end
	-- Macedonian adverbs (lemmas)
	-- Created via headword line.
	if params.form == "adverb" then
		entry.pos_header = "Adverb"
		entry.head = "{{mk-adv}}"
		entry.def = "{{rfdef|mk}}"
	end
end}