Module:ug-common

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

This module holds some common used functions for Uyghur, that are needed by other modules.


local export = {}
local find = mw.ustring.find
local sub = mw.ustring.sub
local gsub = mw.ustring.gsub
local match = mw.ustring.match
local length = mw.ustring.len
local vowels = "اەېىوۇۆۈ"
local vowelsBack = "اوۇ"
local vowelsFront = "ەۆۈ"
-- local vowelsCentral = "ېى"
local consonBack = "خغق"
local consonFront = "كگ"
local consonJsiz = "پتچخسشفقكھغگبد"

function export.getLast(str)
	local base, v, c = match(str, "(.*+)(+)(*)$")
	return base, v, c
end
function export.checkTongue(str)
  local isChe = find(str, "چە$")
  if isChe then str = gsub(str, "چە$", "") end 
  local tongue = export.checkFrontBack(str)
  if tongue then return tongue end
  if isChe then return checkChe(str) end
  return export.checkCentral(str)
end
function export.checkFrontBack(str)
	local base, v = match(str, "(.+)(+)*$")
	if v then
		if find(v, "$") then return "back" end
		if find(v, "$") then return "front" end
		return export.checkFrontBack(base)
	else
		return nil
	end
end
function export.checkCentral(str)
	--exceptions
	for k, data in pairs(require('Module:ug-common/data').tongue) do
		if match(str, k) then return data end
	end
	
	if match(str,"") then return "back" end
	if match(str,"") then return "front" end
	return nil
end
function checkChe(str)
  local ff =  match(str,"(.-)")
  if ff then return "back" else return "front" end
end

return export