Module:sandbox/ne-headword

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


local export = {}
local pos_functions = {}
local links = require('Module:links')
local labels = require('Module:labels')
local m_scripts = require("Module:scripts")
local m_translit = require("Module:ne-translit")
local lang = require('Module:languages').getByCode('ne')
local sc = require("Module:scripts").getByCode("Deva")
local PAGENAME = mw.title.getCurrentTitle().text
local current_script = m_scripts.findBestScript(PAGENAME, lang)
local Deva_Newa_translit = require('Module:Deva-Newa-translit')


local rfind = mw.ustring.find
local rmatch = mw.ustring.match
local rsplit = mw.text.split
local usub = mw.ustring.sub

local gender_to_full = {
	 = "masculine",  = "feminine"
}


local function glossary_link(anchor, text)
	text = text or anchor
	return "]"
end

local function track(page)
	require("Module:debug").track("ne-utilities/" .. page)
end


-- Code ported from ].
local function add_space_word_links(space_word, split_hyphen)
	local space_word_no_punct, punct = rmatch(space_word, "^(.*)()$")
	space_word_no_punct = space_word_no_punct or space_word
	punct = punct or ""
	local words
	-- don't split prefixes and suffixes
	if not split_hyphen or rfind(space_word_no_punct, "^%-") or rfind(space_word_no_punct, "%-$") then
		words = {space_word_no_punct}
	else
		words = rsplit(space_word_no_punct, "%-")
	end
	local linked_words = {}
	for _, word in ipairs(words) do
		word = "]"
		table.insert(linked_words, word)
	end
	return table.concat(linked_words, "-") .. punct
end

local function add_lemma_links(lemma, split_hyphen)
	if not rfind(lemma, " ") then
		split_hyphen = true
	end
	local words = rsplit(lemma, " ")
	local linked_words = {}
	for _, word in ipairs(words) do
		table.insert(linked_words, add_space_word_links(word, split_hyphen))
	end
	local retval = table.concat(linked_words, " ")
	-- If we ended up with a single link consisting of the entire lemma,
	-- remove the link.
	local unlinked_retval = rmatch(retval, "^%]*)%]%]$")
	return unlinked_retval or retval
end


function export.show(frame)
	PAGENAME = mw.title.getCurrentTitle().text
	
	local poscat = frame.args or error("Part of speech has not been specified. Please pass parameter 1 to the module invocation.")
	
	local params = {
		 = {list = true},
		 = {list = true, allow_holes = true},
		 = {},
		 = {},
		 = {},

		 = {type = "boolean"},
	}

	if PAGENAME:find(" ") then
		track("space")
	end

	if pos_functions then
		for key, val in pairs(pos_functions.params) do
			params = val
		end
	end

	local parargs = frame:getParent().args
	local args = require("Module:parameters").process(parargs, params)

	local data = {lang = lang, sc = current_script,
		pos_category = poscat,
		heads = args,
		translits = args,
		categories = {},
		genders = {},
		inflections = {},
		sort_key = args,
	}

	if #data.translits > 0 then
		track("manual-translit/" .. poscat)
	end

	local heads = data.heads
	local auto_linked_head = add_lemma_links(PAGENAME, args)
	if #heads == 0 then
		data.heads = {auto_linked_head}
	else
		for _, head in ipairs(heads) do
			if head == auto_linked_head then
				track("redundant-head")
			end
		end
	end

	if pos_functions then
		pos_functions.func(args, data)
	end
return
require("Module:headword").full_headword(data)
end
pos_functions.adjectives = {
	params = {
		 = {},
		 = {},
		 = {alias_of = "comparative"},
		 = {alias_of = "superlative"},
		 = {list = true},
		 = {list = true},
		 = {type = "boolean"},
	},
	func = function(args, data)
		if args then
			table.insert(data.inflections, {label = glossary_link("indeclinable")})
			table.insert(data.categories, "Nepali indeclinable adjectives")
		end
		if args then
			table.insert(data.inflections, {label = "comparative", args})
		end
		if args then
			table.insert(data.inflections, {label = "superlative", args})
		end
		if #args > 0 then
			args.label = "masculine"
			table.insert(data.inflections, args)
		end
		if #args > 0 then
			args.label = "feminine"
			table.insert(data.inflections, args)
		end
	end,
}

