Модул:vi-pron
Намуди зоҳирӣ
Documentation for this module may be created at Модул:vi-pron/doc
local export = {}
local gsub = mw.ustring.gsub
local sub = mw.ustring.sub
local match = mw.ustring.match
local tone_diacritics = {
['[àằầèềìòồờùừỳ]'] = 2,
['[áắấéếíóốớúứý]'] = 3,
['[ảẳẩẻểỉỏổởủửỷ]'] = 4,
['[ãẵẫẽễĩõỗỡũữỹ]'] = 5,
['[ạặậẹệịọộợụựỵ]'] = 6,
}
local detone = {
['à'] = 'a', ['ằ'] = 'ă', ['ầ'] = 'â', ['è'] = 'e', ['ề'] = 'ê', ['ì'] = 'i', ['ò'] = 'o', ['ồ'] = 'ô', ['ờ'] = 'ơ', ['ù'] = 'u', ['ừ'] = 'ư', ['ỳ'] = 'y',
['á'] = 'a', ['ắ'] = 'ă', ['ấ'] = 'â', ['é'] = 'e', ['ế'] = 'ê', ['í'] = 'i', ['ó'] = 'o', ['ố'] = 'ô', ['ớ'] = 'ơ', ['ú'] = 'u', ['ứ'] = 'ư', ['ý'] = 'y',
['ả'] = 'a', ['ẳ'] = 'ă', ['ẩ'] = 'â', ['ẻ'] = 'e', ['ể'] = 'ê', ['ỉ'] = 'i', ['ỏ'] = 'o', ['ổ'] = 'ô', ['ở'] = 'ơ', ['ủ'] = 'u', ['ử'] = 'ư', ['ỷ'] = 'y',
['ã'] = 'a', ['ẵ'] = 'ă', ['ẫ'] = 'â', ['ẽ'] = 'e', ['ễ'] = 'ê', ['ĩ'] = 'i', ['õ'] = 'o', ['ỗ'] = 'ô', ['ỡ'] = 'ơ', ['ũ'] = 'u', ['ữ'] = 'ư', ['ỹ'] = 'y',
['ạ'] = 'a', ['ặ'] = 'ă', ['ậ'] = 'â', ['ẹ'] = 'e', ['ệ'] = 'ê', ['ị'] = 'i', ['ọ'] = 'o', ['ộ'] = 'ô', ['ợ'] = 'ơ', ['ụ'] = 'u', ['ự'] = 'ư', ['ỵ'] = 'y',
}
local tone_contour = {
['hn'] = { [1] = '˧˧', [2] = '˨˩', ['3a'] = '˧ˀ˦', [3] = '˧ˀ˦', [4] = '˧˩', [5] = '˦ˀ˥', [6] = '˧ˀ˨ʔ' },
['hue'] = { [1] = '˧˧', [2] = '˧˧', ['3a'] = '˦˥', [3] = '˩ˀ˧', [4] = '˧˩', [5] = '˧˩', [6] = '˨ˀ˨ʔ' },
['hcmc'] = { [1] = '˧˥', [2] = '˨˩', ['3a'] = '˦ˀ˥', [3] = '˦ˀ˥', [4] = '˨˦', [5] = '˨˦', [6] = '˨ˀ˧ʔ' },
}
local initial_ipa = {
['b'] = { ['hn'] = 'ˀɓ', ['hue'] = 'ˀɓ', ['hcmc_w'] = 'ˀɓ', ['hcmc'] = 'ˀɓ' },
['c'] = { ['hn'] = 'k', ['hue'] = 'k', ['hcmc_w'] = 'k', ['hcmc'] = 'k' },
['ch'] = { ['hn'] = 'ṯɕ', ['hue'] = 'ṯɕ', ['hcmc_w'] = 'c̻', ['hcmc'] = 'c̻' },
['d'] = { ['hn'] = 'z̻', ['hue'] = 'j', ['hcmc_w'] = 'j', ['hcmc'] = 'j' },
['đ'] = { ['hn'] = 'ˀɗ', ['hue'] = 'ˀɗ', ['hcmc_w'] = 'ˀɗ', ['hcmc'] = 'ˀɗ' },
['g'] = { ['hn'] = 'ɣ', ['hue'] = 'ɣ', ['hcmc_w'] = 'ɣ', ['hcmc'] = 'ɣ' },
['gh'] = { ['hn'] = 'ɣ', ['hue'] = 'ɣ', ['hcmc_w'] = 'ɣ', ['hcmc'] = 'ɣ' },
['gi'] = { ['hn'] = 'z̻', ['hue'] = 'j', ['hcmc_w'] = 'j', ['hcmc'] = 'j' },
['gy'] = { ['hn'] = 'z̻', ['hue'] = 'j', ['hcmc_w'] = 'j', ['hcmc'] = 'j' },
['h'] = { ['hn'] = 'h', ['hue'] = 'h', ['hcmc_w'] = '', ['hcmc'] = 'h' },
['k'] = { ['hn'] = 'k', ['hue'] = 'k', ['hcmc_w'] = 'k', ['hcmc'] = 'k' },
['kh'] = { ['hn'] = 'x', ['hue'] = 'x', ['hcmc_w'] = 'x', ['hcmc'] = 'x' },
['l'] = { ['hn'] = 'l̪', ['hue'] = 'l', ['hcmc_w'] = 'l̻ʲ', ['hcmc'] = 'l̻ʲ' },
['m'] = { ['hn'] = 'm', ['hue'] = 'm', ['hcmc_w'] = 'm', ['hcmc'] = 'm' },
['n'] = { ['hn'] = 'n', ['hue'] = 'n', ['hcmc_w'] = 'n', ['hcmc'] = 'n' },
['ng'] = { ['hn'] = 'ŋ', ['hue'] = 'ŋ', ['hcmc_w'] = 'ŋ', ['hcmc'] = 'ŋ' },
['ngh'] = { ['hn'] = 'ŋ', ['hue'] = 'ŋ', ['hcmc_w'] = 'ŋ', ['hcmc'] = 'ŋ' },
['nh'] = { ['hn'] = 'ɲ', ['hue'] = 'ɲ', ['hcmc_w'] = 'ɲ̻', ['hcmc'] = 'ɲ̻' },
['p'] = { ['hn'] = 'p', ['hue'] = 'p', ['hcmc_w'] = 'p', ['hcmc'] = 'p' }, -- foreign
['ph'] = { ['hn'] = 'f', ['hue'] = 'f', ['hcmc_w'] = 'f', ['hcmc'] = 'f' },
['q'] = { ['hn'] = 'k', ['hue'] = 'k', ['hcmc_w'] = '', ['hcmc'] = 'k' },
['r'] = { ['hn'] = 'z', ['hue'] = 'ʐ', ['hcmc_w'] = 'ʐ', ['hcmc'] = 'ʐ' },
['s'] = { ['hn'] = 's̪', ['hue'] = 'ʂ', ['hcmc_w'] = 'ʂ', ['hcmc'] = 'ʂ' },
['t'] = { ['hn'] = 't', ['hue'] = 't', ['hcmc_w'] = 't', ['hcmc'] = 't' },
['th'] = { ['hn'] = 'tʰ', ['hue'] = 'tʰ', ['hcmc_w'] = 'tʰ', ['hcmc'] = 'tʰ' },
['tr'] = { ['hn'] = 'ṯɕ', ['hue'] = 'ʈ', ['hcmc_w'] = 'ʈ', ['hcmc'] = 'ʈ' },
['v'] = { ['hn'] = 'v', ['hue'] = 'v', ['hcmc_w'] = 'vʲ', ['hcmc'] = 'vʲ' },
['x'] = { ['hn'] = 's̪', ['hue'] = 's̪', ['hcmc_w'] = 's̪', ['hcmc'] = 's̪' },
[''] = { ['hn'] = 'ʔ', ['hue'] = 'ʔ', ['hcmc_w'] = 'ʔ', ['hcmc'] = 'ʔ' },
}
local mvi_initial_ipa = {
['ꞗ'] = 'β', ['Ꞗ'] = 'β',
['b'] = 'ɓ',
['c'] = 'k', ['ch'] = 'c',
['d'] = 'ð', ['đ'] = 'ɗ',
['g'] = 'ɣ', ['gh'] = 'ɣ', ['gi'] = 'ʝ',
['h'] = 'h',
['k'] = 'k', ['kh'] = 'kʰ',
['l'] = 'l',
['m'] = 'm',
['n'] = 'n', ['ng'] = 'ŋ', ['ngh'] = 'ŋ', ['nh'] = 'ɲ',
['p'] = 'p', ['ph'] = 'pʰ',
['r'] = 'ɹ',
['s'] = 'ʂ',
['t'] = 't', ['th'] = 'tʰ', ['tr'] = 'ʈ',
['v'] = 'w',
['x'] = 'ɕ',
}
local final_ipa = {
['a'] = { ['hn'] = 'aː', ['hue'] = 'aː', ['hcmc'] = 'aː' },
['ac'] = { ['hn'] = 'aːʔk̚', ['hue'] = 'aːʔk̚', ['hcmc'] = 'aːʔk̚' },
['ach'] = { ['hn'] = 'ɐjʔk̟̚', ['hue'] = 'ɐʔt̚', ['hcmc'] = 'ɐʔt̚' },
['ai'] = { ['hn'] = 'aːj', ['hue'] = 'aːj', ['hcmc'] = 'aːj' },
['am'] = { ['hn'] = 'aːm', ['hue'] = 'aːm', ['hcmc'] = 'aːm' },
['an'] = { ['hn'] = 'aːn', ['hue'] = 'aːŋ', ['hcmc'] = 'aːŋ' },
['ang'] = { ['hn'] = 'aːŋ', ['hue'] = 'aːŋ', ['hcmc'] = 'aːŋ' },
['anh'] = { ['hn'] = 'ɐjŋ̟', ['hue'] = 'ɐn', ['hcmc'] = 'ɐn' },
['ao'] = { ['hn'] = 'aːw', ['hue'] = 'aːw', ['hcmc'] = 'aːw' },
['ap'] = { ['hn'] = 'aːʔp̚', ['hue'] = 'aːʔp̚', ['hcmc'] = 'aːʔp̚' },
['at'] = { ['hn'] = 'aːʔt̚', ['hue'] = 'aːʔk̚', ['hcmc'] = 'aːʔk̚' },
['au'] = { ['hn'] = 'ɐw', ['hue'] = 'ɐw', ['hcmc'] = 'ɐw' },
['ay'] = { ['hn'] = 'ɐj', ['hue'] = 'ɐj', ['hcmc'] = 'ɐj' },
['ăc'] = { ['hn'] = 'ɐʔk̚', ['hue'] = 'ɐʔk̚', ['hcmc'] = 'ɐʔk̚' },
['ăm'] = { ['hn'] = 'ɐm', ['hue'] = 'ɐm', ['hcmc'] = 'ɐm' },
['ăn'] = { ['hn'] = 'ɐn', ['hue'] = 'ɐŋ', ['hcmc'] = 'ɐŋ' },
['ăng'] = { ['hn'] = 'ɐŋ', ['hue'] = 'ɐŋ', ['hcmc'] = 'ɐŋ' },
['ăp'] = { ['hn'] = 'ɐʔp̚', ['hue'] = 'ɐʔp̚', ['hcmc'] = 'ɐʔp̚' },
['ăt'] = { ['hn'] = 'ɐʔt̚', ['hue'] = 'ɐʔk̚', ['hcmc'] = 'ɐʔk̚' },
['â'] = { ['hn'] = 'ɜ', ['hue'] = 'ɜ', ['hcmc'] = 'ɜ' },
['âc'] = { ['hn'] = 'ɜʔk̚', ['hue'] = 'ɜʔk̚', ['hcmc'] = 'ɜʔk̚' },
['âm'] = { ['hn'] = 'ɜm', ['hue'] = 'ɜm', ['hcmc'] = 'ɜm' },
['ân'] = { ['hn'] = 'ɜn', ['hue'] = 'ɜŋ', ['hcmc'] = 'ɜŋ' },
['âng'] = { ['hn'] = 'ɜŋ', ['hue'] = 'ɜŋ', ['hcmc'] = 'ɜŋ' },
['âp'] = { ['hn'] = 'ɜʔp̚', ['hue'] = 'ɜʔp̚', ['hcmc'] = 'ɜʔp̚' },
['ât'] = { ['hn'] = 'ɜʔt̚', ['hue'] = 'ɜʔk̚', ['hcmc'] = 'ɜʔk̚' },
['âu'] = { ['hn'] = 'ɜw', ['hue'] = 'ɜw', ['hcmc'] = 'ɜw' },
['ây'] = { ['hn'] = 'ɜj', ['hue'] = 'ɜj', ['hcmc'] = 'ɜj' },
['e'] = { ['hn'] = 'ɛ', ['hue'] = 'ɛ', ['hcmc'] = 'ɛ' },
['ec'] = { ['hn'] = 'ɛʔk̚', ['hue'] = 'ɛʔk̚', ['hcmc'] = 'ɛʔk̚' },
['em'] = { ['hn'] = 'ɛm', ['hue'] = 'ɛm', ['hcmc'] = 'ɛm' },
['en'] = { ['hn'] = 'ɛn', ['hue'] = 'ɛŋ', ['hcmc'] = 'ɛŋ' },
['eng'] = { ['hn'] = 'ɛŋ', ['hue'] = 'ɛŋ', ['hcmc'] = 'ɛŋ' },
['eo'] = { ['hn'] = 'ɛw', ['hue'] = 'ɛw', ['hcmc'] = 'ɛw' },
['ep'] = { ['hn'] = 'ɛʔp̚', ['hue'] = 'ɛʔp̚', ['hcmc'] = 'ɛʔp̚' },
['et'] = { ['hn'] = 'ɛʔt̚', ['hue'] = 'ɛʔt̚', ['hcmc'] = 'ɛʔk̚' },
['ê'] = { ['hn'] = 'e', ['hue'] = 'ej', ['hcmc'] = 'ej' },
['êc'] = { ['hn'] = 'eʔk̚', ['hue'] = 'eʔk̚', ['hcmc'] = 'eʔk̚' },
['êch'] = { ['hn'] = 'ɜjʔk̟̚', ['hue'] = 'eʔt̚', ['hcmc'] = 'ɜːʔt̚' },
['êm'] = { ['hn'] = 'em', ['hue'] = 'em', ['hcmc'] = 'em' },
['ên'] = { ['hn'] = 'en', ['hue'] = 'en', ['hcmc'] = 'ɜːn' },
['êng'] = { ['hn'] = 'eŋ', ['hue'] = 'eŋ', ['hcmc'] = 'eŋ' },
['ênh'] = { ['hn'] = 'ɜjŋ̟', ['hue'] = 'en', ['hcmc'] = 'ɜːn' },
['êp'] = { ['hn'] = 'eʔp̚', ['hue'] = 'eʔp̚', ['hcmc'] = 'eʔp̚' },
['êt'] = { ['hn'] = 'eʔt̚', ['hue'] = 'eʔt̚', ['hcmc'] = 'ɜːʔt̚' },
['êu'] = { ['hn'] = 'ew', ['hue'] = 'ew', ['hcmc'] = 'ew' },
['i'] = { ['hn'] = 'i', ['hue'] = 'ɪj', ['hcmc'] = 'ɪj' },
['ia'] = { ['hn'] = 'iɜ', ['hue'] = 'iɜ', ['hcmc'] = 'iɜ' },
['ic'] = { ['hn'] = 'ïʔk̟̚', ['hue'] = 'ïʔk̟̚', ['hcmc'] = 'ïʔk̟̚' },
['ich'] = { ['hn'] = 'ïʔk̟̚', ['hue'] = 'ɨ̞̠ʔt̚', ['hcmc'] = 'ɨ̞̠ʔt̚' },
['iêc'] = { ['hn'] = 'iɜʔk̚', ['hue'] = 'iɜʔk̚', ['hcmc'] = 'iɜʔk̚' },
['iêm'] = { ['hn'] = 'iɜm', ['hue'] = 'iɜm', ['hcmc'] = 'iɜm' },
['iên'] = { ['hn'] = 'iɜn', ['hue'] = 'iɜŋ', ['hcmc'] = 'iɜŋ' },
['iêng'] = { ['hn'] = 'iɜŋ', ['hue'] = 'iɜŋ', ['hcmc'] = 'iɜŋ' },
['iêp'] = { ['hn'] = 'iɜʔp̚', ['hue'] = 'iɜʔp̚', ['hcmc'] = 'iɜʔp̚' },
['iêt'] = { ['hn'] = 'iɜʔt̚', ['hue'] = 'iɜʔk̚', ['hcmc'] = 'iɜʔk̚' },
['iêu'] = { ['hn'] = 'iɜw', ['hue'] = 'iɜw', ['hcmc'] = 'iɜw' },
['im'] = { ['hn'] = 'im', ['hue'] = 'im', ['hcmc'] = 'im' },
['in'] = { ['hn'] = 'in', ['hue'] = 'in', ['hcmc'] = 'ɨ̞̠n' },
['inh'] = { ['hn'] = 'ïŋ', ['hue'] = 'ɨ̞̠n', ['hcmc'] = 'ɨ̞̠n' },
['ip'] = { ['hn'] = 'iʔp̚', ['hue'] = 'iʔp̚', ['hcmc'] = 'iʔp̚' },
['it'] = { ['hn'] = 'iʔt̚', ['hue'] = 'iʔt̚', ['hcmc'] = 'ɨ̞̠ʔt̚' },
['iu'] = { ['hn'] = 'iw', ['hue'] = 'iw', ['hcmc'] = 'iw' },
['o'] = { ['hn'] = 'ɔ', ['hue'] = 'ɔ', ['hcmc'] = 'ɔ' },
['oa'] = { ['hn'] = 'waː', ['hue'] = 'waː', ['hcmc'] = 'waː' },
['oac'] = { ['hn'] = 'waːʔk̚', ['hue'] = 'waːʔk̚', ['hcmc'] = 'waːʔk̚' },
['oach'] = { ['hn'] = 'wɐjʔk̟̚', ['hue'] = 'wɐʔt̚', ['hcmc'] = 'wɐʔt̚' },
['oai'] = { ['hn'] = 'waːj', ['hue'] = 'waːj', ['hcmc'] = 'waːj' },
['oam'] = { ['hn'] = 'waːm', ['hue'] = 'waːm', ['hcmc'] = 'waːm' },
['oan'] = { ['hn'] = 'waːn', ['hue'] = 'waːŋ', ['hcmc'] = 'waːŋ' },
['oang'] = { ['hn'] = 'waːŋ', ['hue'] = 'waːŋ', ['hcmc'] = 'waːŋ' },
['oanh'] = { ['hn'] = 'wɐjŋ̟', ['hue'] = 'wɐn', ['hcmc'] = 'wɐn' },
['oao'] = { ['hn'] = 'waːw', ['hue'] = 'waːw', ['hcmc'] = 'waːw' },
['oap'] = { ['hn'] = 'waːʔp̚', ['hue'] = 'waːʔp̚', ['hcmc'] = 'waːʔp̚' },
['oat'] = { ['hn'] = 'waːʔt̚', ['hue'] = 'waːʔk̚', ['hcmc'] = 'waːʔk̚' },
['oay'] = { ['hn'] = 'wɐj', ['hue'] = 'wɐj', ['hcmc'] = 'wɐj' },
['oă'] = { ['hn'] = 'wɐ', ['hue'] = 'wɐ', ['hcmc'] = 'wɐ' },
['oăc'] = { ['hn'] = 'wɐʔk̚', ['hue'] = 'wɐʔk̚', ['hcmc'] = 'wɐʔk̚' },
['oăm'] = { ['hn'] = 'wɐm', ['hue'] = 'wɐm', ['hcmc'] = 'wɐm' },
['oăn'] = { ['hn'] = 'wɐn', ['hue'] = 'wɐŋ', ['hcmc'] = 'wɐŋ' },
['oăng'] = { ['hn'] = 'wɐŋ', ['hue'] = 'wɐŋ', ['hcmc'] = 'wɐŋ' },
['oăt'] = { ['hn'] = 'wɐʔt̚', ['hue'] = 'wɐʔk̚', ['hcmc'] = 'wɐʔk̚' },
['oc'] = { ['hn'] = 'ɐwʔk͡p̚', ['hue'] = 'ɐwʔk͡p̚', ['hcmc'] = 'ɐwʔk͡p̚' },
['oe'] = { ['hn'] = 'wɛ', ['hue'] = 'wɛ', ['hcmc'] = 'wɛ' },
['oem'] = { ['hn'] = 'wɛm', ['hue'] = 'wɛm', ['hcmc'] = 'wɛm' },
['oen'] = { ['hn'] = 'wɛn', ['hue'] = 'wɛŋ', ['hcmc'] = 'wɛŋ' },
['oeo'] = { ['hn'] = 'wɛw', ['hue'] = 'wɛw', ['hcmc'] = 'wɛw' },
['oet'] = { ['hn'] = 'wɛʔt̚', ['hue'] = 'wɛʔk̚', ['hcmc'] = 'wɛʔk̚' },
['oi'] = { ['hn'] = 'ɔj', ['hue'] = 'ɔj', ['hcmc'] = 'ɔj' },
['om'] = { ['hn'] = 'ɔm', ['hue'] = 'ɔm', ['hcmc'] = 'ɔm' },
['on'] = { ['hn'] = 'ɔn', ['hue'] = 'ɔŋ', ['hcmc'] = 'ɔŋ' },
['ong'] = { ['hn'] = 'ɐwŋ͡m', ['hue'] = 'ɐwŋ͡m', ['hcmc'] = 'ɐwŋ͡m' },
['ooc'] = { ['hn'] = 'ɔʔk̚', ['hue'] = 'ɔʔk̚', ['hcmc'] = 'ɔʔk̚' },
['oong'] = { ['hn'] = 'ɔŋ', ['hue'] = 'ɔŋ͡m', ['hcmc'] = 'ɔŋ' },
['op'] = { ['hn'] = 'ɔʔp̚', ['hue'] = 'ɔʔp̚', ['hcmc'] = 'ɔʔp̚' },
['ot'] = { ['hn'] = 'ɔʔt̚', ['hue'] = 'ɔʔk̚', ['hcmc'] = 'ɔʔk̚' },
['ô'] = { ['hn'] = 'o', ['hue'] = 'ow', ['hcmc'] = 'ow' },
['ôc'] = { ['hn'] = 'ɜwʔk͡p̚', ['hue'] = 'ɜwʔk͡p̚', ['hcmc'] = 'ɜwʔk͡p̚' },
['ôi'] = { ['hn'] = 'oj', ['hue'] = 'oj', ['hcmc'] = 'oj' },
['ôm'] = { ['hn'] = 'om', ['hue'] = 'om', ['hcmc'] = 'om' },
['ôn'] = { ['hn'] = 'on', ['hue'] = 'oŋ', ['hcmc'] = 'oŋ' },
['ông'] = { ['hn'] = 'ɜwŋ͡m', ['hue'] = 'ɜwŋ͡m', ['hcmc'] = 'ɜwŋ͡m' },
['ôôc'] = { ['hn'] = 'oʔk̚', ['hue'] = 'oʔk̚', ['hcmc'] = 'oʔk̚' },
['ôông'] = { ['hn'] = 'oŋ', ['hue'] = 'oŋ', ['hcmc'] = 'oŋ' },
['ôp'] = { ['hn'] = 'oʔp̚', ['hue'] = 'oʔp̚', ['hcmc'] = 'oʔp̚' },
['ôt'] = { ['hn'] = 'oʔt̚', ['hue'] = 'oʔk̚', ['hcmc'] = 'oʔk̚' },
['ơ'] = { ['hn'] = 'əːɰ', ['hue'] = 'əːɰ', ['hcmc'] = 'əːɰ' },
['ơi'] = { ['hn'] = 'əːj', ['hue'] = 'əːj', ['hcmc'] = 'əːj' },
['ơm'] = { ['hn'] = 'əːm', ['hue'] = 'əːm', ['hcmc'] = 'əːm' },
['ơn'] = { ['hn'] = 'əːn', ['hue'] = 'əːŋ', ['hcmc'] = 'əːŋ' },
['ơng'] = { ['hn'] = 'əːŋ', ['hue'] = 'əːŋ', ['hcmc'] = 'əːŋ' },
['ơp'] = { ['hn'] = 'əːʔp̚', ['hue'] = 'əːʔp̚', ['hcmc'] = 'əːʔp̚' },
['ơt'] = { ['hn'] = 'əːʔt̚', ['hue'] = 'əːʔk̚', ['hcmc'] = 'əːʔk̚' },
['u'] = { ['hn'] = 'u', ['hue'] = 'ʊw', ['hcmc'] = 'ʊw' },
['ua'] = { ['hn'] = 'uɜ', ['hue'] = 'uɜ', ['hcmc'] = 'uɜ' },
['uac'] = { ['hn'] = 'waːʔk̚', ['hue'] = 'waːʔk̚', ['hcmc'] = 'waːʔk̚' },
['uach'] = { ['hn'] = 'wɐjʔk̟̚', ['hue'] = 'wɐʔt̚', ['hcmc'] = 'wɐʔt̚' },
['uai'] = { ['hn'] = 'waːj', ['hue'] = 'waːj', ['hcmc'] = 'waːj' },
['uan'] = { ['hn'] = 'waːn', ['hue'] = 'waːŋ', ['hcmc'] = 'waːŋ' },
['uang'] = { ['hn'] = 'waːŋ', ['hue'] = 'waːŋ', ['hcmc'] = 'waːŋ' },
['uanh'] = { ['hn'] = 'wɐjŋ̟', ['hue'] = 'wɐn', ['hcmc'] = 'wɐn' },
['uao'] = { ['hn'] = 'waːw', ['hue'] = 'waːw', ['hcmc'] = 'waːw' },
['uat'] = { ['hn'] = 'waːʔt̚', ['hue'] = 'waːʔk̚', ['hcmc'] = 'waːʔk̚' },
['uau'] = { ['hn'] = 'wɐw', ['hue'] = 'wɐw', ['hcmc'] = 'wa(ː)w' },
['uay'] = { ['hn'] = 'wɐj', ['hue'] = 'wɐj', ['hcmc'] = 'wɐj' },
['uă'] = { ['hn'] = 'wɐ', ['hue'] = 'wɐ', ['hcmc'] = 'wɐ' },
['uăc'] = { ['hn'] = 'wɐʔk̚', ['hue'] = 'wɐʔk̚', ['hcmc'] = 'wɐʔk̚' },
['uăm'] = { ['hn'] = 'wɐm', ['hue'] = 'wɐm', ['hcmc'] = 'wɐm' },
['uăn'] = { ['hn'] = 'wɐn', ['hue'] = 'wɐŋ', ['hcmc'] = 'wɐŋ' },
['uăng'] = { ['hn'] = 'wɐŋ', ['hue'] = 'wɐŋ', ['hcmc'] = 'wɐŋ' },
['uăp'] = { ['hn'] = 'wɐʔp̚', ['hue'] = 'wɐʔp̚', ['hcmc'] = 'wɐʔp̚' },
['uăt'] = { ['hn'] = 'wɐʔt̚', ['hue'] = 'wɐʔk̚', ['hcmc'] = 'wɐʔk̚' },
['uâ'] = { ['hn'] = 'wɜ', ['hue'] = 'wɜ', ['hcmc'] = 'wɜ' },
['uâc'] = { ['hn'] = 'wɜʔk̚', ['hue'] = 'wɜʔk̚', ['hcmc'] = 'wɜʔk̚' },
['uân'] = { ['hn'] = 'wɜn', ['hue'] = 'wɜŋ', ['hcmc'] = 'wɜŋ' },
['uâng'] = { ['hn'] = 'wɜŋ', ['hue'] = 'wɜŋ', ['hcmc'] = 'wɜŋ' },
['uât'] = { ['hn'] = 'wɜʔt̚', ['hue'] = 'wɜʔk̚', ['hcmc'] = 'wɜʔk̚' },
['uây'] = { ['hn'] = 'wɜj', ['hue'] = 'wɜj', ['hcmc'] = 'wɜj' },
['uc'] = { ['hn'] = 'ʊwʔk͡p̚', ['hue'] = 'ʊwʔk͡p̚', ['hcmc'] = 'ʊwʔk͡p̚' },
['ue'] = { ['hn'] = 'wɛ', ['hue'] = 'wɛ', ['hcmc'] = 'wɛ' },
['uen'] = { ['hn'] = 'wɛn', ['hue'] = 'wɛŋ', ['hcmc'] = 'wɛŋ' },
['ueo'] = { ['hn'] = 'wɛw', ['hue'] = 'wɛw', ['hcmc'] = 'wɛw' },
['uep'] = { ['hn'] = 'wɛʔp̚', ['hue'] = 'wɛʔp̚', ['hcmc'] = 'wɛʔp̚' },
['uet'] = { ['hn'] = 'wɛʔt̚', ['hue'] = 'wɛʔt̚', ['hcmc'] = 'wɛʔt̚' },
['uê'] = { ['hn'] = 'we', ['hue'] = 'wej', ['hcmc'] = 'wej' },
['uêch'] = { ['hn'] = 'wɜjʔk̟̚', ['hue'] = 'weʔt̚', ['hcmc'] = 'wɜːʔt̚' },
['uên'] = { ['hn'] = 'wen', ['hue'] = 'wen', ['hcmc'] = 'wɜːn' },
['uênh'] = { ['hn'] = 'wɜjŋ̟', ['hue'] = 'wen', ['hcmc'] = 'wɜːn' },
['uêt'] = { ['hn'] = 'weʔt̚', ['hue'] = 'weʔt̚', ['hcmc'] = 'wɜːʔt̚' },
['uêu'] = { ['hn'] = 'weu', ['hue'] = 'weu', ['hcmc'] = 'wew' },
['ui'] = { ['hn'] = 'uj', ['hue'] = 'uj', ['hcmc'] = 'uj' },
['uin'] = { ['hn'] = 'win', ['hue'] = 'win', ['hcmc'] = 'wɨ̞̠n' },
['uit'] = { ['hn'] = 'wiʔt̚', ['hue'] = 'wiʔt̚', ['hcmc'] = 'wiʔt̚' },
['um'] = { ['hn'] = 'um', ['hue'] = 'um', ['hcmc'] = 'ʊm' },
['un'] = { ['hn'] = 'un', ['hue'] = 'un', ['hcmc'] = 'ʊwŋ͡m' },
['ung'] = { ['hn'] = 'ʊwŋ͡m', ['hue'] = 'ʊwŋ͡m', ['hcmc'] = 'ʊwŋ͡m' },
['unh'] = { ['hn'] = 'ujŋ̟', ['hue'] = 'un', ['hcmc'] = 'uwn' },
['uô'] = { ['hn'] = 'uɜ', ['hue'] = 'uɜ', ['hcmc'] = 'uɜ' },
['uôc'] = { ['hn'] = 'uɜʔk̚', ['hue'] = 'uɜʔk̚', ['hcmc'] = 'uɜʔk̚' },
['uôi'] = { ['hn'] = 'uɜj', ['hue'] = 'uj', ['hcmc'] = 'uj' },
['uôm'] = { ['hn'] = 'uɜm', ['hue'] = 'uɜm', ['hcmc'] = 'uɜm' },
['uôn'] = { ['hn'] = 'uɜn', ['hue'] = 'uɜŋ', ['hcmc'] = 'uɜŋ' },
['uông'] = { ['hn'] = 'uɜŋ', ['hue'] = 'uɜŋ', ['hcmc'] = 'uɜŋ' },
['uôt'] = { ['hn'] = 'uɜʔt̚', ['hue'] = 'uɜʔk̚', ['hcmc'] = 'uɜʔk̚' },
['uơ'] = { ['hn'] = 'wəː', ['hue'] = 'wəː', ['hcmc'] = 'wəː' },
['uơi'] = { ['hn'] = 'wəːj', ['hue'] = 'wəːj', ['hcmc'] = 'wəːj' },
['uơn'] = { ['hn'] = 'uɜn', ['hue'] = 'wɜŋ', ['hcmc'] = 'wɜŋ' },
['uơt'] = { ['hn'] = 'uɜʔt̚', ['hue'] = 'wɜʔk̚', ['hcmc'] = 'wɜʔk̚' },
['up'] = { ['hn'] = 'uʔp̚', ['hue'] = 'uʔp̚', ['hcmc'] = 'ʊʔp̚' },
['ut'] = { ['hn'] = 'uʔt̚', ['hue'] = 'ʊʔk̚', ['hcmc'] = 'ʊʔk͡p̚' },
['uy'] = { ['hn'] = 'wi', ['hue'] = 'wɪj', ['hcmc'] = 'wɪj' },
['uya'] = { ['hn'] = 'wiɜ', ['hue'] = 'wiɜ', ['hcmc'] = 'wiɜ' },
['uych'] = { ['hn'] = 'wïʔk̟̚', ['hue'] = 'wɨ̞̠ʔk̟̚', ['hcmc'] = 'wɨ̞̠ʔt̚' },
['uyn'] = { ['hn'] = 'win', ['hue'] = 'win', ['hcmc'] = 'wɨ̞̠n' },
['uich'] = { ['hn'] = 'wïʔk̟̚', ['hue'] = 'wɨ̞̠ʔk̟̚', ['hcmc'] = 'wɨ̞̠ʔt̚' },
['uyê'] = { ['hn'] = 'wiɜ', ['hue'] = 'wiɜ', ['hcmc'] = 'wiɜ' },
['uyên'] = { ['hn'] = 'wiɜn', ['hue'] = 'wiɜŋ', ['hcmc'] = 'wiɜŋ' },
['uyênh'] = { ['hn'] = 'wiɜŋ̟', ['hue'] = 'wiɜn', ['hcmc'] = 'wɜn' },
['uyêt'] = { ['hn'] = 'wiɜʔt̚', ['hue'] = 'wiɜʔk̚', ['hcmc'] = 'wiɜʔk̚' },
['uynh'] = { ['hn'] = 'wïŋ̟', ['hue'] = 'wɨ̞̠n', ['hcmc'] = 'wɨ̞̠n' },
['uyp'] = { ['hn'] = 'wiʔp̚', ['hue'] = 'wiʔp̚', ['hcmc'] = 'wiʔp̚' },
['uyt'] = { ['hn'] = 'wiʔt̚', ['hue'] = 'wɨ̞̠ʔt̚', ['hcmc'] = 'wɨ̞̠ʔt̚' },
['uyu'] = { ['hn'] = 'wiw', ['hue'] = 'wiw', ['hcmc'] = 'wiw' },
['ư'] = { ['hn'] = 'ɨ̞̠', ['hue'] = 'ɨ̞̠ɰ', ['hcmc'] = 'ɨ̞̠ɰ' },
['ưa'] = { ['hn'] = 'ɨ̞̠ɜ', ['hue'] = 'ɨ̞̠ɜ', ['hcmc'] = 'ɨ̞̠ɜ' },
['ưc'] = { ['hn'] = 'ɨ̞̠ʔk̚', ['hue'] = 'ɨ̞̠ʔk̚', ['hcmc'] = 'ɨ̞̠ʔk̚' },
['ưi'] = { ['hn'] = 'ɨ̞̠j', ['hue'] = 'ɨ̞̠j', ['hcmc'] = 'ɨ̞̠j' },
['ưn'] = { ['hn'] = 'ɨ̞̠n', ['hue'] = 'ɨ̞̠ŋ', ['hcmc'] = 'ɨ̞̠ŋ' },
['ưng'] = { ['hn'] = 'ɨ̞̠ŋ', ['hue'] = 'ɨ̞̠ŋ', ['hcmc'] = 'ɨ̞̠ŋ' },
['ươc'] = { ['hn'] = 'ɨ̞̠ɜʔk̚', ['hue'] = 'ɨ̞̠ɜʔk̚', ['hcmc'] = 'ɨ̞̠ɜʔk̚' },
['ươi'] = { ['hn'] = 'ɨ̞̠ɜj', ['hue'] = 'ɨ̞̠ɜj', ['hcmc'] = 'ɨ̞̠ɜj' },
['ươm'] = { ['hn'] = 'ɨ̞̠ɜm', ['hue'] = 'ɨ̞̠ɜm', ['hcmc'] = 'ɨ̞̠ɜm' },
['ươn'] = { ['hn'] = 'ɨ̞̠ɜn', ['hue'] = 'ɨ̞̠ɜŋ', ['hcmc'] = 'ɨ̞̠ɜŋ' },
['ương'] = { ['hn'] = 'ɨ̞̠ɜŋ', ['hue'] = 'ɨ̞̠ɜŋ', ['hcmc'] = 'ɨ̞̠ɜŋ' },
['ươp'] = { ['hn'] = 'ɨ̞̠ɜʔp̚', ['hue'] = 'ɨ̞̠ɜʔp̚', ['hcmc'] = 'ɨ̞̠ɜʔp̚' },
['ươt'] = { ['hn'] = 'ɨ̞̠ɜʔt̚', ['hue'] = 'ɨ̞̠ɜʔk̚', ['hcmc'] = 'ɨ̞̠ɜʔk̚' },
['ươu'] = { ['hn'] = 'iɜw', ['hue'] = 'ɨ̞̠ɜw', ['hcmc'] = 'ɨ̞̠ɜw' },
['ưt'] = { ['hn'] = 'ɨ̞̠ʔt̚', ['hue'] = 'ɨ̞̠ʔk̚', ['hcmc'] = 'ɨ̞̠ʔk̚' },
['ưu'] = { ['hn'] = 'iw', ['hue'] = 'ɨ̞̠w', ['hcmc'] = 'ɨ̞̠w' },
['y'] = { ['hn'] = 'i', ['hue'] = 'ɪj', ['hcmc'] = 'ɪj' },
['yêc'] = { ['hn'] = 'iɜʔk̚', ['hue'] = 'iɜʔk̚', ['hcmc'] = 'iɜʔk̚' },
['yêm'] = { ['hn'] = 'iɜm', ['hue'] = 'iɜm', ['hcmc'] = 'iɜm' },
['yên'] = { ['hn'] = 'iɜn', ['hue'] = 'iɜŋ', ['hcmc'] = 'iɜŋ' },
['yêng'] = { ['hn'] = 'iɜŋ', ['hue'] = 'iɜŋ', ['hcmc'] = 'iɜŋ' },
['yêp'] = { ['hn'] = 'iɜʔp̚', ['hue'] = 'iɜʔp̚', ['hcmc'] = 'iɜʔp̚' },
['yêt'] = { ['hn'] = 'iɜʔt̚', ['hue'] = 'iɜʔk̚', ['hcmc'] = 'iɜʔk̚' },
['yêu'] = { ['hn'] = 'iɜw', ['hue'] = 'iɜw', ['hcmc'] = 'iɜw' },
}
local varieties = {
['hn'] = { 'Hà Nội', 1 },
['hue'] = { 'Huế', 2 },
['hcmc'] = { 'Hồ Chí Minh City', 3 },
}
local hcmc_opt_w = {
['ch'] = true,
['d'] = true,
['l'] = true,
['s'] = true,
['t'] = true, ['th'] = true, ['tr'] = true,
['x'] = true,
}
function export.ipa(frame)
local p, output = {}, { ['hn'] = {}, ['hue'] = {}, ['hcmc'] = {} }
local output_text = {}
local pronunciations = { ['hn'] = {}, ['hue'] = {}, ['hcmc'] = {} }
local pagename = gsub(gsub(mw.ustring.lower(mw.title.getCurrentTitle().text), '%-', ' '), '%,', '')
local args = frame:getParent().args
local mvi = frame.args["mvi"] or nil
if args[1] then
for index, item in ipairs(args) do
table.insert(p, (item ~= "") and mw.ustring.lower(gsub(gsub(item, '%-', ' '), '%,', '')) or nil)
end
else
table.insert(p, pagename)
end
for variety, _ in ipairs(varieties) do
table.insert(pronunciations[variety], (args[variety] ~= "") and args[variety] or nil)
end
for i, word in ipairs(p) do
local pronunciations = { ['hn'] = {}, ['hue'] = {}, ['hcmc'] = {} }
for syllable in mw.text.gsplit(word, ' ', true) do
local ipa = {}
local initial, final, tone = nil, nil, nil, nil
tone = 1
for diac_pattern, tone_num in pairs(tone_diacritics) do
if match(syllable, diac_pattern) then
tone = tone_num
break
end
end
syllable = gsub(syllable, '[àằầèềìòồờùừỳáắấéếíóốớúứýảẳẩẻểỉỏổởủửỷãẵẫẽễĩõỗỡũữỹạặậẹệịọộợụựỵ]', detone)
if syllable == 'gi' then
syllable = 'giy'
end
initial = match(syllable, '^g[ꞗꞖbcdđgklmnpqrstvx]+') or match(syllable, '^g[hiy]?')
or match(syllable, '^[ꞗꞖbcdđghklmnpqrstvx]+') or ''
initial = (match(syllable, '^giê.') and syllable ~= 'giên') and 'd' or initial
final = sub(syllable, mw.ustring.len(initial) + 1, -1)
for loc, location in pairs(varieties) do
local ipa, initial_type, detoned = {}, loc, ''
if match(final,'[ou][aăeâêôơy][ioyêu]?[cmntp]?[hg]?') and loc == 'hcmc' then
initial_type = 'hcmc_w'
end
if mvi then
if mvi_initial_ipa[initial] then
table.insert(ipa, mvi_initial_ipa[initial])
else
local initial_cluster = ''
for cc in mw.ustring.gcodepoint(initial) do
local ch = mw.ustring.char(cc)
initial_cluster = initial_cluster .. mvi_initial_ipa[ch]
end
table.insert(ipa, initial_cluster)
end
elseif initial_ipa[initial] then
table.insert(ipa, initial_ipa[initial][initial_type])
else
local initial_cluster = ''
for cc in mw.ustring.gcodepoint(initial) do
local ch = mw.ustring.char(cc)
initial_cluster = initial_cluster .. initial_ipa[ch][initial_type]
end
initial_cluster = gsub(initial_cluster, '([cgknpt]h)', function(digraph)
return initial_ipa[digraph][initial_type] end)
table.insert(ipa, initial_cluster)
end
if final_ipa[final] then
detoned = gsub(final_ipa[final][loc], '^([wu].+)', function(nucleus)
if initial .. final == 'qua' then
nucleus = final_ipa['oa'][loc]
elseif initial .. final == 'qui' then
nucleus = final_ipa['uy'][loc]
end
if loc == 'hcmc' then
if initial == 'q' then
nucleus = gsub(nucleus, '^u', 'w')
end
if hcmc_opt_w[initial] then
nucleus = gsub(nucleus, '^w', '<sup>(</sup>ʷ<sup>)</sup>')
end
end
return nucleus end)
table.insert(ipa, detoned)
else
error(("Unrecognised final: \"%s\""):format(final))
end
if tone == 3 and match(final, '[chmngpt]') then
tone = '3a'
end
table.insert(ipa, tone_contour[loc][tone])
table.insert(pronunciations[loc], table.concat(ipa, ""))
end
end
for loc, location in pairs(varieties) do
table.insert(output[loc], table.concat(pronunciations[loc], " "))
end
end
for loc, location in pairs(varieties) do
if mvi then
args['hue'], args['hcmc'] = '-', '-'
end
if args[loc] ~= '-' then
if not args[loc] then
args[loc] = table.concat(output[loc], "/, /")
end
table.insert(output_text, location[2], '* (\'\'[[w:' .. location[1] .. '|' .. location[1] .. ']]\'\') ' ..
'[[Wiktionary:Фонетикии алифбои байналмилалӣ|ФАБ]] <sup>([[Appendix:Ветнами талаффузи|калид]])</sup>: <span class="IPA">/' ..
args[loc] .. '/</span>')
end
end
if table.concat(p, "") ~= mw.ustring.lower(pagename) then
table.insert(output_text, #output_text + 1, '* \'\'Phonetic\'\': ' .. table.concat(p, ", "))
end
return table.concat(output_text, "\n")
end
return export