Module:ms-derivations

Hello, you have come here looking for the meaning of the word Module:ms-derivations. In DICTIOUS you will not only get to know all the dictionary meanings for the word Module:ms-derivations, but we will also tell you about its etymology, its characteristics and you will know how to say Module:ms-derivations in singular and plural. Everything you need to know about the word Module:ms-derivations you have here. The definition of the word Module:ms-derivations will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofModule:ms-derivations, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.

Malay affix-derived forms module. See {{ms-der}}.


local export = {}
local gsub = mw.ustring.gsub

function export.affix_table(text)
	return {
		--noun-producing
		 = { "-el-", "-el-", "nonproductive", "agentive and instrumental / resultative" },
		 = { "-er-", "-er-", "nonproductive", "resultative" },
		 = { "-em-", "-em-", "nonproductive", "resultative / variety" },
		 = { "peN-", "peng-", "productive", "agentive / qualitative / instrumental / abstract / measure" },
		 = { "pe-", "pe-", "nonproductive", "passive / name of profession" },
		 = { "ke-", "ke-", "nonproductive", "passive" },
		 = { "pra-", "pra-", "nonproductive", "(from Sanskrit)" },
		 = { "-an", "-an", "productive", "resultative / locative / collective / variety / verbal noun / fruit" },
		 = { "-Man", "-man", "nonproductive", "agent" },
		 = { "-is", "-is", "nonproductive", "agent" },
		 = { "-isme", "-isme", "nonproductive", "ideology" },
		 = { "ke-an", "ke- -an", "productive", "abstract / locative" },
		
		--verb-producing
		 = { "-el-", "-el-", "nonproductive", "intensity" },
		 = { "-em-", "-em-", "nonproductive", "intensity" },
		 = { "-er-", "-er-", "nonproductive", "intensity" },
		 = { "-", "-", "productive", "reduplication" },
		 = { "se-", "se-", "productive", "comparability" },
		 = { "ke-", "ke-", "nonproductive", "intensity" },
		 = { "-an", "-an", "nonproductive", "repetition / reciprocity" },
		 = { "ke-an", "ke- -an", "productive", "resemblance / passive" },
		 = { "peR-", "per-", "productive", "causative passive" },
		 = { "-kan", "-kan", "productive", "causative benefactive" },
		 = { "-i", "-i", "productive", "causative (locative) benefactive" },
		 = { "meN-", "meng-", "productive", "agent focus" },
		 = { "di-", "di-", "productive", "patient focus" },
		 = { "teR-", "ter-", "productive", "agentless action" },
		 = { "beR-", "ber-", "productive", "stative / habitual" },
		 = { "mempeR-", "memper-", "productive", "causative agent focus" },
		 = { "dipeR-", "diper-", "productive", "causative passive focus" },
		
		--adverb-producing
		 = { "-el-", "-el-", "nonproductive", "longer timespan" },
		 = { "-em-", "-em-", "nonproductive", "longer timespan" },
		 = { "-er-", "-er-", "nonproductive", "longer timespan" },
		 = { "-", "-", "productive", "reduplication" },
		 = { "se-", "se-", "nonproductive", "immediacy / habitual" },
		 = { "-an", "-an", "nonproductive", "timespan / emotion" },
	}
end

local pattern_replacements = {
	)"] = "%1", 
	)"] = "m%1", 
	 = "m", 
	 = "n",
	)"] = "n%1", 
	)"] = "ng%1", 
	 = "ng", 
	 = "ny",
	 = "r",
	 = "w",
}

local letter_replacements = {
	 = "m",  = "ng",  = "r"
}

function export.affixation(text, affix)
	if affix == "-" then
		text = text .. "-" .. text
	elseif mw.ustring.match(affix, "^%-.+%-$") then
		first_consonant = mw.ustring.match(text, "^+")
		text = first_consonant .. mw.ustring.sub(affix, 2, -2) .. mw.ustring.sub(text, mw.ustring.len(first_consonant) + 1, -1)
	else
		text = gsub(affix, "%-", "#" .. text)
		text = gsub(text, "N(*)()(*)$", "nge%1%2%3")
		text = gsub(text, "meN#p", "mem")
		for pattern, replacement in pairs(pattern_replacements) do
			text = gsub(text, pattern, replacement)
		end
		text = gsub(text, "#?", letter_replacements)
		text = gsub(text, "#", "")
	end
	return text
end

function export.show(frame)
	local args = frame:getParent().args
	local p, derivations = {}, {}
	local title = args or mw.title.getCurrentTitle().text
	local lang = frame.args
	args = nil
	
	if args then
		for index, item in ipairs(args) do
			table.insert(p, (item ~= "") and item or nil)
		end
		local language = args or "ms"
		local m_links, lang = require("Module:links"), require("Module:languages").getByCode(language)
		local first_affix, first_others = true, true
		
		table.insert(derivations, 
			'<div class="NavFrame">\n<div class="NavHead" style="line-height:200%">Affixed terms and other derivations' ..
			'</div>\n<div class="NavContent" style="text-align:left; background-color:#F5F5FF; font-size:105%">\n')
		
		for _, affix in ipairs(p) do
			affix = mw.ustring.gsub(affix, "\n$", "")
			local word, meaning, final_form = title, nil, nil
			if mw.ustring.match(affix, ":") then
				local xplet = mw.text.split(affix, ":")
				if #xplet == 3 then
					affix, final_form, meaning = xplet, xplet, xplet
				else
					affix, meaning = xplet, xplet
				end
			end
			
			if mw.ustring.match(affix, "") then
				if first_affix then
					table.insert(derivations, "''Regular affixed derivations:''")
				end
				local records, notes = {}, {}
				for number in mw.text.gsplit(affix, "+") do
					local number = tonumber(number) or number
					local data = export.affix_table("") or { number, nil, nil }
					word = export.affixation(word, data)
					if args == "id" then
						table.insert(records, data ~= "-" and "'' .. "#Indonesian|" .. data .. "]]''" or "''redup''")
					else
						table.insert(records, data ~= "-" and "'' .. "#Malay|" .. data .. "]]''" or "''redup''")
					end
					table.insert(notes, data)
				end
				table.insert(derivations, "* " .. m_links.full_link({lang = lang, term = final_form or word, gloss = meaning or nil}) .. " <small> (" .. table.concat(records, " + ") .. ") </small>")
				first_affix = false
			else
				if first_others then
					table.insert(derivations, "''Irregular affixed derivations, other derivations and compound words:''")
				end
				word = affix
				first_others = false
				table.insert(derivations, "* " .. m_links.full_link({lang = lang, term = word, gloss = meaning or nil}))
			end
		end
		return table.concat(derivations, "\n") .. "</div></div>"
	end
	
	return ""
end

return export