local function process_genders(data, genders)
	for _, g in ipairs(genders) do
		if g == "m" or g == "f" or g == "m-p" or g == "f-p" or g == "mf" or g == "mf-p" or g == "mfbysense" or g == "mfbysense-p" or g == "?" then
			table.insert(data.genders, g)
		else
			error("Invalid gender: " .. (g or "(nil)"))
		end
	end
end


local function nouns(plpos)
	return {
		params = {
			 = {list = true, default = "?"},
			 = {list = true},
			 = {list = true},
			 = {type = "boolean"},
		},
		func = function(args, data)
			process_genders(data, args)
			if args then
				table.insert(data.inflections, {label = glossary_link("indeclinable")})
				table.insert(data.categories, "Nepali indeclinable " .. plpos)
			end
			if #args > 0 then
				args.label = "masculine"
				table.insert(data.inflections, args)
			end
			if #args > 0 then
				args.label = "feminine"
				table.insert(data.inflections, args)
			end
		end,
	}
end

pos_functions.nouns = nouns("nouns")
pos_functions = nouns("proper nouns")

pos_functions.pronouns = {
	params = {
		 = {list = true},
	},
	func = function(args, data)
		process_genders(data, args)
	end,
}

pos_functions.verbs = {
	params = {
		 = {},
		 = {list = true},
	},
	func = function(args, data)
		data.genders = args

		if args then
			local label, cat
			if args == "t" then
				label = "transitive"
				table.insert(data.categories, "Nepali transitive verbs")
			elseif args == "i" then
				label = "intransitive"
				table.insert(data.categories, "Nepali intransitive verbs")
			elseif args == "d" then
				label = "ditransitive"
				table.insert(data.categories, "Nepali ditransitive verbs")
			elseif args == "it" or args == "ti" then
				label = "ambitransitive"
				table.insert(data.categories, "Nepali transitive verbs")
				table.insert(data.categories, "Nepali intransitive verbs")
			else
				error("Unrecognized param 1=" .. args .. ": Should be 'i' = intransitive, 't' = transitive, or 'it'/'ti' = ambitransitive")
			end
			table.insert(data.inflections, {label = glossary_link(label)})
		end

		local head = data.heads
		if head:find(" ") then
			local base_verb = m_links.remove_links(head):gsub("^.* ", "")
			table.insert(data.categories, "Nepali phrasal verbs")
			table.insert(data.categories, "Nepali phrasal verbs with particle (" .. base_verb .. ")")
		end
	end,
}

local function pos_with_gender()
	return {
		params = {
			 = {list = true},
		},
		func = function(args, data)
			data.genders = args
		end,
	}
end

pos_functions.numerals = pos_with_gender()
pos_functions.suffixes = pos_with_gender()
pos_functions = pos_with_gender()
pos_functions = pos_with_gender()
pos_functions = pos_with_gender()
pos_functions = pos_with_gender()
pos_functions = pos_with_gender()
pos_functions = pos_with_gender()
function export.usex(frame)
	local args = frame:getParent().args
	local pagename = mw.title.getCurrentTitle().text
	local text = {}
	local example = args or error("Example has not been specified. Please pass parameter 1 to the module invocation.")
	local translation = args or ""
	local m_links = require("Module:links").remove_links

	if (not mw.ustring.match(example, "'''")) and mw.ustring.match(example, pagename) then
		example = mw.ustring.gsub(example, pagename, "'''" .. pagename .. "'''")
	end	
	local translit = m_translit.tr(m_links(example), "ne", "Deva")
	example = mw.ustring.gsub(example, "", "")

	table.insert(text, ('<span lang="ne" class="Deva">%s</span>'):format(example))
	if mw.ustring.match(example, "") then
		table.insert(text, "<dl><dd>''" .. translit .. "''</dd><dd>" .. translation .. "</dd></dl>")
	else
		table.insert(text, "&nbsp; ―&nbsp; ''" .. translit .. "''&nbsp; ―&nbsp; " .. translation)
	end
	return table.concat(text)
end

function export.link(frame)
	if type(frame) == "table" then
		args = frame:getParent().args
		text = args
		def = args or false
		vert = args or false
	else
		text = frame
	end
	text = ('<span lang="ne" class="Deva">", "")) .. 
		('%s]]</span>'):format(mw.ustring.gsub(text, "", "")) ..
		(vert and "<div style=\"line-height:1pt; font-size:90%; color:#888\"><br>" or " (") .. m_translit.tr(text, "ne", "Deva") .. 
		(def and ', “' .. def .. '”' or "") .. (vert and "</div>" or ")")
return text
end
return export