Module:ug-decl-noun

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

This module needs documentation.
Please document this module by describing its purpose and usage on the documentation page.

local export = {}
local m_com = require("Module:ug-common")
local m_case = require("Module:ug-noun")
local lang = require("Module:languages").getByCode("ug")
local m_links = require("Module:links")
--local m_utilities = require("Module:utilities")

local match = mw.ustring.match

local PAGENAME = mw.title.getCurrentTitle().text

function export.get_args(frame)
	local args
	if frame.args then
		args = frame.args
	else
		args = frame:getParent().args
	end
end
	
function export.get_word(frame)
	local args
	if frame.args then
		args = frame.args
	else
		args = frame:getParent().args
	end
	local vv = args
	local str = args or PAGENAME
	local base, v, c = m_com.getLast(str)
	if not v then return {} end
	local tongue = nil
	local v1 = v; v2 = v; c1 = c; c2 = c
	local categories = {}
	if vv then
		if (vv == "ا" or vv == "ە") and (v == "ې" or v == "ى") then
			if vv == "ا" then tongue = "back" end
			if vv == "ە" then tongue = "front" end
		else
	    	if c == "" then -- open
		    	if (v == "ا" or v == "ە") then
			    	v1 = vv
		    		if (vv == "ا" or vv == "ە") then
		    			c2 = "ي"
			    		table.insert(categories, "Uyghur nouns ending in " .. v .. " with no change")
		    		else
			    		table.insert(categories, "Uyghur nouns ending in " .. v .. " change to " .. vv)
		    		end
		    	elseif (v == "ې" or v == "ى") then
		    		v2 = vv
		    		table.insert(categories, "Uyghur nouns ending in " .. v .. " change to " .. vv)
		    	else
		    		v2 = vv; c2 = "ي"
		    	end
		    else --close
		    	if (v == "ا" or v == "ە") then
		    		v2 = vv
		    	elseif vv == "-" then
		    		v2 = ""
		    	end
		    end
		end
	else
		if c == "" and not (v == "ې" or v == "ى") then -- open
	    	c2 = "ي"
	    end
	end
	if not tongue then
		tongue = m_com.checkTongue(str)
	end
	
	--alll params
	local ae, iuu
	local ghqgk, ghg, dt
	local consonJsiz = "پتچخسشفقكھ"
	local consonJliqSpecial = "غگبد"
	
	if tongue == "front" or tongue == "f" then
		ae = "ە"
		ghg = "گ"
		if match(c, "$" ) then
			ghqgk = "ك"
		else
			ghqgk = "گ"
		end
	elseif tongue == "back" or tongue == "b" then
		ae = "ا"
		ghg = "غ"
		if match(c, "$" ) then
			ghqgk = "ق"
		else
			ghqgk = "غ"
		end
	end
	if match(c, "$" ) then
		dt = "ت"
	else
		dt = "د"
	end
	local temp_v = v2
	if temp_v == "" then temp_v = v end
	if match(temp_v, "$" ) then
		iuu = "ى"
	elseif match(temp_v, "$" ) then
		iuu = "ۇ"
	elseif match(temp_v, "$" ) then
		iuu = "ۈ"
	end
	return {str = str, base = base, tongue = tongue, c = c, v = v, c1=c1, v1 = v1, c2 = c2, v2 = v2, ae=ae, ghqgk = ghqgk, ghg=ghg, dt=dt, iuu=iuu,categories = categories }
end

function export.noun(frame)
	local word = export.get_word(frame)
	local data = export.createCases(word)
	export.link(data)
	return m_case.make_table(data)
end

