Module:tzm-IPA

local export = {}

local m_IPA = require("Module:IPA") local m_scripts = require("Module:scripts") local m_scripts_util = require("Module:script utilities") local m_a = require("Module:accent qualifier") local lang = require("Module:languages").getByCode("tzm") local s = mw.ustring.gsub

local c = { ["g"] = "ɡ", ["ḍ"] = "dˤ", ["ḏ"] = "ð", ["c"] = "ʃ", ["j"] = "ʒ", ["y"] = "j", ["ẓ"] = "zˤ", ["ṛ"] = "rˤ", ["ṣ"] = "sˤ", ["ṭ"] = "tˤ", ["ḥ"] = "ħ", ["ɛ"] = "ʕ", ["e"] = "ə" } local p = { ["ɣ"] = "ʁ", ["ɡʷ"] = "ɣʷ", ["tˤ"] = "Tˤ", ["x"] = "χ", ["kʷ"] = "xʷ", ["a"] = "æ", ["ɡ"] = "ʝ", ["d"] = "ð", ["dˤ"] = "ðˤ", ["k"] = "ç", ["n"] = "N", ["t"] = "θ", ["b"] = "β" } local t = { ["ʝ"] = "ɟː", ["ð"] = "Dː", ["ðˤ"] = "Tˤː", ["f"] = "fː", ["ʁ"] = "qː", ["ç"] = "cː", ["l"] = "lː", ["m"] = "mː", ["N"] = "Nː", ["r"] = "rː", ["s"] = "sː", ["ʃ"] = "Cː", ["θ"] = "Tː", ["w"] = "wː", ["j"] = "ɟː", ["z"] = "zː", ["zˤ"] = "zˤː", ["β"] = "bː", ["χ"] = "χː", ["ʒ"] = "Jː", ["ɣʷ"] = "ɡʷː", ["rˤ"] = "rˤː", ["sˤ"] = "sˤː", ["Tˤ"] = "Tˤː", ["q"] = "qː", ["ħ"] = "ħː", ["ʕ"] = "ʕː", ["xʷ"] = "kʷː" }

local C = "[ɡɟʝDdðfɣʁkcçlmNnrsʃCTtθwjzbβhxχʒJqħʕ]" local V = "[aiuəæɑ]"

