Module:ny

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

This module enables an entry creator for Chichewa. See {{ny-new}}.


local gsub = mw.ustring.gsub
local u = require("Module:string/char")

local export = {}

function export.new(frame)
	local title = mw.title.getCurrentTitle().text
	local args = frame:getParent().args
	local pos = args or ""
	local def = args or "{{rfdef|ny}}"
	local pos2 = args or (args and "" or false)
	local def2 = args or "{{rfdef|ny}}"
	local pos3 = args or (args and "" or false)
	local def3 = args or "{{rfdef|ny}}"
	local etym = args or false
	local head = args or false
	local cat = args or false
	local usage = args or false
	local class = args or false
	local plural = args or false
	local class2 = args or false
	local plural2 = args or false
	local class3 = args or false
	local plural3 = args or false
	
	local result = ""
	
	local function genTitle(text)
		local pos_title = {
			 = "Noun",  = "Noun",  = "Proper noun",  = "Proper noun",  = "Pronoun",
			 = "Verb",  = "Verb",  = "Adjective",  = "Adjective",  = "Adverb",
			 = "Preposition",  = "Postposition",  = "Conjunction",
			 = "Particle",  = "Suffix",
			 = "Proverb",  = "Idiom",  = "Phrase",  = "Interjection",  = "Interjection",
		     = "Numeral",  = "Abbreviation",  = "Determiner"
		};
		return pos_title or mw.ustring.upper(mw.ustring.sub(text, 1, 1)) .. mw.ustring.sub(text, 2, -1)
	end
	
	local function genHead(text)
		local pos_head = {
			 = "noun",  = "noun",  = "proper noun",  = "proper noun",  = "verb",  = "verb form",  = "adj",
			 = "preposition",  = "con",  = "particle",  = "pronoun",
			 = "proverb",  = "idiom",  = "phrase",  = "interj",
			 = "abbr",  = "det"
		};
		return pos_head or text
	end
	
	local function other(class, title, args)
		local code = ""
		if args then
			if (mw.ustring.gmatch(args, "^-")) then
				code = code .. "\n\n===" .. title .. "===\n* {{l|ny|" .. gsub(args, "^-", "") .. "|" .. args .. "}}"
			else
				code = code .. "\n\n===" .. title .. "===\n* {{l|ny|" .. args .. "}}"
			end
		end
		for i=1,6 do
			if args then
				if (mw.ustring.gmatch(args, "^-")) then
					code = code .. "\n* {{l|ny|" .. gsub(args, "^-", "") .. "|" .. args .. "}}"
				else
					code = code .. "\n* {{l|ny|" .. args .. "}}"
				end
			end
		end
		return code
	end
	
	result = result .. "==Chichewa=="
	if args then result = result .. "\n{{wikipedia|lang=ny" .. 
		(args == "y" and "" or "|" .. args) .. "}}" end
	result = result .. other("alt", "Alternative forms", args)
	
	if etym then result = result .. "\n\n===Etymology===\n" .. etym end
	
	result = result .. "\n\n===Pronunciation===\n* {{ny-IPA" .. (head and ("|" .. require("Module:links").remove_links(head)) or "") .. "}}"
	
	result = result .. "\n\n===" .. genTitle(pos) .. "===\n{{ny-" .. genHead(pos) .. (head and ("|" .. gsub(head,"()'","%1")) or "") .. (class and ("|" .. class) or "") .. (plural and ("|" .. plural) or "") .. "}}\n\n# " .. def
	
	result = result .. other("syn", "=Synonyms=", args)
	result = result .. other("ant", "=Antonyms=", args)
	result = result .. other("rel", "=Related terms=", args)
	result = result .. other("der", "=Derived terms=", args)
	if vder then result = result .. "\n\n====Derived terms====\n" .. vder end
	result = result .. other("also", "=See also=", args)
	
	if usage then result = result .. "\n\n====Usage notes====\n" .. usage end
	
	if pos2 then
		result = result .. "\n\n===" .. genTitle(pos2) .. "===\n{{ny-" .. genHead(pos2) .. (head and ("|head=" .. gsub(head,"()'","%1")) or "") .. (class2 and ("|" .. class2) or "") .. (plural2 and ("|" .. plural2) or "") .. "}}\n\n# " .. def2
	end
	
	if pos3 then
		result = result .. "\n\n===" .. genTitle(pos3) .. "===\n{{ny-" .. genHead(pos3) .. (head and ("|head=" .. gsub(head,"()'","%1")) or "") .. (class3 and ("|" .. class3) or "") .. (plural3 and ("|" .. plural3) or "") .. "}}\n\n# " .. def3
	end
	
	if cat then result = result .. "\n\n{{C|ny|" .. cat .. "}}" end
	
	return result
end

function export.acute_on_first_vowel(frame)
	local word = frame.args
	if not word then
		return ""
	end
	-- Decompose word, find first vowel, add acute to it if it doesn't have one,
	-- remove second return value.
	-- Recomposing unnecessary.
	local acute = u(0x0301)
	return (gsub(
		mw.ustring.toNFD(word),
		"()" .. acute .. "?",
		"%1" .. acute,
		1))
end

return export