Module:lzz-dec-noun

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


local export = {}
--local lzz_translit = require("Module:lzz-translit"); --to be deleted

local lang = require("Module:languages").getByCode("lzz")
local full_link = require("Module:links").full_link
local strutils = require("Module:string utilities")
local declensionTable = require("Module:lzz-dec-noun/declension table")

--unicode charAt
function uCharAt(str, index)
	return mw.ustring.sub(str, 1, 1)
end



rules = {}
rules =  {
     = "ი",
     = "იქ",
     = "ის",
     = "იშ",
     = "იშე",
     = "იშენ",
     = "ის",
     = "ითენ",
}
rules =  {
     = "",
     = "ქ",
     = "ს",
     = "შ",
     = "შე",
     = "შენ",
     = "ს",
     = "თენ"
}

local CumaRule =  {
     = "ლეფე",
     = "ლეფექ",
     = "ლეფეს",
     = "ლეფეშ",
     = "ლეფეშე",
     = "ლეფეშენ",
     = "ლეფეს",
     = "თენ"
}

local modernPluralRule =  {
     = "",
     = "ქ",
     = "ს",
     = "შ",
     = "შე",
     = "შენ",
     = "ს",
     = "თენ",
}

function init()
	forms = {}
	
	definers = {}
	word = nil
	genstem = nil
	term = nil
	
	lplural = false
	noplural = false
	givenname = false
	noarchaic = false
	nosingular = false

	wordType = nil

	DEFINERS = {}

	terms = nil
	
	--
	
	STEM_SG = nil
	STEM_SG_ADV = nil
	STEM_SG_GEN_INST = nil
	STEM_PL = nil
	RULE = nil
	NOSINGULAR = nil
	lplural = nil
	NOPLURAL = nil
	NOARCHAIC = nil
end

function export.getForms(args)
	main(args, 1)
	local combined = {}
	for k, v in pairs(forms) do
		combined = mw.ustring.gsub(v, "[%[%}}", "")
	end
	return combined
end

--function export.test(args, form)
--	main(args, 1)
--	return mw.ustring.gsub(forms, "[%[%}}", "")
--end

function export.show(frame)
	if mw.text.split(mw.title.getCurrentTitle().prefixedText, ":") == "Template" then  return "" end
	local args = frame:getParent().args
	main(args, 0)
	for i, v in pairs(forms) do
		if mw.ustring.find(v, "%(") then
			forms = full_link {
				lang = lang,
				term = mw.ustring.gsub(v, "%(.-%)", ""),
				alt = v
			}
		else
			forms = full_link { lang = lang, term = v }
		end
	end
	return strutils.format(declensionTable.template, forms) .. ""
end

