Module:ta-IPA

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


local export = {}

local consonants = {
	='k', ='ŋ', ='t͡ɕ', ='ɲ', ='ʈ', ='ɳ', ='t̪',
	='n̪', ='p', ='m', ='j', ='ɾ', ='l', ='ʋ',
	='ɻ', ='ɭ', ='r', ='n', ='ɕ', ='d͡ʑ', ='ʂ',
	='s', ='h', ='f', ='z', ='x',
	='',
    ='ɡ', ='ɖ', ='b', ='d̪', ='t͡ɕ', ='s'
}

local numbers_sa = {
	='1', ='2', ='3', ='4', 
	='1', ='2', ='3', ='4',
	='1', ='2', ='3', ='4'
}

local diacritics = {
	= 'aː', ='ɪ', ='iː', ='ʊ', ='uː',  ='ɛ',
	='eː', ='ɐɪ̯', ='ɔ', ='oː', ='ɐʊ̯',
	='',	--halant, supresses the inherent vowel "a"
	-- no diacritic
	 = 'ɐ'
}

local nonconsonants = {
	-- independent vowels
	='ɐ', ='aː', ='ɪ', ='iː', ='ʊ', ='uː',
	='ɛ', ='eː', ='ɐɪ̯', ='ɔ', ='oː', ='ɐʊ̯',
	-- other symbols
	='',
}

local adjust1 = {
	='ŋɡ', ='ɳɖ', ='n̪d̪', ='mb',	='ɲd͡ʑ',
	ː?)k()']='%1ɡ%2',
	ː?)ʈ()']='%1ɖ%2',
	ː?)t̪()']='%1d̪%2',
	ː?)p()']='%1b%2'
}

local adjust2 = {
	 = 's',  = 't͡ɕː',
	)']='ɯ%1', ='ɯ', )']='i%1', ='i', ='s', )t͡ɕ()']='%1s',
	='ɲd͡ʑ', ='tr', ='tr', ='ndr',
	)']='s%1',
	ː?)t͡ɕ()']='%1s%2',
}

function export.to_IPA(text)

	text = mw.ustring.gsub(
		text,
		'(ஃ?)()(?)(?)',
		function(h, c, d, n)
			n = numbers_sa or n
			return ((consonants or consonants) or (consonants .. (consonants or consonant or c))) .. diacritics
		end)

	text = mw.ustring.gsub(text, '', nonconsonants)

	for k, v in pairs(adjust1) do
		local count = 1
		while count <= 2 do --twice
		text = mw.ustring.gsub(text, k, v)
		count = count + 1
		end
	end

	--convert consonant gemination to triangular colon
	text = mw.ustring.gsub(text, "()%1", "%1ː")
	text = mw.ustring.gsub(text, "(̪)%1", "%1ː")
	text = mw.ustring.gsub(text, "(͡)%1", "%1ː")

	--if an independent vowel is after another vowel, assume diphthong
	text = mw.ustring.gsub(text, "(ː?)•", "%1")

	text2 = text --phonetic

	for k, v in pairs(adjust2) do
		text2 = mw.ustring.gsub(text2, k, v)
	end

	return (text == text2 and { text } or { text, text2 })

end

function export.show(frame)

	local args = frame:getParent().args
	local page_title = mw.title.getCurrentTitle().text
	local text = args or page_title
	local qualifier = args or nil

	local transcriptions = export.to_IPA(text)
	local IPA_text
	if not transcriptions then
		IPA_text = require("Module:IPA").format_IPA_full {
			lang = require("Module:languages").getByCode("ta"),
			items = {{ pron = "/" .. transcriptions .. "/" }},
		}
	else
		IPA_text = require("Module:IPA").format_IPA_full {
			lang = require("Module:languages").getByCode("ta"),
			items = {{ pron = "/" .. transcriptions .. "/" }, { pron = " .. "]" }},
		}
	end

	return "* " .. (qualifier and require("Module:qualifier").format_qualifier{qualifier} .. " " or "")
		.. IPA_text

end

return export