Module:User:Awesomemeeos/TAIYAI

From Wiktionary, the free dictionary
Jump to navigation Jump to search

This is a private module sandbox of Awesomemeeos, for their own experimentation. Items in this module may be added and removed at Awesomemeeos's discretion; do not rely on this module's stability.


	--[=[
local initials = {
	['ၵ'] = 'k', ['ၶ'] = 'kʰ', ['ၷ'] = 'g', ['င'] = 'ng',
	['ၸ'] = 'ts', ['ၹ'] = 'z', ['ၺ'] = 'ny',
	['တ'] = 't', ['ထ'] = 'th', ['ၻ'] = 'd', ['ၼ'] = 'n',
	['ပ'] = 'p', ['ၽ'] = 'ph', ['ၾ'] = 'f', ['ၿ'] = 'b', ['မ'] = 'm',
	['ယ'] = 'y', ['ရ'] = 'r', ['လ'] = 'l', ['ဝ'] = 'w',
	['ႀ'] = 'x', ['သ'] = 'sh', ['ႁ'] = 'h', ['ဢ'] = '',
}

local medials = {
	[''] = '', ['ျ'] = 'y', ['ြ'] = 'r', ['ႂ'] = 'w',
}

local vowels = {
	[''] = 'a', ['ၢ'] = 'aa', ['ႃ'] = 'aa', ['ိ'] = 'i', ['ီ'] = 'ii', ['ု'] = 'u', ['ူ'] = 'uu', ['ူ*'] = 'o',
	['ေ'] = 'e', ['ဵ'] = 'e', ['ႄ'] = 'ae', ['ႅ'] = 'ae', ['ွ'] = 'o',
	['ဝ်'] = 'au', ['ၢဝ်'] = 'aau', ['ိဝ်'] = 'iu', ['ဵဝ်'] = 'eo', ['ႅဝ်'] = 'aeo',
	['ို'] = 'eu', ['ိုဝ်'] = 'eu', ['ိူ'] = 'oe', ['ိူဝ်'] = 'oe', ['ူဝ်'] = 'o', ['ေႃ'] = 'o', ['ႂ်'] = 'aɨ',
}

local finals = {
	[''] = '', ['ၵ်'] = 'k', ['င်'] = 'ng', ['တ်'] = 't', ['ၼ်'] = 'n',
	['ပ်'] = 'p', ['မ်'] = 'm', ['ၺ်'] = 'i',
}

local tones = {
	[''] = 'A', ['ႇ'] = 'B', ['ႈ'] = 'C', ['း'] = 'D', ['ႉ'] = 'E', ['ႊ'] = 'F',
}

	]=]


local export = {}

local initials = {
	['ၵ'] = 'k', ['ၶ'] = 'kʰ', ['ၷ'] = 'ɡ', ['င'] = 'ŋ',
	['ၸ'] = 't͡s', ['ၹ'] = 'z', ['ၺ'] = 'ɲ',
	['တ'] = 't', ['ထ'] = 'tʰ', ['ၻ'] = 'd', ['ၼ'] = 'n',
	['ပ'] = 'p', ['ၽ'] = 'pʰ', ['ၾ'] = 'f', ['ၿ'] = 'b', ['မ'] = 'm',
	['ယ'] = 'j', ['ရ'] = 'r', ['လ'] = 'l', ['ဝ'] = 'w',
	['ႀ'] = 'θ', ['သ'] = 'sʰ', ['ႁ'] = 'h', ['ဢ'] = 'ʔ',
	['သျ'] = 'ʃ',
}

local medials = {
	[''] = '', ['ျ'] = 'j', ['ြ'] = 'r', ['ႂ'] = 'w',
}

local vowels = {
	[''] = 'a', ['ၢ'] = 'aː', ['ႃ'] = 'aː', ['ိ'] = 'i', ['ီ'] = 'iː', ['ု'] = 'u', ['ူ'] = 'uː', ['ူ*'] = 'o',
	['ေ'] = 'eː', ['ဵ'] = 'e', ['ႄ'] = 'ɛː', ['ႅ'] = 'ɛ', ['ွ'] = 'ɔ',
	['ဝ်'] = 'aw', ['ၢဝ်'] = 'aːw', ['ိဝ်'] = 'iw', ['ဵဝ်'] = 'ew', ['ႅဝ်'] = 'ɛw',
	['ို'] = 'ɯ', ['ိုဝ်'] = 'ɯː', ['ိူ'] = 'ɤ', ['ိူဝ်'] = 'ɤː', ['ူဝ်'] = 'oː', ['ေႃ'] = 'ɔː', ['ႂ်'] = 'aɰ',
}

local finals = {
	[''] = '', ['ၵ်'] = 'k̚', ['င်'] = 'ŋ', ['တ်'] = 't̚', ['ၼ်'] = 'n',
	['ပ်'] = 'p̚', ['မ်'] = 'm', ['ၺ်'] = 'j',
}

local tones = {
	[''] = '˨˦', ['ႇ'] = '˩', ['ႈ'] = '˧˧˨', ['း'] = '˥', ['ႉ'] = '˦˨ʔ͉', ['ႊ'] = '˧˦˧',
}

function export.tr(text, lang, sc, debug_mode)

	local args = frame:getParent().args
	local text = args[1] or PAGENAME -- supports only one pronunciation
	local debug = args['d'] or nil
	local qualifier = args['q'] or nil
	local ipa = {}

	for syl in mw.text.gsplit(text, '[ %.%-]') do
		syl = mw.ustring.gsub(syl, 'ႆ', 'ၺ်')
		local i, m, v, f, t = mw.ustring.match(syl,
			'^([ၵၶၷငၸၹၺတထၻၼပၽၾၿမယရလဝႀသႁဢ])([ျြႂ]?)([ၢႃိီုူေဵႄႅွဝ်]*)([ၵငတၼပမၺ်]*)([ႇႈးႉႊ]?)$')
		if i == 'သ' and m == 'ျ' then
			i = 'သျ'
			m = ''
		end
		if m == 'ႂ' and v == '်' then
			m = ''
			v = 'ႂ်'
		end
		if v == 'ူ' and f ~= '' then
			v = 'ူ*'
		end
		if debug then
			table.insert(ipa, '['..(i or '-')..']['..(m or '-')..']['..(v or '-')..']['..(f or '-')..']['..(t or '-')..']')
		else
			table.insert(ipa, initials[i] .. medials[m] .. vowels[v] .. finals[f] .. tones[t])
		end
	end

	return '* ' .. (qualifier and frame:expandTemplate{title = 'qualifier', args = {qualifier}} .. ' ' or '') .. '[[Wiktionary:International Phonetic Alphabet|IPA]]<sup>([[Appendix:Shan pronunciation|key]])</sup>: <span class="IPA">/' .. table.concat(ipa, '.') .. '/</span>[[Category:Shan terms with IPA pronunciation]]'
 
end
 
return export