Module:User:Oyunqi/ug-common

Hello, you have come here looking for the meaning of the word Module:User:Oyunqi/ug-common. In DICTIOUS you will not only get to know all the dictionary meanings for the word Module:User:Oyunqi/ug-common, but we will also tell you about its etymology, its characteristics and you will know how to say Module:User:Oyunqi/ug-common in singular and plural. Everything you need to know about the word Module:User:Oyunqi/ug-common you have here. The definition of the word Module:User:Oyunqi/ug-common will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofModule:User:Oyunqi/ug-common, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.
local export = {}
local vowels = "اەېىوۇۆۈ"
local fVowel = "اوۇ"
local bVowel = "ەۆۈ"
local cVowel = "ېى"
local fPlural = "لار"
local bPlural = "لەر"
local fConsonant = "خغق"
local fConsonant2 = "قغ"
local bConsonant = "كگ"
local full_vowels = require('Module:User:Oyunqi/ug-common/data')
local find = mw.ustring.find
local length = mw.ustring.len
local match = mw.ustring.match
local sub = mw.ustring.sub

-- get all syllables
function export.syllables(str)
	local t = {}  
	if type(str) == "table" then str = str.args end
    if str==nil or str==""  then
    	str = mw.title.getCurrentTitle().text
	end
	local last_end = 1
	local tepildi = 0
	local s, e = find(str,"(.-)" , 1)
	while s do
		tepildi = 1
		if s==1 then --birinchi boghum
			table.insert(t,sub(str,s,e))
		else --bashqa boghum
			perqi= e - last_end
			if perqi == 0 then
				t = t .. sub(str,s,s)
			elseif perqi == 1 then --VCV => V'CV
				table.insert(t,sub(str,s,e))
			elseif perqi == 2 then --VCCV => VC'CV
				table.insert(t,sub(str,s+1,e))
				t = t .. sub(str,s,s)
			elseif perqi == 3 then --VCCCV => VCC'CV
				table.insert(t,sub(str,s+2,e))
				t = t .. sub(str,s,s+1)
			elseif perqi == 4 then --VCCCCV => VCC'CCV
				table.insert(t,sub(str,s+2,e))
				t = t .. sub(str,s,s+1)
			else
				--
			end
		end
		last_end = e + 1
		s, e = find(str,"(.-)" , last_end)
	end
	if s==nil and tepildi==0 or #str==1 then 
		-- no vowel word
	else
		if last_end <= #str then
			--t = t --.. "222"
			t = t .. sub(str,last_end)
		end
	end
	return t
end

function export.getLast(str)
	local fixed, lastv, lastc = match(str, "(.-)(+)(-)$")
	if length(lastv)>1 then lastv= sub(lastv, -1) end
	if length(lastc)>1 then lastc= sub(lastc, -1) end
	return {fixed=fixed, lastv=lastv, lastc=lastc}
end

function export.getPlural(str)
	local syllables = export.syllables(str)
	local fixed, lastv, lastc = export.getLast(str)
	if #syllables > 1 and match(syllables, "چە$") then
		local aldiboghum = syllables
		if match(aldiboghum, "") then --front lar
			return fixed .. lastv .. fPlural
		elseif match(aldiboghum, "") then --back ler
			return fixed .. lastv .. bPlural
		else --central
			if match(str, "") then -- x gh q lar
				return fixed .. lastv .. fPlural
			else 
				return fixed .. lastv .. bPlural
			end
		end
	end
	if match(lastv, "") then
		return fixed .. lastv .. fPlural
	elseif match(lastv, "") then --back ler
		return fixed .. lastv .. bPlural
	else --central
		if match(str, "") then -- x gh q lar
			return fixed .. lastv .. fPlural
		elseif match(str, "") then -- k g ler
			return fixed .. lastv .. bPlural
		end
		if #syllables == 1 then
			if lastv == "ى" and (lastc == "ش" or lastc == "ز") then --chish, ish, iz
				return fixed .. lastv .. fPlural
			end
		else
			if match(str, "") then --front lar
				return fixed .. lastv .. fPlural
			elseif match(str, "") then --back ler
				return fixed .. lastv .. bPlural
			end
			if match(syllables, "") then
				return fixed .. lastv .. fPlural
			end
		end
	end
	-- local fixed, lastv, lastc = export.getLast(str)
	-- return { = syllables,  = lastv,  = lastc} 
end

function export.getAllInfo(str)
	local data = {}
	local syllables = export.syllables(str)
	local fixed, lastv, lastc = export.getLast(str)
	local lastv_new = full_vowels
	data = {syllables = syllables, lastv = lastv_new, lastc = lastc}
	return data
end

function export.getExeptions(str)
	return mw.loadData("Module:User:Oyunqi/ug-common/data/nouns") or nil
end

return export