Module:aa-IPA

local export = {}

local m_IPA = require("Module:IPA") local lang = require("Module:languages").getByCode("aa") local rsub = mw.ustring.gsub local rlower = mw.ustring.lower

local V = "[aeiou]" local C = "[bħdfɡhɟklmnpʕrstwɖjzʃ]" local Ci = "[bcdfghjklmnpqrstwxyz]"

local phon = { ["a"]="a", ["b"]="b", ["c"]="ħ", ["d"]="d", ["e"]="e", ["f"]="f", ["g"]="ɡ", ["h"]="h", ["i"]="i", ["j"]="ɟ", ["k"]="k", ["l"]="l", ["m"]="m", ["n"]="n", ["o"]="o", ["p"]="p", ["q"]="ʕ", ["r"]="r", ["s"]="s", ["t"]="t", ["u"]="u", ["w"]="w", ["x"]="ɖ", ["y"]="j", ["z"]="z", ["á"]="aˈ", ["é"]="eˈ", ["í"]="iˈ", ["ó"]="oˈ", ["ú"]="uˈ", ["à"]="aˌ", ["è"]="eˌ", ["ì"]="iˌ", ["ò"]="oˌ", ["ù"]="uˌ", }

local function phonemic(text) text = rlower(text) -- general phonology text = rsub(text, ".", phon) -- digraphs text = rsub(text, "(" .. V .. ")([ˈˌ]?)%1", "%1ː%2") text = rsub(text, "sh", "ʃ") text = rsub(text, "(" .. C .. "?)(" .. V .. "ː?)([ˈˌ])", "%3%1%2") text = rsub(text, "(" .. C .. ")%1", "%1ː") text = rsub(text, "ɟ", "d͡ʒ") return(text) end

local function phonetic(text) text = phonemic(text) -- retroflex text = rsub(text, "(" .. V .. "[ˈˌ]?)ɖ(" .. V .. ")", "%1ɽ%2") text = rsub(text, "n([ˈˌ]?)ɖ", "ɳ%1ɖ") text = rsub(text, "s([ˈˌ]?)ɖ", "ʂ%1ɖ") -- other consonants text = rsub(text, "n([ˈˌ]?)([kɡ])", "ŋ%1%2") text = rsub(text, "r", "ɾ") text = rsub(text, "ɾː", "rː") text = rsub(text, "ɾ([ˈˌ])ɾ", "r%1r") text = rsub(text, "([kpt])([ˈˌ])", "%1ʰ%2") text = rsub(text, "([kpt])$", "ʰ%1") -- vowels text = rsub(text, "^([ˈˌ]?)(" .. V .. ")", "%1ʔ%2") text = rsub(text, "a", "ʌ") text = rsub(text, "e", "ɛ") text = rsub(text, "i", "ɪ") text = rsub(text, "o", "ɔ") text = rsub(text, "u", "ʊ") text = rsub(text, "ʕʌ", "ʕa") text = rsub(text, "ʕɛ", "ʕe") text = rsub(text, "ʕɪ", "ʕi") text = rsub(text, "ʕɔ", "ʕo") text = rsub(text, "ʕʊ", "ʕu") text = rsub(text, "ʌː", "aː") text = rsub(text, "ɛː", "eː") text = rsub(text, "ɪː", "iː") text = rsub(text, "ɔː", "oː") text = rsub(text, "ʊː", "uː") return(text) end

function export.syllabify(term) --split for hyphenation local H, i = {}, 0 for a in string.gmatch(rsub(term, "([aeiou]" .. Ci .. "?)(" .. Ci .. ")%f[aeiou]", "%1.%2"), "[^%.-/]+") do 		i = i+1 H[i] = a 	end return H end

function export.show(frame) local parent_args = frame:getParent.args local params = { [1] = {list = true, required = true} }	local args = require("Module:parameters").process(parent_args, params)

local p = args[1] local phol = {} for _, word in ipairs(p) do table.insert(phol, {pron = "/" .. phonemic(word) .. "/ [" .. phonetic(word) .. "]"}) end

local H = "" local title = mw.loadData("Module:headword/data").pagename if mw.ustring.match(title, "^[^%-].+[^%-]$") then H = export.syllabify(title) H = "\n* " .. require("Module:hyphenation").format_hyphenations { lang = lang, hyphs = } end

return "* " .. m_IPA.format_IPA_full { lang = lang, items = phol } .. H end

return export