local r = { ["a"] = { ["^(" .. C .. "?[ˤʷ]?ː?" .. C .. "?[ˤʷ]?" .. V .. ")ʝ(" .. V .. "%(?" .. C .. "?%)?[ˤʷ]?ː?" .. C .. "?[ˤʷ]?)$"] = "%1jː%2", ["^(" .. C .. "?[ˤʷ]?ː?" .. C .. "?[ˤʷ]?" .. V .. ")ɣʷ(" .. V .. "%(?" .. C .. "?%)?[ˤʷ]?ː?" .. C .. "?[ˤʷ]?)$"] = "%1wː%2", ["^(" .. C .. "?[ˤʷ]?ː?" .. C .. "?[ˤʷ]?" .. V .. ")ʁ(" .. V .. "%(?" .. C .. "?%)?[ˤʷ]?ː?" .. C .. "?[ˤʷ]?)$"] = "%1ʁː%2", ["^(" .. C .. "?[ˤʷ]?ː?" .. C .. "?[ˤʷ]?" .. V .. ")ʝ(" .. V .. "%(?" .. C .. "?%)?[ˤʷ]?ː?" .. C .. "?[ˤʷ]?[‿ ])"] = "%1jː%2", ["^(" .. C .. "?[ˤʷ]?ː?" .. C .. "?[ˤʷ]?" .. V .. ")ɣʷ(" .. V .. "%(?" .. C .. "?%)?[ˤʷ]?ː?" .. C .. "?[ˤʷ]?[‿ ])"] = "%1wː%2", ["^(" .. C .. "?[ˤʷ]?ː?" .. C .. "?[ˤʷ]?" .. V .. ")ʁ(" .. V .. "%(?" .. C .. "?%)?[ˤʷ]?ː?" .. C .. "?[ˤʷ]?[‿ ])"] = "%1ʁː%2", ["( ə?" .. C .. "?[ˤʷ]?ː?" .. C .. "?[ˤʷ]?" .. V .. ")ʝ(" .. V .. "%(?" .. C .. "?%)?[ˤʷ]?ː?" .. C .. "?[ˤʷ]?)$"] = "%1jː%2", ["( ə?" .. C .. "?[ˤʷ]?ː?" .. C .. "?[ˤʷ]?" .. V .. ")ɣʷ(" .. V .. "%(?" .. C .. "?%)?[ˤʷ]?ː?" .. C .. "?[ˤʷ]?)$"] = "%1wː%2", ["( ə?" .. C .. "?[ˤʷ]?ː?" .. C .. "?[ˤʷ]?" .. V .. ")ʁ(" .. V .. "%(?" .. C .. "?%)?[ˤʷ]?ː?" .. C .. "?[ˤʷ]?)$"] = "%1ʁː%2", ["( ə?" .. C .. "?[ˤʷ]?ː?" .. C .. "?[ˤʷ]?" .. V .. ")ʝ(" .. V .. "%(?" .. C .. "?%)?[ˤʷ]?ː?" .. C .. "?[ˤʷ]?[‿ ])"] = "%1jː%2", ["( ə?" .. C .. "?[ˤʷ]?ː?" .. C .. "?[ˤʷ]?" .. V .. ")ɣʷ(" .. V .. "%(?" .. C .. "?%)?[ˤʷ]?ː?" .. C .. "?[ˤʷ]?[‿ ])"] = "%1wː%2", ["( ə?" .. C .. "?[ˤʷ]?ː?" .. C .. "?[ˤʷ]?" .. V .. ")ʁ(" .. V .. "%(?" .. C .. "?%)?[ˤʷ]?ː?" .. C .. "?[ˤʷ]?[‿ ])"] = "%1ʁː%2" },   ["b"] = { ["([dtzrs])([^ˤ%1][^ ]-ˤ)"] = "%1ˤ%2", ["(ˤ[^ ]-[dtzrs])([^ˤ%1])"] = "%1ˤ%2", ["(ˤ[^ ]-[dtzrs])$"] = "%1ˤ" },   ["c"] = { ["f([‿ ]?[βðd̪zʒʝɟɣɡʁ])"] = "β%1", ["θ(ˤ?[‿ ]?[βðd̪zʒʝɟɣɡʁ])"] = "ð%1", ["T(ˤ?[‿ ]?[βðd̪zʒʝɟɣɡʁ])"] = "D%1", ["s(ˤ?[‿ ]?[βðd̪zʒʝɟɣɡʁ])"] = "z%1", ["ʃ([‿ ]?[βðd̪zʒʝɟɣɡʁ])"] = "ʒ%1", ["ç([‿ ]?[βðd̪zʒʝɟɣɡʁ])"] = "ʝ%1", ["c([‿ ]?[βðd̪zʒʝɟɣɡʁ])"] = "ɟ%1", ["x(ʷ[‿ ]?[βðd̪zʒʝɟɣɡʁ])"] = "ɣ%1", ["k(ʷ[‿ ]?[βðd̪zʒʝɟɣɡʁ])"] = "ɡ%1", ["χ([‿ ]?[βðd̪zʒʝɟɣɡʁ])"] = "ʁ%1", ["β([‿ ]?[fθt̪sʃçcxkχ])"] = "f%1", ["ð(ˤ?[‿ ]?[fθt̪sʃçcxkχ])"] = "θ%1", ["D(ˤ?[‿ ]?[fθt̪sʃçcxkχ])"] = "T%1", ["z(ˤ?[‿ ]?[fθt̪sʃçcxkχ])"] = "s%1", ["ʒ([‿ ]?[fθt̪sʃçcxkχ])"] = "ʃ%1", ["ʝ(%)?[‿ ]?[fθt̪sʃçcxkχ])"] = "ç%1",       ["ɟ([‿ ]?[fθt̪sʃçcxkχ])"] = "c%1",        ["ɣ(ʷ[‿ ]?[fθt̪sʃçcxkχ])"] = "x%1",        ["ɡ(ʷ[‿ ]?[fθt̪sʃçcxkχ])"] = "k%1",        ["ʁ([‿ ]?[fθt̪sʃçcxkχ])"] = "χ%1"    },    ["d"] = {        ["([^fb])[fb]( ?)([fb])([^fb])"] = "%1%3%2%3%4",        ["^[fb]( ?)([fb])([^fb])"] = "%2%1%2%3",        ["([^fb])[fb]( ?)([fb])$"] = "%1%3%2%3",        ["([^td]ˤ?)[td](ˤ?)( ?)([td])(ˤ?)([^td])"] = "%1%4%2%3%4%5%6",        ["^[td](ˤ?)( ?)([td])(ˤ?)([^td])"] = "%3%1%2%3%4%5",        ["([^td]ˤ?)[td](ˤ?)( ?)([td])(ˤ?)$"] = "%1%4%2%3%4%5",        ["([^sz]ˤ?)[sz](ˤ?)( ?)([sz])(ˤ?)([^sz])"] = "%1%4%2%3%4%5%6",        ["^[sz](ˤ?)( ?)([sz])(ˤ?)([^sz])"] = "%3%1%2%3%4%5",        ["([^sz]ˤ?)[sz](ˤ?)( ?)([sz])(ˤ?)$"] = "%1%4%2%3%4%5",        ["([^ʃʒ])[ʃʒ]( ?)([ʃʒ])([^ʃʒ])"] = "%1%3%2%3%4",        ["^[ʃʒ]( ?)([ʃʒ])([^ʃʒ])"] = "%2%1%2%3",        ["([^ʃʒ])[ʃʒ]( ?)([ʃʒ])$"] = "%1%3%2%3", ["([^kɡj])[kɡj]( ?)([kɡj])([kɡj]ʷ)"] = "%1%3%2%3%4", ["^[kɡj]( ?)([kɡj])([kɡj]ʷ)"] = "%2%1%2%3", ["([^kɡj])[kɡj]( ?)([kɡj])$"] = "%1%3%2%3", ["([^kɡj])[kɡj]( ?)([kɡj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( ?)w([^w])$"] = "ɡʷ%1ɡʷ%2", ["^[kɡ]ʷ( ?)w([^w][‿ ])"] = "ɡʷ%1ɡʷ%2", ["([^ʷkɡw])[kɡ]ʷ( ?)w$"] = "%1ɡʷ%2ɡʷ", ["([^xqɣ])[xqɣ]( ?)([xqɣ])([^xqɣ])"] = "%1%3%2%3%4", ["^[xqɣ]( ?)([xqɣ])([^xqɣ])"] = "%2%1%2%3", ["([^xqɣ])[xqɣ]( ?)([xqɣ])$"] = "%1%3%2%3", ["([^ħʕ])[ħʕ]( ?)([ħʕ])([^ħʕ])"] = "%1%3%2%3%4", ["^[ħʕ]( ?)([ħʕ])([^ħʕ])"] = "%2%1%2%3", ["([^ħʕ])[ħʕ]( ?)([ħʕ])$"] = "%1%3%2%3" },   ["e"] = {["θ([‿ ]?[szʃʒ])"] = "T%1", ["ð([‿ ]?[szʃʒ])"] = "D%1"}, ["f"] = { ["([^rl])([rl])( ?)n([^t]?[‿ ])"] = "%1%2%3%2%4", ["([^rl])([rl])( ?)n([^t]?)$"] = "%1%2%3%2%4" },   ["g"] = {["nll?"] = "ll", ["n ll?"] = "l l", ["nrr?"] = "rr", ["n rr?"] = "r r"}, ["h"] = {["j( ?)w"] = "ɡʷ%1ɡʷ"}, ["i"] = { ["^j(" .. C .. ")"] = "i%1", ["([^j][‿ ])j(" .. C .. ")"] = "%1i%2", ["^w(" .. C .. ")"] = "u%1", ["([^w][‿ ])w(" .. C .. ")"] = "%1u%2" },   ["j"] = {["^([smT]ˤ?)ː"] = "%1", ["([‿ ]ə?)([smT]ˤ?)ː"] = "%1%2"}, ["k"] = {["(" .. C .. "[ˤʷ]?)ː "] = "%1(ː) ", ["(" .. C .. "[ˤʷ]?)ː$"] = "%1(ː)"}, ["l"] = { ["([ħʕχqʁ]ː?)æ"] = "%1ɑ", ["([ħʕχqʁ]ː?)i"] = "%1ɪ̙", ["([ħʕχqʁ]ː?)u"] = "%1ʊ̙", ["æ([ħʕχqʁ])"] = "ɑ%1", ["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$"] = "ʊ̙̞%1", ["æ(" .. C .. "[ˤʷ]?[‿ ])"] = "æ̝%1", ["i(%(?" .. C .. "%)?[ˤʷ]?[‿ ])"] = "i̞%1", ["u(%(?" .. C .. "%)?[ˤʷ]?[‿ ])"] = "u̞%1", ["ɑ(" .. C .. "[ˤʷ]?[‿ ])"] = "ɑ̝%1", ["ɪ̙(%(?" .. C .. "%)?[ˤʷ]?[‿ ])"] = "ɪ̙̞%1", ["ʊ̙(%(?" .. C .. "%)?[ˤʷ]?[‿ ])"] = "ʊ̙̞%1" },   ["n"] = {["æ$"] = "ɑ", ["æ([‿ ])"] = "ɑ%1"}, ["o"] = { ["^(" .. V .. "?" .. C .. "[ˤʷ]?ː?" .. C .. "?[ˤʷ]?)([θT]ˤ?)$"] = "%1ə%2", ["^(" .. V .. "?" .. C .. "[ˤʷ]?ː?" .. C .. "?[ˤʷ]?)([θT]ˤ?[‿ ])"] = "%1ə%2", ["([‿ ]" .. V .. "?" .. C .. "[ˤʷ]?ː?" .. C .. "?[ˤʷ]?)([θT]ˤ?)$"] = "%1ə%2", ["([‿ ]" .. V .. "?" .. C .. "[ˤʷ]?ː?" .. C .. "?[ˤʷ]?)([θT]ˤ?[‿ ])"] = "%1ə%2", ["(" .. C .. "[ˤʷ]?ː?)(" .. C .. "[ˤʷ]?ː?[θT]ˤ?[‿ ])"] = "%1ə%2", ["(" .. C .. "[ˤʷ]?ː?)(" .. C .. "[ˤʷ]?ː?[θT]ˤ?)$"] = "%1ə%2", ["(" .. C .. "[ˤʷ]?ː?)([ɡɟʝDdðfɣʁkcçlmNnrsʃCwjzbβhxχʒJqħʕ][ˤʷ]?ː?[‿ ])"] = "%1ə%2", ["(" .. C .. "[ˤʷ]?ː?)([ɡɟʝDdðfɣʁkcçlmNnrsʃCwjzbβhxχʒJqħʕ][ˤʷ]?ː?)$"] = "%1ə%2", ["^(" .. C .. "?[ˤʷ]?ː?" .. C .. "?[ˤʷ]?)(" .. C .. "[ˤʷ]?ː?)$"] = "%1ə%2", ["^(" .. C .. "?[ˤʷ]?ː?" .. C .. "?[ˤʷ]?)(" .. C .. "[ˤʷ]?ː?[‿ ])"] = "%1ə%2", ["([‿ ]" .. C .. "?[ˤʷ]?ː?" .. C .. "?[ˤʷ]?)(" .. C .. "[ˤʷ]?ː?)$"] = "%1ə%2", ["([‿ ]" .. C .. "?[ˤʷ]?ː?" .. C .. "?[ˤʷ]?)(" .. C .. "[ˤʷ]?ː?[‿ ])"] = "%1ə%2" },   ["ø"] = { ["^(" .. C .. "[ˤʷ]?ː?)ə(" .. C .. "[ˤʷ]?[‿ ])"] = "%1%2", ["^ə(" .. C .. "[ˤʷ]?ː?[‿ ])"] = "%1", ["(" .. V .. "[‿ ]" .. C .. "[ˤʷ]?ː?)ə(" .. C .. "[ˤʷ]?[‿ ])"] = "%1%2", ["(" .. V .. "[‿ ])ə(" .. C .. "[ˤʷ]?ː?[‿ ])"] = "%1%2", ["(" .. V .. C .. "[ˤʷ]?ː?[‿ ])ə(" .. C .. "[ˤʷ]?[‿ ])"] = "%1%2", ["(" .. V .. "[‿ ])ə(" .. C .. "[ˤʷ]?ː?)$"] = "%1%2", ["(" .. V .. "[‿ ]" .. C .. "[ˤʷ]?ː?)ə(" .. C .. "[ˤʷ]?)$"] = "%1%2", ["(" .. V .. C .. "[ˤʷ]?ː?[‿ ])ə(" .. C .. "[ˤʷ]?)$"] = "%1%2" },   ["O"] = { ["(" .. V .. C .. "[ˤʷ]?ː?)(" .. C .. "[ˤʷ]?" .. C .. "[ˤʷ]?)"] = "%1ə%2", ["(" .. V .. C .. "[ˤʷ]?ː?)(" .. C .. "[ˤʷ]?ː)"] = "%1ə%2", ["^(" .. C .. "[ˤʷ]?ː?)(" .. C .. "[ˤʷ]?" .. C .. "[ˤʷ]?)"] = "%1ə%2", ["^(" .. C .. "[ˤʷ]?ː?)(" .. C .. "[ˤʷ]?ː)"] = "%1ə%2", ["([‿ ]" .. C .. "[ˤʷ]?ː?)(" .. C .. "[ˤʷ]?" .. C .. "[ˤʷ]?)"] = "%1ə%2", ["([‿ ]" .. C .. "[ˤʷ]?ː?)(" .. C .. "[ˤʷ]?ː)"] = "%1ə%2", ["(" .. V .. "[‿ ]?" .. C .. "[ˤʷ]?ː?[‿ ])(" .. C .. "[ˤʷ]?" .. C .. "[ˤʷ]?)"] = "%1ə%2", ["(" .. V .. "[‿ ]?" .. C .. "[ˤʷ]?ː?[‿ ])(" .. C .. "[ˤʷ]?ː)"] = "%1ə%2", ["(" .. V .. "[‿ ]?" .. C .. "[ˤʷ]?" .. C .. "[ˤʷ]?[‿ ])(" .. C .. "[ˤʷ]?)"] = "%1ə%2", },   ["p"] = {["əm"] = "m̩", ["əN"] = "n̪̩", ["əl"] = "l̩", ["ər"] = "r̩"}, ["q"] = { ["əj"] = "ij", ["əʝ"] = "iʝ", ["əw"] = "uw" },   ["Q"] = { ["ij([^)])"] = "i(j)%1",       ["iʝ([^)])"] = "i(ʝ)%1", ["uw([^)])"] = "u(w)%1",       ["ij$"] = "i(j)",        ["iʝ$"] = "i(ʝ)",        ["uw$"] = "u(w)"    },    ["r"] = {        ["ai(" .. C .. "[ˤʷ]?" .. C .. "?[ˤʷ]?" .. C .. "?[ˤʷ]?" .. V .. "?)$"] = "ɑ%1",       ["ai(" .. C .. "[ˤʷ]?" .. C .. "?[ˤʷ]?" .. C .. "?[ˤʷ]?" .. V .. "?[‿ ])"] = "ɑ%1",       ["i(" .. V .. C .. "[ˤʷ]?" .. C .. "?[ˤʷ]?" .. C .. "?[ˤʷ]?" .. V .. "?)$"] = "(ij)%1",       ["i(" .. V .. C .. "[ˤʷ]?" .. C .. "?[ˤʷ]?" .. C .. "?[ˤʷ]?" .. V .. "?[‿ ])"] = "(ij)%1",       ["ui(" .. C .. "[ˤʷ]?" .. C .. "?[ˤʷ]?" .. C .. "?[ˤʷ]?" .. V .. "?)$"] = "u%1",       ["ui(" .. C .. "[ˤʷ]?" .. C .. "?[ˤʷ]?" .. C .. "?[ˤʷ]?" .. V .. "?[‿ ])"] = "u%1",       ["u(a" .. C .. "[ˤʷ]?" .. C .. "?[ˤʷ]?" .. C .. "?[ˤʷ]?" .. V .. "?)$"] = "uj%1",       ["u(a" .. C .. "[ˤʷ]?" .. C .. "?[ˤʷ]?" .. C .. "?[ˤʷ]?" .. V .. "?[‿ ])"] = "uj%1",       ["a(a" .. C .. "[ˤʷ]?" .. C .. "?[ˤʷ]?" .. C .. "?[ˤʷ]?" .. V .. "?)$"] = "(ɑj)%1",       ["a(a" .. C .. "[ˤʷ]?" .. C .. "?[ˤʷ]?" .. C .. "?[ˤʷ]?" .. V .. "?[‿ ])"] = "(ɑj)%1"   },    ["s"] = {["([ ‿]j" .. C .. "?[ˤʷ]?" .. C .. "[ˤʷ]?" .. C .. "[ˤʷ]?)a a"] = "%1‿a", ["^(j" .. C .. "?[ˤʷ]?" .. C .. "[ˤʷ]?" .. C .. "[ˤʷ]?)a a"] = "%1‿a"},--include every verbal prefix to recognize only the a-final conjugated forms   ["t"] = {["([æiu]) ([æiu])"] = "%1‿j%2"},    ["T"] = {["([æiu]‿j)i"] = "%1"},    ["u"] = {["kkʷ"] = "kʷkʷ", ["ɡɡʷ"] = "ɡʷɡʷ"} }

