မဝ်ဂျူ:ha-IPA
မံက်ပြာကတ်
Documentation for this module may be created at မဝ်ဂျူ:ha-IPA/doc
local export = {}
local m_IPA = require("Module:IPA")
local m_a = require("Module:accent qualifier")
local lang = require("Module:languages").getByCode("ha")
local s = mw.ustring.gsub
local C = "[ɡɟkTcʃSfDJjɽrʔmɓbfnɗdtzslwhpŋɲ]"
local V = "[áéíóúɛ́ɔ́àèìòùɛ̀ɔ̀âêîôûɛ̂ɔ̂]"
local i = {
[1] = {"E", "ɛ́"},
[2] = {"Ḕ", "ɛ̀ː"},
[3] = {"È", "ɛ̀"},
[4] = {"Ê", "E"},--don't change this...
[5] = {"O", "ɔ́"},
[6] = {"Ṑ", "ɔ̀ː"},
[7] = {"Ò", "ɔ̀"},
[8] = {"Ô", "O"},--...see rules 59&60
[9] = {"R", "r̃"}
}
local c = {
[1] = {"ʼ", "'"},
[2] = {"([gkƙ])%1([wy])", "%1%2%1%2"},
[3] = {"tts(h?)", "ts%1ts%1"},
[4] = {"ssh", "shsh"},
[5] = {"ffy", "fyfy"},
[6] = {"cch'", "ch'ch'"},
[7] = {"''y", "'y'y"},
[8] = {"gw", "ɡʷ"},
[9] = {"gy", "ɟ"},
[10] = {"kw", "kʷ"},
[11] = {"ch'", "Tʼ"},
[12] = {"c", "T"},
[13] = {"ky", "c"},
[14] = {"ƙw", "kʷʼ"},
[15] = {"ƙy", "cʼ"},
[16] = {"tsh", "Tʼ"},
[17] = {"sh", "ʃ"},
[18] = {"ts", "Sʼ"},
[19] = {"fy", "fʲ"},
[20] = {"j", "D"},
[21] = {"'y", "J"},
[22] = {"y", "j"},
[23] = {"ƴ", "J"},
[24] = {"g", "ɡ"},
[25] = {"ƙ", "kʼ"},
[26] = {"r̃", "R"},
[27] = {"r", "ɽ"},
[28] = {"R", "r"},
[29] = {"'", "ʔ"},
[30] = {"a", "á"},
[31] = {"ā̀", "àː"},
[32] = {"ā", "áː"},
[33] = {"e", "é"},
[34] = {"ḕ", "èː"},
[35] = {"ē", "éː"},
[36] = {"i", "í"},
[37] = {"ī̀", "ìː"},
[38] = {"ī", "íː"},
[39] = {"o", "ó"},
[40] = {"ṑ", "òː"},
[41] = {"ō", "óː"},
[42] = {"u", "ú"},
[43] = {"ū̀", "ùː"},
[44] = {"ū", "úː"},
[45] = {"([âêîôûEO])", "%1ː"},
[46] = {"^(" .. V .. ")", "ʔ%1"},
[47] = {"(.[ -/])(" .. V .. ")", "%1ʔ%2"},
[48] = {"(.)[-/](.)", "%1%2"},
[49] = {"(" .. V .. "ː?" .. C .. "?[ʷʲ]?ʼ?)(" .. C .. "[ʷʲ]?ʼ?)%f" .. V, "%1.%2"},
[50] = {"([áàâ]ː?)[íìî]", "%1i"},
[51] = {"([áàâ]ː?)[úùû]", "%1u"},
[52] = {"âː([iu])", "â%1"},
[53] = {"([âêîôûɛ̂ɔ̂])ː(" .. C .. "[ʷʲ]?ʼ?%.)", "%1%2"},
[54] = {"([âêîôûɛ̂ɔ̂])ː(" .. C .. "[ʷʲ]?ʼ?)$", "%1%2"},
[55] = {"T(ʼ?)w", "Tʷ%1"},
[56] = {"^(" .. C .. ")(ʼ?)w", "%1ʷ%2"},
[57] = {"( " .. C .. ")(ʼ?)w", "%1ʷ%2"},
[58] = {"T", "t͡ʃ"},
[59] = {"S", "(t)s"},
[60] = {"D", "(d)ʒ"},
[61] = {"J", "j̰"},
[62] = {"E", "ɛ̂"},
[63] = {"O", "ɔ̂"},
}
local idk = {
[1] = {"ɛ́", "é"},
[2] = {"ɛ̀", "è"},
[3] = {"ɛ̂", "ê"},
[4] = {"ɔ́", "ó"},
[5] = {"ɔ̀", "ò"},
[6] = {"ɔ̂", "ô"}
}
local SKH = {
[1] = {"%(d%)ʒ", "d͡ʒ"},
[2] = {"f", "ɸ"},
[3] = {"k(ʼ?[ɛ́ɛ̀ɛ̂éèêíìî])", "c%1"},
[4] = {"ɡ([ɛ́ɛ̀ɛ̂éèêíìî])", "ɟ%1"},
[5] = {"([kɡ])(ʼ?[ɔ́ɔ̀ɔ̂óòôúùû])", "%1ʷ%2"},
[6] = {"d͡ʒ%.d͡ʒ", "d.d͡ʒ"},
[7] = {"t͡ʃ%.t͡ʃ", "t.t͡ʃ"},
[8] = {"[kɡ]%.([cɟkɡ]ʷ?ʼ?)", "%1.%1"},
[9] = {"%(t%)sʼ", "sʼ"},
[10] = {"n([ -%.]?[bɓmpɸw])", "m%1"},
[11] = {"n([ -%.]?[jcɟ])", "ɲ%1"},
[12] = {"n([ -%.]?)([lrɽ])", "%2%1%2"},
[13] = {"n([ -%.]?[ kɡhʔ])", "ŋ%1"},
[14] = {"[mn]$", "ŋ"},
[15] = {"ŋ([ -%.]?[nɗdtzs])", "n%1"},
[16] = {"á(%.?[jɲ])", "ɛ́%1"},
[17] = {"à(%.?[jɲ])", "ɛ̀%1"},
[18] = {"â(%.?[jɲ])", "ɛ̂%1"},
[19] = {"([jj̰ɟc]ʼ?)á([^ː])", "%1ɛ́%2"},
[20] = {"([jj̰ɟc]ʼ?)à([^ː])", "%1ɛ̀%2"},
[21] = {"([jj̰ɟc]ʼ?)â([^ː])", "%1ɛ̂%2"},
[22] = {"([jj̰ɟc]ʼ?)á$", "%1ɛ́"},
[23] = {"([jj̰ɟc]ʼ?)à$", "%1ɛ̀"},
[24] = {"([jj̰ɟc]ʼ?)â$", "%1ɛ̂"},
[25] = {"([^hʔ])á([ -%.])", "%1ə́%2"},
[26] = {"([^hʔ])à([ -%.])", "%1ə̀%2"},
[27] = {"([^hʔ])â([ -%.])", "%1ə̂%2"},
[28] = {"([^hʔ])á$", "%1ə́"},
[29] = {"([^hʔ])à$", "%1ə̀"},
[30] = {"([^hʔ])â$", "%1ə̂"},
[31] = {"hó(" .. C .. "[ʷʲ]?ʼ?[ -%.])", "hɔ́%1"},
[32] = {"hò(" .. C .. "[ʷʲ]?ʼ?[ -%.])", "hɔ̀%1"},
[33] = {"hô(" .. C .. "[ʷʲ]?ʼ?[ -%.])", "hɔ̂%1"},
[34] = {"hó(" .. C .. "[ʷʲ]?ʼ?)$", "hɔ́%1"},
[35] = {"hò(" .. C .. "[ʷʲ]?ʼ?)$", "hɔ̀%1"},
[36] = {"hô(" .. C .. "[ʷʲ]?ʼ?)$", "hɔ̂%1"},
[37] = {"[éó](" .. C .. "[ʷʲ]?ʼ?[ -%.])", "á%1"},
[38] = {"[èò](" .. C .. "[ʷʲ]?ʼ?[ -%.])", "à%1"},
[39] = {"[êô](" .. C .. "[ʷʲ]?ʼ?[ -%.])", "â%1"},
[40] = {"[éó](" .. C .. "[ʷʲ]?ʼ?)$", "á%1"},
[41] = {"[èò](" .. C .. "[ʷʲ]?ʼ?)$", "à%1"},
[42] = {"[êô](" .. C .. "[ʷʲ]?ʼ?)$", "â%1"},
[43] = {"í([^ː])", "ɪ́%1"},
[44] = {"ì([^ː])", "ɪ̀%1"},
[45] = {"î([^ː])", "ɪ̂%1"},
[46] = {"í$", "ɪ́"},
[47] = {"ì$", "ɪ̀"},
[48] = {"î$", "ɪ̂"},
[49] = {"ú(%.?j)", "í%1"},
[50] = {"ù(%.?j)", "ì%1"},
[51] = {"û(%.?j)", "î%1"},
[52] = {"([ʃʒɽrnɗdtzsl]ʼ?)ú([^ː])", "%1ɪ́%2"},
[53] = {"([ʃʒɽrnɗdtzsl]ʼ?)ù([^ː])", "%1ɪ̀%2"},
[54] = {"([ʃʒɽrnɗdtzsl]ʼ?)û([^ː])", "%1ɪ̂%2"},
[55] = {"ɪ́(%.?w)", "ú%1"},
[56] = {"ɪ̀(%.?w)", "ù%1"},
[57] = {"ɪ̂(%.?w)", "û%1"},
[58] = {"([ʃʒɽrnɗdtzsl]ʼ?)ú$", "%1ɪ́"},
[59] = {"([ʃʒɽrnɗdtzsl]ʼ?)ù$", "%1ɪ̀"},
[60] = {"([ʃʒɽrnɗdtzsl]ʼ?)û$", "%1ɪ̂"},
[61] = {"ú([^ː])", "ʊ́%1"},
[62] = {"ù([^ː])", "ʊ̀%1"},
[63] = {"û([^ː])", "ʊ̂%1"},
[64] = {"ú$", "ʊ́"},
[65] = {"ù$", "ʊ̀"},
[66] = {"û$", "ʊ̂"},
[67] = {"([^hʔ])ái", "%1éi"},
[68] = {"([^hʔ])ài", "%1èi"},
[69] = {"(%.[^hʔ])âi", "%1êi"},
[70] = {"([^hʔ])âi%.", "%1êi."},
[71] = {"M", "m"}
}
function export.pronunciation_phonemic(word, ideo)
if ideo == "1" then
word = s(word, "f$", "p")
end
for a = 1, #i do
word = s(word, i[a][1], i[a][2])
end
word = mw.ustring.lower(word)
for a = 1, #c do
word = s(word, c[a][1], c[a][2])
end
return word
end
function export.idk(word)
for a = 1, #idk do
word = s(word, idk[a][1], idk[a][2])
end
return word
end
function export.pronunciation_phonetic(word, dialect, ideo)
if dialect == "SKH" then
if ideo == "1" then
word = s(word, "m$", "M")
end
for a = 1, #SKH do
word = s(word, SKH[a][1], SKH[a][2])
end
end
return word
end
function export.show(frame)
local args = frame:getParent().args
local p, results, results_ha = {}, {}, {}
if not args[1] or (args[1] == "") then
error("Please put the word as the first positional parameter!")
else
for index, item in ipairs(args) do
table.insert(p, (item ~= "") and item or nil)
end
end
for _, word in ipairs(p) do
word = export.pronunciation_phonemic(word, args["ideo"])
table.insert(results, {pron = "/" .. export.idk(word) .. "/"})
table.insert(results_ha, {pron = "[" .. export.pronunciation_phonetic(word, "SKH", args["ideo"]) .. "]"})
end
if args["niger"] == "1" then
return m_IPA.format_IPA_full(lang, results)
else
return m_IPA.format_IPA_full(lang, results) .. "\n** " .. m_a.show({"ဗီုပြင်ဟဴသကာနဝ်"}) .. " " .. m_IPA.format_IPA_full(lang, results_ha)
end
end
return export