Module:kpy-IPA

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


local export = {}

local m_IPA = require("Module:IPA")
local lang = require("Module:languages").getByCode("kpy")
local rsub = mw.ustring.gsub
local rlower = mw.ustring.lower

local function phonetic(text)
	text = rlower(text)
	text = rsub(text, "ы", "ə")
	text = rsub(text, "и", "i")
	text = rsub(text, "э", "E")
	text = rsub(text, "е", "jE")
	text = rsub(text, "а", "a")
	text = rsub(text, "я", "ja")
	text = rsub(text, "у", "ʊ")
	text = rsub(text, "ю", "jʊ")
	text = rsub(text, "о", "o")
	text = rsub(text, "ё", "jo")
	text = rsub(text, "п", "p")
	text = rsub(text, "т", "t")
	text = rsub(text, "ч", "ћ")
	text = rsub(text, "к", "k")
	text = rsub(text, "ӄ", "q")
	text = rsub(text, "вʼ", "w")
	text = rsub(text, "в", "ʋ")
	text = rsub(text, "гʼ", "ʕ")
	text = rsub(text, "г", "ɣ")
	text = rsub(text, "л", "l")
	text = rsub(text, "м", "m")
	text = rsub(text, "н", "n")
	text = rsub(text, "ӈ", "ŋ")
	-- palatals
	text = rsub(text, "t()", "c%1")
	text = rsub(text, "t()", "c")
	text = rsub(text, "l()", "ʎ")
	text = rsub(text, "n()", "ɲ")
	text = rsub(text, "()()", "%1")
	text = rsub(text, "й", "j")
	text = rsub(text, "ъ", "")
	
	-- glottal stop
	text = rsub(text, "^()", "ʔ%1")
	text = rsub(text, "()()", "%1ʔ%2")
	
	-- vowel phonetic
	text = rsub(text, "iŋ", "ɪŋ")
	text = rsub(text, "i$", "ɪ")
	text = rsub(text, "i ", "ɪ ")
	text = rsub(text, "Eŋ", "ɛŋ")
	text = rsub(text, "E()", "e%1")
	text = rsub(text, "aŋ", "ɑŋ")
	text = rsub(text, "a$", "ɐ")
	text = rsub(text, "a ", "ɐ ")
	text = rsub(text, "a()", "æ%1")
	text = rsub(text, "ʊŋ", "uŋ")
	text = rsub(text, "o$", "ɔ")
	text = rsub(text, "o ", "ɔ ")
	-- consonants phonetic
	text = rsub(text, "p()", "pʲ%1")
	text = rsub(text, "p$", "ʰp")
	text = rsub(text, "p ", "ʰp ")
	text = rsub(text, "ћ()", "ч%1")
	text = rsub(text, "ћ$", "ч")
	text = rsub(text, "ћ ", "ч ")
	text = rsub(text, "k$", "ʰk")
	text = rsub(text, "k ", "ʰk ")
	text = rsub(text, "ʋ()", "ʋʲ%1")
	text = rsub(text, "n()", "nʲ%1")
	
	-- final conversions
	text = rsub(text, "()%1", "%1ː")
	text = rsub(text, "E", "e̞")
	text = rsub(text, "ч", "t͡ʃ̺")
	text = rsub(text, "ћ", "t͡ʃ")
	text = rsub(text, "ʎ", "lʲ")

	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 = "" })
	end
	
	return m_IPA.format_IPA_full { lang = lang, items = IPA_results }
end

return export