Jump to content

Module:cmn-pron-Wuhan

From Wiktionary, the free dictionary

This module is experimental.
The details of its operation have not yet been fully decided upon. Do not deploy widely until the module is finished.

Pronunciation module for Wuhan Mandarin.


-- Mostly based on the online Wuhan dictionary and Chinese Wikipedia article
local export = {}
local find = mw.ustring.find
local gsub = mw.ustring.gsub
local match = mw.ustring.match
local gmatch = mw.ustring.gmatch
local gsplit = mw.text.gsplit
local lower = mw.ustring.lower
local upper = mw.ustring.upper

local dtone = {
	['ā'] = 'a', ['á'] = 'a', ['ǎ'] = 'a', ['à'] = 'a', 
	['ō'] = 'o', ['ó'] = 'o', ['ǒ'] = 'o', ['ò'] = 'o', 
	['ē'] = 'e', ['é'] = 'e', ['ě'] = 'e', ['è'] = 'e',
	['ī'] = 'i', ['í'] = 'i', ['ǐ'] = 'i', ['ì'] = 'i', 
	['ū'] = 'u', ['ú'] = 'u', ['ǔ'] = 'u', ['ù'] = 'u', 
	['ǖ'] = 'ü', ['ǘ'] = 'ü', ['ǚ'] = 'ü', ['ǜ'] = 'ü',
}

local initialConv = {
		['b'] = 'p', ['p'] = 'pʰ', ['m'] = 'm', ['f'] = 'f', 
		['d'] = 't', ['t'] = 'tʰ', ['n'] = 'n', ['l'] = 'l',  --I'm not sure whether to add "l"
		['g'] = 'k', ['k'] = 'kʰ', ['h'] = 'x', ['ng'] = 'ŋ', 
		['j'] = 't͡ɕ', ['q'] = 't͡ɕʰ', ['x'] = 'ɕ', 
		['z'] = 't͡s', ['c'] = 't͡sʰ', ['s'] = 's', ['r'] = "ɻ",
		[''] = ''
}

local finalConv = {
	["ir"] = "z̩", --not sure whether to preserve this

	["a"] = "a", ["o"] = "o", ["e"] = "ɯ", --recording for "e" sounds like "ɚ"
	["ai"] = "ai", ["ei"] = "ei", ["ao"] = "au", ["ou"] = "ou",
	["an"] = "an", ["en"] = "ən", ["ang"] = "aŋ", ["ong"] = "oŋ",

	["i"] = "i", ["ia"] = "ia", ["io"] = "io", ["ie"] = "ie",
	["iao"] = "iau", ["iu"] = "iou",
	["ian"] = "iɛn", ["in"] = "in", ["iang"] = "iaŋ", ["iong"] = "ioŋ",

	["u"] = "u", ["ua"] = "ua", ["uo"] = "uɤ",
	["uai"] = "uai", ["ui"] = "uei",
	["uan"] = "uan", ["un"] = "uən", ["uang"] = "uaŋ",

	["ü"] = "y", ["üe"] = "ye", --I don't know how to incorporate the 白读 of 靴
	["üan"] = "yɛn", ["ün"] = "yn",
}

local toneConv = {
	["1"] = "⁴⁵", ["2"] = "²¹³", ["3"] = "⁴²", ["4"] = "³⁵", ["-"] = "⁻",
}

return export