Module:sandbox/ug-headword

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


local export = {}
local m_com = require("Module:ug-common")
local pos_functions = {}

local lang = require("Module:languages").getByCode("ug")

-- The main entry point.
-- This is the only function that can be invoked from a template.
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, default = ""},
		 = {type = "boolean"},
	}
	
	if pos_functions then
		for key, val in pairs(pos_functions.params) do
			params = val
		end
	end
	
	local args = require("Module:parameters").process(frame:getParent().args, params)
	local data = {lang = lang, pos_category = poscat, categories = {}, heads = args, inflections = {enable_auto_translit = true}}
	
	if args then
		data.pos_category = "suffixes"
		
		if poscat == "adjectives" then
			table.insert(data.categories, lang:getCanonicalName() .. " adjective-forming suffixes")
		elseif poscat == "adverbs" then
			table.insert(data.categories, lang:getCanonicalName() .. " adverb-forming suffixes")
		elseif poscat == "nouns" then
			table.insert(data.categories, lang:getCanonicalName() .. " noun-forming suffixes")
		elseif poscat == "verbs" then
			table.insert(data.categories, lang:getCanonicalName() .. " verb-forming suffixes")
		else
			error("No category exists for suffixes forming " .. poscat .. ".")
		end
	end
	
	if pos_functions then
		pos_functions.func(args, data)
	end
	
	return require("Module:headword").full_headword(data)
end

function export.make_plural_noun(singular, vv)
	local base, v, c = m_com.getLast(singular)
	if not v then return {} end
	--if change == "yes" then
		if c == "" and vv ~= nil and vv ~= "" then
			v = vv
		--else
		--	if c == "" and (v == "ا" or v == "ە") then
		--		v = "ى"
		--	end
		end
	--end
	local term = base .. v .. c
	local tongue = m_com.checkTongue(singular)
	if tongue == "front" then
		return {term .. "لەر"}
	elseif tongue == "back" then
		return {term .. "لار"}
	end
	return {}
end

pos_functions = {
	params = {
		 = {list = true, allow_holes = true},
		 = {}, --plural override (Outdated)
		 = {}, -- yes or (else:no) (Outdated)
		},
	func = function(args, data)
		-- Gather all the plural parameters from the numbered parameters.
		local plurals = {}
		
		for i = 1, args.maxindex do
			local pl = args
			
			if pl then
				table.insert(plurals, pl)
			end
		end
		
		-- Decide what to do next...
		local mode = nil
		if plurals == "?" or plurals == "!" or plurals == "-" or plurals == "~" then
			mode = plurals
			table.remove(plurals, 1)  -- Remove the mode parameter
		end
		
		-- Plural is unknown
		if mode == "?" then
			table.insert(data.categories, lang:getCanonicalName() .. " nouns with unknown or uncertain plurals")
			return
		-- Plural is not attested
		elseif mode == "!" then
			table.insert(data.inflections, {label = "plural not attested"})
			table.insert(data.categories, lang:getCanonicalName() .. " nouns with unattested plurals")
			return
		-- Uncountable noun; may occasionally have a plural
		elseif mode == "-" then
			table.insert(data.categories, lang:getCanonicalName() .. " uncountable nouns")
			
			-- If plural forms were given explicitly, then show "usually"
			--if #plurals > 0 then
				table.insert(data.inflections, {label = "usually ]"})
				table.insert(data.categories, lang:getCanonicalName() .. " countable nouns")
			--else
			--	table.insert(data.inflections, {label = "]"})
			--end
		-- Mixed countable/uncountable noun, always has a plural
		elseif mode == "~" then
			table.insert(data.inflections, {label = "] and ]"})
			table.insert(data.categories, lang:getCanonicalName() .. " uncountable nouns")
			table.insert(data.categories, lang:getCanonicalName() .. " countable nouns")
			
		-- The default, always has a plural
		else
			table.insert(data.categories, lang:getCanonicalName() .. " countable nouns")
		end
		
		--change
		--local change = args or "yes"
		--if plurals == "no" then
		--	change = plurals
		--	table.remove(plurals, 1)  -- Remove the change parameter
		--end
		
		--vowel
		local vv = nil
		if plurals == "i" or plurals == "ى" then
			vv = "ى"
			table.remove(plurals, 1)  -- Remove the vowel parameter
		end
		
		local stem = PAGENAME
		-- If no plural was given, add a default one now
		if #plurals == 0 then
			local pl = args or nil
			if pl then 
				plurals = {pl}
			else
				plurals = export.make_plural_noun(stem, vv, change)
			end
			if #plurals == 0 then
				table.insert(data.categories, lang:getCanonicalName() .. " nouns with unpredictable plurals")
			end
		end
		if #plurals == 0 then
			return
		end
			
		-- There are plural forms to show, so show them
		local pl_parts = {label = "impersonal nominative plural"}
		
		for i, pl in ipairs(plurals) do
			if pl == "a" or pl == "ا" or pl == "lar" or pl == "لار" then
				pl = stem .. "لار"
			elseif pl == "e" or pl == "ە" or  pl == "ler" or pl == "لەر" then
				pl = stem .. "لەر"
			end
			table.insert(pl_parts, pl)
			if pl and not mw.title.new(pl).exists then
				table.insert(data.categories, lang:getCanonicalName() .. " nouns with missing plurals")
			end
		end
		
		table.insert(data.inflections, pl_parts)	
			
	end
}

return export