-- This module is for 東莞話 (Dongguan Yue/Cantonese), a lect of Yue Chinese
-- Representative dialect: 莞城
-- Romanisation: Jyutping++ (referred to as jpp below)
-- References:
-- 1. 東莞方言詞典 (1997) by 詹伯慧 and 陳曉錦
-- 2. 珠江三角洲方言字音對照 (1987)
-- Also see ]
local export = {}
-- l merges into ng
local initials = {
b = "p", p = "pʰ", m = "m", f = "f",
d = "t", t = "tʰ", n = "n",
z = "t͡s", c = "t͡sʰ", s = "s",
g = "k", k = "kʰ", ng = "ŋ", h = "h",
gw = "kʷ", kw = "kʰʷ",
j = "z", w = "v",
= "", -- glottal stop?
}
local finals = {
aa="a",aai="ai",aau="au", aang="aŋ",aah="aʔ", aak="ak̚",
ai="ɐi", am="ɐm", an="ɐn", ap="ɐp̚", at="ɐt̚", ak="ɐk̚",
e="ɛ", eng="ɛŋ", ek="ɛk̚",
eang="əŋ", eak="ək̚",
oe="ø", oen="øn",oeng="øŋ", oet="øt̚",oek="øk̚",
o="ɔ", oi="ɔi", ou="ɔu", ong="ɔŋ", ok="ɔk̚",
i="i", iu="iu", ="in", it="it̚", ik="ɪk̚",
u="u", ui="ui", un="un", ung="ʊŋ", ut="ut̚", uk="ʊk̚",
yu="yu",
m="m̩",
}
-- "6" merges into "3"
local tones = {
= "²¹³",--陰平
= "³⁵", --陰上
= "³²", --去
= "²¹", --陽平
= "¹³", --陽上
= "⁴⁴", --陰入
= "²²", --陽入
= "²⁴", --變入
= "⁵⁵", --(變調)
}
local function validate(text)
text = text:gsub(","," ")
if text:match("%d%d") then
error("Dongguan: Please use a hyphen to indicate a changed tone.")
end
if text:sub(1,1) == " " or text:sub(-1,-1) == " " or text:match(" ") then
error("Dongguan: Empty syllable detected.")
end
end
function export.jpp_to_ipa(text)
validate(text)
text = text:gsub("+",function(syllable)
local a,b,c,d = syllable:match("^(??)(%l*)()%-?(?)$")
if not a then
error("Dongguan: Invalid syllable: " .. syllable)
end
return (initials or error("Dongguan: Unrecognised initial: " .. a))
.. (finals or error("Dongguan: Unrecognised final: " .. b))
.. tones
.. (d ~= "" and ("⁻" .. tones) or "")
end)
:gsub(",", "/, /")
return "/" .. text .. "/"
end
return export