Module:kif-IPA

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

Eastern Parbate Kham IPA pronunciation module. See {{kif-IPA}}.


local export = {}

local lang = require("Module:languages").getByCode("kif")
local sc = require("Module:scripts").getByCode("Deva")
local m_IPA = require("Module:IPA")

local gsub = mw.ustring.gsub
local gmatch = mw.ustring.gmatch
local find = mw.ustring.find

local correspondences = {
	     = "ŋ",  = "ɡ",  = "t͡s", 
         = "d͡z",  = "t͡s",  = "d͡z", 
         = "t",  = "d",  = "t",
         = "d",  = "j",  = "r",
         = "w",  = "l",  = "ç", 
         = "s",  = "h",  = "n",
         = "ri",  = "̃",  = ",", 
         = "z",  = "ɥ", 
         
         --
         = "ɣ",  = "q", 
         = "x",  = "θ",  = "ð", 
         = "f",  = "ɭ",  = "ɹ", 
         = "v",  = "ɽ",  = "n",
         = "n",  = "ʒ",

    	 = "ə",  = "ɐ",  = "i",
	     = "iː",  = "o",  = "e",
         = "o",  = "e",  = "u",
         = "uː",  = "ɐj",  = "ɐw", 
         = "y",  = "ɯ",  = "ø",
         = "ɒ",  = "æ", 

         = "ũː",  = "õː",  = "ə̃ː", 
         = "ɐ̃ː",  = "ẽː",  = "ỹː",
         = "ø̃ː",  = "ɯ̃ː",  = "õː",
         = "ẽː",

	 = "̤",   = " ",  = "ː",  = "ː"
}

local vowels = "aāā̃ẽõiīuūeī̃ū̃ĩoɐøø̃ỹyɐ̃i̤ḥãũ"
local weak_h_c = "gjdḍb"
local weak_h = "()h"
local aspirate = "()"
local syllabify_pattern = "(+)(+)(+)"

local function find_consonants(text)
	local current = ""
	local cons = {}
	for cc in mw.ustring.gcodepoint(text .. " ") do
		local ch = mw.ustring.char(cc)
		if find(current .. ch, "^$") or find(current .. ch, "^h$") then
			current = current .. ch
		else
			table.insert(cons, current)
			current = ch
		end
	end
	return cons
end

local function syllabify(text)
	for count = 1, 2 do
		text = gsub(text, syllabify_pattern, function(a, b, c)
			b_set = find_consonants(b)
			table.insert(b_set, #b_set > 1 and 2 or 1, ".")
			return a .. table.concat(b_set) .. c
			end)
end
return text
end


local identical = "knlsfzθð"
for character in gmatch(identical, ".") do
	correspondences = character
end

local function transliterate(text)
	return (lang:transliterate(text))
end

function export.link(term)
	return require("Module:links").full_link{ term = term, lang = lang, sc = sc }
end

function export.toIPA(text, phonetic)
	local translit = transliterate(text)
	if not translit then
		error('The term "' .. Kham .. '" could not be transliterated.')
	end

	if phonetic then
	end
	local result = gsub(translit, ".", correspondences)
		
	
        translit = gsub(translit, "͠", "̃")
        translit = gsub(translit, "(...)*$", "%1ə")  
	translit = gsub(translit, "%-", " ")
	translit = gsub(translit, "r̥", "ri")
        translit = gsub(translit, "()(ḥ?)()", "%1%2w")
        translit = gsub(translit, "()(ḥ?)()", "%1%2y")
        translit = gsub(translit, "gh(?)(l?)()", "ɡ%1%2%3̤")
        translit = gsub(translit, "jh(?)(l?)()", "d͡z%1%2%3̤")
        translit = gsub(translit, "zh(?)(l?)()", "z%1%2%3̤")
        translit = gsub(translit, "ḍh(?)(l?)()", "d%1%2%3̤")
        translit = gsub(translit, "dh(?)(l?)()", "d%1%2%3̤")
	translit = gsub(translit, "hw", "ʍ")
	translit = gsub(translit, "h()", "ɥ̊")
	translit = gsub(translit, "nh", "n̥")
	translit = gsub(translit, "mh", "m̥")
	translit = gsub(translit, "hl", "ɬ")
	translit = syllabify(translit)
	
	
	-- aspiration rules
	translit = gsub(translit, aspirate .. "h", '%1ʰ')
	translit = gsub(translit, aspirate .. '%.h', '.%1ʰ')

        translit = gsub(translit, "%.ː", "ː.")
	local result = gsub(translit, ".", correspondences)
	
	-- formatting
result = gsub(result, "ː̃", "̃ː")
result = gsub(result, "ː.̃", "̃ː.")
result = gsub(result, "ː%.̃", "̃ː.")
	return result
end

function export.make(frame)
	local args = frame:getParent().args
	local pagetitle = mw.title.getCurrentTitle().text
	
	local p, results = {}, {}
	
	if args then
		for index, item in ipairs(args) do
			table.insert(p, (item ~= "") and item or nil)
		end
	else
		p = { pagetitle }
	end
	
	for _, Kham in ipairs(p) do
		table.insert(results, { pron = "/" .. export.toIPA(Kham) .. "/" })
		if export.toIPA(Kham, true) ~= export.toIPA(Kham) then
			table.insert(results, { pron = "" })
		end
	end
	
	return m_IPA.format_IPA_full { lang = lang, items = results }
end

return export