Module:ii-pron

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

This module is experimental.
The details of its operation have not yet been fully decided upon. Do not deploy widely until the module is finished.

Pronunciation module for Nuosu. See {{ii-pron}}.


local export = {}
local translit = require("Module:ii-translit")
local gsub = mw.ustring.gsub
local find = mw.ustring.find

local convert_initial = {
	 = "p",  = "pʰ",  = "b",  = "mb",
	 = "m̥",  = "m",  = "f",  = "v",
	 = "t",  = "tʰ",  = "d",  = "nd",
	 = "n̥",  = "n",  = "ɬ",  = "l",
	 = "tɕ",  = "tɕʰ",  = "dʑ",  = "ndʑ",
	 = "n̠ʲ",  = "ɕj",  = "ʑ",
	 = "k",  = "kʰ",  = "ɡ",  = "ŋɡ",
	 = "h",  = "ŋ",  = "x",  = "ɣ",
	 = "ts",  = "tsʰ",  = "dz",
	 = "ndz",  = "s",  = "z",
	 = "tʂ",  = "tʂʰ",  = "dʐ",
	 = "ndʐ",  = "ʂ",  = "ʐ",  = "",
}

local convert_final = {
	 = "i",  = "ɛ",  = "a",
	 = "z̩",  = "z̩̱",  = "ɯ",
	 = "ʐ̩",  = "ʐ̩̱",
	 = "u",  = "u̱",  = "o",  = "ɔ",
}

local convert_tone = {
	 = "˥˥",  = "˧˦",  = "˧˧",  = "˨˩"
}

function export.ipa(text)
	text = string.lower(translit.tr(text))
	local syllables = mw.text.split(text, " ")
	for i, syllable in ipairs(syllables) do
		if syllable == "w" then
			syllables = syllables
		else
			local initial, final, tone = syllable:match("(??)(?)(?)$")
			if (find(initial, "h") or find(initial, "r")) and find(final, "^yr?$") then
				final = gsub(final, "y", "Y")
			end
			syllables = convert_initial .. convert_final .. convert_tone
		end
	end
	
	return table.concat(syllables, " ")
end

return export