Module:ky-IPA

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

Kyrgyz pronunciation module, powers {{ky-IPA}}. This is under development and may contain errors; mass deployment on entries is discouraged.

TODO

  • IMPORTANT: Iotated Ее handling
  • Stress handling
  • Initial voicing of front row K
  • Exceptional short vowels pronounced with long vowels, such as in Нарын, бардыгы

local export = {}

local m_IPA = require("Module:IPA")
local lang = require("Module:languages").getByCode("ky")

local C_set = "бвгджзйклмнңпрстфхцчшщ" -- consonants
local bV_set = "аыоу"
local fV_set = "эиөү"
local iV_set = "еёюя" -- iotated vowels
local V_set = bV_set .. fV_set .. iV_set -- all vowels

local C = "" -- consonants
local bV = ""
local fV = ""
local iV = "" -- iotated vowels
local V = "" -- all vowels

local lowerc = {
	="а", ="б", ="в", ="г", ="д", ="е", 
	="ё", ="ж", ="з", ="и", ="й", ="к", 
	="л", ="м", ="н", ="ң", ="о", ="ө", 
	="п", ="р", ="с", ="т", ="у", ="ү", 
	="ф", ="х", ="ц", ="ч", ="ш", ="щ", 
	="ъ", ="ы", ="ь", ="э", ="ю", ="я"
}

local phon = {
	="b", ="ɡ", ="d", ="d͡ʒ", ="z", ="j",
	="k", ="ɫ", ="m", ="n", ="ŋ", ="p", 
	="r", ="s", ="t", ="t͡ʃ", ="ʂ", ="e",
	="jo", ="ju", ="jɑ", ="ɑ", ="ɯ", ="o", 
	="u", ="e", ="i", ="ø", ="y", ="v", 
	="f", ="x", ="t͡s", ="t͡ʃ", ="ɕ", ="ʲ"
}

function export.phonetic(text)
	text = mw.ustring.gsub(text, '.', lowerc)
	
	-- Handle iotated Е
	text = mw.ustring.gsub(text, "^е", "je")
	text = mw.ustring.gsub(text, "()е", "%1je")
	
    text = mw.ustring.gsub(text, '.', phon)
    
	-- Handle к, г uvularization rules
	text = mw.ustring.gsub(text, "k", "q%1")
	text = mw.ustring.gsub(text, "ɡ", "ʁ%1")
	text = mw.ustring.gsub(text, "qk", "q")
	text = mw.ustring.gsub(text, "ʁɡ", "ʁ")
	text = mw.ustring.gsub(text, "k", "%1q")
	text = mw.ustring.gsub(text, "ɡ", "%1ʁ")
	text = mw.ustring.gsub(text, "kq", "q")
	text = mw.ustring.gsub(text, "ɡʁ", "ʁ")
	
	-- Handle ш rules
	text = mw.ustring.gsub(text, "ʂ", "ʃ%1")
	text = mw.ustring.gsub(text, "ʂ", "%1ʃ")
	text = mw.ustring.gsub(text, "ʂʃ", "ʃ")
	text = mw.ustring.gsub(text, "ʃʂ", "ʃ")

	-- Handle l rules
	text = mw.ustring.gsub(text, "l̴", "l%1")
	text = mw.ustring.gsub(text, "l̴", "%1l")
	text = mw.ustring.gsub(text, "ll̴", "l̴")
	text = mw.ustring.gsub(text, "l̴l", "l̴")
	
	-- Handle long vowels
	text = mw.ustring.gsub(text, "ɑ", "ɑː")
	text = mw.ustring.gsub(text, "o", "oː")
	text = mw.ustring.gsub(text, "u", "uː")
	text = mw.ustring.gsub(text, "e", "eː")
	text = mw.ustring.gsub(text, "ø", "øː")
	text = mw.ustring.gsub(text, "y", "yː")
	return text
end

function export.IPA(frame)
	local words = {}

	for _, word in ipairs(frame:getParent().args) do
		table.insert(words, word)
	end

	if #words == 0 then
		words = {mw.title.getCurrentTitle().text}
	end

	local IPA_results = {}
	
	for _, word in ipairs(words) do
		table.insert(IPA_results, { pron = "/" .. export.phonetic(word) .. "/" })
	end
	
	return m_IPA.format_IPA_full { lang = lang, items = IPA_results }
end

return export