local dialects = {} dialects["Ayt Ndhir"] = { {{"u", "h", "r", "s", "i", "d", "f", "g"}, {true, "b"}}, {{"o", "ø"}, {true, "O"}, {"q", "Q", "t", "T", "n", "e", "c", "j", "a"}, {true, "l"}, {"m", "k", "p"}} }

function export.pronunciation_phonemic(word) m_scripts_util.checkScript(word, "Tfng")

translit = (lang:transliterate(word))

return mw.ustring.gsub(translit, '.', c) end

function export.pronunciation_phonetic(word, dialect) local word = export.pronunciation_phonemic(word) local o = dialects[dialect]

for j = 1, #o[1] do -- set of rules if o[1][j][1] == true then local N = "" while N ~= word do               N = word for k = 2, #o[1][j] do -- rule for x, y in pairs(r[o[1][j][k]]) do                       word = s(word, x, y)                    end end end else for k = 1, #o[1][j] do -- rule for x, y in pairs(r[o[1][j][k]]) do                   word = s(word, x, y)                end end end end

word = s(word, '.[ˤʷ]?', p)   for d, g in pairs(t) do        word = s(word, d .. d, g)        word = s(word, d .. " " .. d .. "([^ː])", g .. "‿" .. "%1") word = s(word, d .. " " .. d .. "$", "‿" .. g)   end