function export.createCases(word)
	local data = {
		forms = {},
		}
	if word.tongue == "" or word.tongue == "central" or word.tongue == nil then
		-- cat no tongue
	else
		local root1 = word.base .. word.v1 .. word.c1
		local root2 = word.base .. word.v2 .. word.c2
		local iuu 
		if word.c2 == "" then iuu = "" else iuu = word.iuu end
		
		--imp
		export.createCase(data, "imp", word.str, root1, root1 .. "ل" .. word.ae .. "ر", word.ae, word.dt, word.ghqgk, word.ghg)
		--1st person singular
		local sl = root2 .. iuu .. "م"; local pl = root1  .. "لىرىم"
		export.createCase(data, "p1s", sl, sl, pl, word.ae, "د", word.ghg, word.ghg)
		--2nd person singular ordinar
		sl = root2 .. iuu .. "ڭ"; pl = root1  .. "لىرىڭ"
		export.createCase(data, "p2so", sl, sl, pl, word.ae, "د", word.ghg, word.ghg)
		--2nd person plural ordinar
		sl = root2 .. iuu .. "ڭلار"; pl = root1  .. "لىرىڭلار"
		export.createCase(data, "p2po", sl, sl, pl, word.ae, "د", word.ghg, word.ghg)
		--1st person plural
		if word.c2 == "" then sl = root1 .. "مىز" else sl = root2 .. "ىمىز" end
		pl = root1  .. "لىرىمىز"
		export.createCase(data, "p1p", sl, sl, pl, word.ae, "د", word.ghg, word.ghg)
		--2st person singular refined
		if word.c2 == "" then sl = root1 .. "ڭىز" else sl = root2 .. "ىڭىز" end
		pl = root1  .. "لىرىڭىز"
		export.createCase(data, "p2sr", sl, sl, pl, word.ae, "د", word.ghg, word.ghg)
		--2st person plural refined
		if word.c2 == "" then sl = root1 .. "ڭىزلار" else sl = root2 .. "ىڭىزلار" end
		pl = root1  .. "لىرىڭىزلار"
		export.createCase(data, "p2pr", sl, sl, pl, word.ae, "د", word.ghg, word.ghg)
		--2st person singular & plural respectful
		sl = root1 .. "لىرى"
		pl = root1 .. "لىرى"
		export.createCase(data, "p2spr", sl, sl, pl, word.ae, "د", word.ghg, word.ghg)
		--3st person
		if word.c2 == "" then sl = root1 .. "سى" else sl = root2 .. "ى" end
		pl = root1  .. "لىرى"
		export.createCase(data, "p3", sl, sl, pl, word.ae, "د", word.ghg, word.ghg)
	end
	return data
end

function export.createCase(data, short, str, root1, root2, ae, dt, ghqgk, ghg)
	data.forms = str
	data.forms = root2
	data.forms = root1 .. "نىڭ" ;
	data.forms = data.forms .. "نىڭ"
	if not short:find("_") then
		export.createCase(data, short .. "_gen", data.forms .. "كى",  data.forms .. "كى", data.forms .. "كى", "ە", "د","گ" , "گ")
	end
	data.forms = root1 .. "نى" ;
	data.forms = data.forms .. "نى"
	data.forms = root1 .. ghqgk .. ae ;
	data.forms = data.forms .. ghg .. ae
	data.forms = root1 .. dt .. ae ;
	data.forms = data.forms  .. "د" .. ae
	data.forms = root1 .. dt .. "ىن" ;
	data.forms = data.forms  .. "دىن"
	if short:find("_lqu") then
		data.forms = "—" ;
		data.forms = "—" ;
	else
		data.forms = root1 .. dt .. "ىكى" ;
		data.forms = data.forms  .. "دىكى"
		export.createCase(data, short .. "_lqu",  data.forms , data.forms , data.forms , "ە", "د","گ" , "گ")
	end
	data.forms = root1 .. ghqgk .. "ىچە" ;
	data.forms = data.forms  .. ghg .. "ىچە"
	data.forms = root1 .. dt .. "ەك" ;
	data.forms = data.forms  .. "دەك"
	data.forms = { root1 .. "چىلىك" , root1 .. "چە" }
	data.forms = {data.forms  .. "چىلىك", data.forms  .. "چە"}
	data.forms = root1 .. "نىڭكى" ;
	data.forms = data.forms .. "نىڭكى"
	if not short:find("_") then
		export.createCase(data, short .. "_rep", data.forms,  data.forms, data.forms , "ە", "د","گ" , "گ")
	end
	return forms
end

function export.link(data)
	for key,val in pairs(data.forms) do
		if type(val) ~= "table" then
			val = {val}
		end
		local newval = {}
		for i,form in ipairs(val) do
			local newform = form
			if not mw.ustring.match(key,"nolink") and not mw.ustring.match(form,"—") then
				newform = m_links.full_link({term = form, lang = lang})
			end
			if mw.ustring.match(form, "—") then
				newform = "—"
			end
			table.insert(newval, newform)
		end
		data.forms = table.concat(newval, " or ")
	end
end

return export