Module:zgh-pronunciation

local export = {}

-- single characters that map to IPA sounds local phonetic_chars_map = { ["ⴰ"]="a", ["ⴱ"]="b", ["ⴳ"]="ɡ", ["ⴷ"]="d", ["ⴹ"]="dˤ", ["ⴻ"]="ə", ["ⴼ"]="f", ["ⴽ"]="k", ["ⵀ"]="h", ["ⵃ"]="ħ", ["ⵄ"]="ʕ",["ⵅ"]="χ", ["ⵇ"]="q", ["ⵉ"]="i", ["ⵊ"]="ʒ", ["ⵍ"]="l", ["ⵎ"]="m", ["ⵏ"]="n", ["ⵓ"]="u", ["ⵔ"]="r", ["ⵕ"]="rˤ", ["ⵖ"]="ɣ", ["ⵙ"]="s", ["ⵚ"]="sˤ", ["ⵛ"]="ʃ", ["ⵜ"]="t", ["ⵟ"]="tˤ", ["ⵡ"]="w", ["ⵢ"]="j", ["ⵣ"]="z", ["ⵥ"]="zˤ", ["ⵯ"]="ʷ" }

function export.pronunciation(word)

if type(word) == "table" then word = word.args[1] or word:getParent.args[1] end if not word or (word == "") then error("Please put the word as the first positional parameter!") end

local phonetic = word

-- then long consonants that are orthographically geminated. phonetic = mw.ustring.gsub(phonetic, "(.)%1", "%1ː")

phonetic = mw.ustring.gsub(phonetic, '.', phonetic_chars_map)

return phonetic end return export