for j = 1, #o[2] do -- set of o       if o[2][j][1] == true then local N = "" while N ~= word do               N = word for k = 2, #o[2][j] do -- rule for x, y in pairs(r[o[2][j][k]]) do                       word = s(word, x, y)                    end end end else for k = 1, #o[2][j] do -- rule for x, y in pairs(r[o[2][j][k]]) do                   word = s(word, x, y)                end end end end

word = s(word, "T", "t̪") word = s(word, "D", "d̪") word = s(word, "N", "n̪") word = s(word, "C", "t͡ʃ") word = s(word, "J", "d͡ʒ")

return word end

function export.show(frame) local args = frame:getParent.args local page_title = mw.title.getCurrentTitle.text

local p, results, results_ayt_ndhir = {}, {}, {}

if args[1] then for index, item in ipairs(args) do           table.insert(p, (item ~= "") and item or nil) end else p = {page_title} end if args["r"] then for _, word in ipairs(p) do           table.insert(results, {pron = "/" .. export.pronunciation_phonemic(word) .. "/"}) table.insert(results_ayt_ndhir, {pron = "[" .. args["r"] .. "]"}) end else for _, word in ipairs(p) do           table.insert(results, {pron = "/" .. export.pronunciation_phonemic(word) .. "/"}) table.insert(results_ayt_ndhir, {pron = "[" .. export.pronunciation_phonetic(word, "Ayt Ndhir") .. "]"}) end end

return "* " .. m_IPA.format_IPA_full { lang = lang, items = results } .. "\n** " .. m_a.format_qualifiers(lang, {"Ayt Ndhir"}) .. " " .. m_IPA.format_IPA_full { lang = lang, items = results_ayt_ndhir } end

return export