function main(args)
	init()
	term = args.term or mw.title.getCurrentTitle().text --'term' arg is for debug and testing purposes
	
	terms = mw.text.split(term, " ")
	if #terms == 1 then 
		word = term
	else
		word = terms
		table.remove(terms, #terms)
		definers = terms
	end
	
	local i = 1
	
	if args ~= nil and (args == "" or mw.ustring.find(args, "") ~= nil) then
		genstem = args
		if genstem == "" then genstem = word end
		i = i + 1
	end
	
	local params = {}
	params = false
	params = false
	params = false
	params = false
	params = false
	
	local newarg = args 
	while newarg ~= nil do
		if newarg == "-" then newarg = "noplural" end
		
		params = true
		newarg = args
		i = i + 1
	end
	
	while newarg ~= nil do
		if newarg == "l" then newarg = "lplural" end
		
		params = true
		newarg = args
		i = i + 1
	end
	
	lplural    = params
	noplural   = params
	givenname  = params
	noarchaic  = params 
	nosingular = params
	
	analyze()
	deriveDefiners()
	fillTable()
	
	override(args)
	
	
	forms = ""
end



function analyze()
	--initializing defaults for all endings
	if nosingular then NOSINGULAR = "" end
	if noplural or givenname then NOPLURAL = "" end
	if noarchaic then NOARCHAIC = "" end
	--end defaultization xD
	
	local lastLetter = mw.ustring.sub(word, -1)
	if lastLetter == "ი" then
		STEM_SG = mw.ustring.sub(word, 0, -2)
		STEM_SG_GEN_INST = genstem or STEM_SG
		STEM_SG_ADV = genstem or STEM_SG
		
		STEM_PL = genstem or STEM_SG
		
		wordType = "მცხული"
		
		if givenname then
		end
		if genstem ~= nil then
			if #genstem == #word then
				STEM_SG = genstem
				wordType = "მცხული"
				if not givenname then
					STEM_PL = mw.ustring.sub(word, 0, -2); --rules : "მცხული"
				end
			end
		else
			if givenname then
				wordType = "ნჯა"
			end
		end
		RULE = rules
	elseif lastLetter == "ა" and lplural == true then
		STEM_SG = mw.ustring.sub(word, 0, -2)
		STEM_SG_GEN_INST = genstem or STEM_SG
		STEM_SG_ADV = genstem or STEM_SG
		
		STEM_PL = genstem or STEM_SG
		
		RULE = rules
	elseif lastLetter == "ა" or lastLetter == "ე" or lastLetter == "ო" or lastLetter == "უ" then 
		STEM_SG = word
		STEM_SG_GEN_INST = mw.ustring.sub(word, 0, -2)
		STEM_SG_ADV = word
		STEM_PL = word
		
		
		wordType = "ნჯა"
		if givenname then
			STEM_SG_GEN_INST = word
			wordType = "ნჯა"
		elseif genstem ~= nil then
			STEM_SG_GEN_INST = genstem
			wordType = "ნჯა"
			if #genstem ~= #word then
				STEM_SG_ADV = genstem .. "ა"
				STEM_PL = genstem
				wordType = "ნჯა"
			else
			end
		end
		
	RULE = rules
end



function fillTable()
	forms = term
	
	forms = NOSINGULAR or "" .. DEFINERS .. STEM_SG ..          RULE .. ""
	forms = NOSINGULAR or "" .. DEFINERS .. STEM_SG ..          RULE .. ""
	forms = NOSINGULAR or "" .. DEFINERS .. STEM_SG ..          RULE .. ""
	forms = NOSINGULAR or "" .. DEFINERS .. STEM_SG ..          RULE .. "(ი)"
	forms = NOSINGULAR or "" .. DEFINERS .. STEM_SG ..          RULE .. "" 
	forms = NOSINGULAR or "" .. DEFINERS .. STEM_SG ..          RULE .. ""
	forms = NOSINGULAR or "" .. DEFINERS .. STEM_SG ..          RULE .. ""
	forms = NOSINGULAR or "" .. DEFINERS .. STEM_SG ..          RULE .. ""
	
	if lastLetter == "ი" then
	forms = NOPLURAL or "" .. DEFINERS .. STEM_PL .. "ეფე" .. modernPluralRule .. ""
	forms = NOPLURAL or "" .. DEFINERS .. STEM_PL .. "ეფე" .. modernPluralRule .. ""
	forms = NOPLURAL or "" .. DEFINERS .. STEM_PL .. "ეფე" .. modernPluralRule .. ""
	forms = NOPLURAL or "" .. DEFINERS .. STEM_PL .. "ეფე" .. modernPluralRule .. "(ი)"
	forms = NOPLURAL or "" .. DEFINERS .. STEM_PL .. "ეფე" .. modernPluralRule .. ""
	forms = NOPLURAL or "" .. DEFINERS .. STEM_PL .. "ეფე" .. modernPluralRule .. ""
	forms = NOPLURAL or "" .. DEFINERS .. STEM_PL .. "ეფე" .. modernPluralRule .. ""
	forms = NOPLURAL or "" .. DEFINERS .. STEM_PL .. "ეფე" .. modernPluralRule .. ""
	elseif lastLetter == "ა" and newarg == "l" then
	forms = NOPLURAL or "" .. DEFINERS .. STEM_PL .. "ლეფე" .. CumaRule .. ""
	forms = NOPLURAL or "" .. DEFINERS .. STEM_PL .. "ლეფე" .. CumaRule .. ""
	forms = NOPLURAL or "" .. DEFINERS .. STEM_PL .. "ლეფე" .. CumaRule .. ""
	forms = NOPLURAL or "" .. DEFINERS .. STEM_PL .. "ლეფე" .. CumaRule .. "(ი)"
	forms = NOPLURAL or "" .. DEFINERS .. STEM_PL .. "ლეფე" .. CumaRule .. ""
	forms = NOPLURAL or "" .. DEFINERS .. STEM_PL .. "ლეფე" .. CumaRule .. ""
	forms = NOPLURAL or "" .. DEFINERS .. STEM_PL .. "ლეფე" .. CumaRule .. ""
	forms = NOPLURAL or "" .. DEFINERS .. STEM_PL .. "ლეფე" .. CumaRule .. ""
	elseif lastLetter == "ა" or lastLetter == "ე" or lastLetter == "ო" or lastLetter == "უ" then 
	forms = NOPLURAL or "" .. DEFINERS .. STEM_PL .. "ფე" .. modernPluralRule .. ""
	forms = NOPLURAL or "" .. DEFINERS .. STEM_PL .. "ფე" .. modernPluralRule .. ""
	forms = NOPLURAL or "" .. DEFINERS .. STEM_PL .. "ფე" .. modernPluralRule .. ""
	forms = NOPLURAL or "" .. DEFINERS .. STEM_PL .. "ფე" .. modernPluralRule .. "(ი)"
	forms = NOPLURAL or "" .. DEFINERS .. STEM_PL .. "ფე" .. modernPluralRule .. ""
	forms = NOPLURAL or "" .. DEFINERS .. STEM_PL .. "ფე" .. modernPluralRule .. ""
	forms = NOPLURAL or "" .. DEFINERS .. STEM_PL .. "ფე" .. modernPluralRule .. ""
	forms = NOPLURAL or "" .. DEFINERS .. STEM_PL .. "ფე" .. modernPluralRule .. ""
	end
end

function deriveDefiners()
	local marker = {
		 = "ი",
		 = "იქ",
		 = "ის",
		 = "იშ",
		 = "იშე",
		 = "იშენ",
		 = "ის",
		 = "ითენ",

	}

	DEFINERS = ""
	DEFINERS = ""
	DEFINERS = ""
	DEFINERS = ""
	DEFINERS = ""
	DEFINERS = ""
	DEFINERS = ""
	DEFINERS = ""

	for index, definer in pairs(definers) do
		local trimLast = mw.ustring.sub(definer, 0, -2);
		local lastLetter = mw.ustring.sub(definer, -1)

		for case, val in pairs(DEFINERS) do
			DEFINERS = DEFINERS .. trimLast .. (lastLetter == "ი" and marker or lastLetter) .. " "
		end
		--DEFINERS = DEFINERS .. " " .. trimLast + (lastLetter == "ი" and marker or lastLetter)
	end
end

function override(args)
	for case, text in pairs(forms) do --WARNING: NOTE, etc.
		forms = mw.ustring.gsub(args or "+", "+", forms)
	end	
end

return export

end
return export