Module:as-IPA
Appearance
- The following documentation is located at Module:as-IPA/documentation. [edit] Categories were auto-generated by Module:module categorization. [edit]
- Useful links: subpage list • links • transclusions • testcases • sandbox
Assamese IPA pronunciation module. See {{as-IPA}}
.
Testcases
4 of 21 tests failed. (refresh)
Text | Expected | Actual | Comments | |
---|---|---|---|---|
মই (moi) | mɔɪ | mɔɪ | ||
দেশ (dex) | dɛx | dɛx | ||
মোৰ (mür) | mʊɹ | mʊɹ | ||
শক্তি (xokti) | xɔk.ti | xɔk.ti | ||
ঔষধ (ouxodh) | oʊ.xɔdʱ | oʊ.xɔdʱ | ||
পৰিয়াল (porial) | po.ɹial | pɔ.ɹial | ||
সোঁফালে (xü̃phale) | xʊ̃.pʰa.lɛ | xʊ̃.pʰa.lɛ | ||
স্পৰ্শ (sporxo) | spɔɹ.xɔ | spɔɹ.xɔ | ||
নাঙল (naṅol) | na.ŋɔl | na.ŋɔl | ||
হিংসা (hiṅxa) | ɦiŋ.xa | ɦiŋ.xa | ||
ঐতিহাসিক (oitihaxik) | oɪ.ti.ɦa.xik | oɪ.ti.ɦa.xik | ||
শহা পহু (xoha pohu) | xɔ.ɦa po.ɦu | xɔ.ɦa pɔ.ɦu | ||
সম্পূৰ্ণ (xompurno) | xɔm.puɹ.nɔ | xɔm.puɹ.nɔ | ||
মগজু (mogozu) | mo.ɡo.zu | mɔ.ɡɔ.zu | ||
বিৱৰণ (biworon) | bi.wɔ.ɹɔn | bi.wɔ.ɹɔn | ||
ৰাজ্য (raizzo) | ɹaɪd.ʑɔ | ɹaɪd.ʑɔ | ||
জ্বৰ (zor) | zɔɹ | zɔɹ | ||
অধিকাৰ (odhikar) | o.dʱi.kaɹ | ɔ.dʱi.kaɹ | ||
থকা (thoka) | tʰɔ.ka | tʰɔ.ka | ||
খেল (khel) | kʰɛl | kʰɛl | ||
মানুহ (manuh) | ma.nuʱ | ma.nuʱ |
local export = {}
local lang = require("Module:languages").getByCode("as")
local sc = require("Module:scripts").getByCode("Beng")
local m_translit = require("Module:as-translit").tr
local m_IPA = require("Module:IPA")
local gsub = mw.ustring.gsub
local gmatch = mw.ustring.gmatch
local correspondences = {
["g"] = "ɡ",
["ñ"] = "n",
["ṗ"] = "pʰ", ["ḃ"] = "bʱ",
["y"] = "j", ["r"] = "ɹ",
["h"] = "ɦ",
["ḱ"] = "kʰ", ["ǵ"] = "ɡʱ",
["ź"] = "zʱ", ["ṫ"] = "tʰ", ["ḋ"] = "dʱ",
["ŕ"] = "ɹʱ", ["ṙ"] = "ɹi",
["o"] = "ɔ", ["e"] = "ɛ", ["ü"] = "ʊ",
["ë"] = "e", ["ö"] = "o", ["ʏ"] = "oɪ",
["ɵ"] = "oʊ",
["õ"] = "ɔ̃", ["e͂"] = "ɛ̃", ["ü͂"] = "ʊ",
["ë̃"] = "ẽ", ["ö̃"] = "ɔ̃", ["a͂"] = "a", ["ĩ"] = "i", ["u͂"] = "u"
}
local vowels = "aiueoüóéʏɵ"
local syllabify_pattern = "([" .. vowels .. "])([^" .. vowels .. " %.]+)([" .. vowels .. "])"
local function syllabify(text)
for count = 1, 2 do
text = gsub(text, syllabify_pattern, function(a, b, c)
return a .. gsub(gsub(b, "(.)(.+)", "%1.%2"), "^([^%.]+)$", ".%1") .. c end)
end
return text
end
function export.link(term)
return require("Module:links").full_link{ term = term, lang = lang, sc = sc }
end
function export.toIPA(text)
local result = {}
local translit = m_translit(text, lang, sc, "IPA")
if not translit then
error('The term "' .. text .. '" could not be transliterated.')
end
local translit = syllabify(translit)
for character in gmatch(translit, ".") do
table.insert(result, correspondences[character] or character)
end
result = table.concat(result)
result = gsub(result, "([aɔ])i", "%1ɪ")
result = gsub(result, "z%.z", "d.ʑ")
result = gsub(result, "([" .. vowels .. "])ɦ", "%1ʱ")
return result
end
function export.make(frame)
local args = frame:getParent().args
local pagetitle = mw.title.getCurrentTitle().text
local p, results = {}, {}
if args[1] then
for index, item in ipairs(args) do
table.insert(p, (item ~= "") and item or nil)
end
else
p = { pagetitle }
end
for _, Assamese in ipairs(p) do
table.insert(results, { pron = "/" .. export.toIPA(Assamese) .. "/" })
end
return '* ' .. m_IPA.format_IPA_full { lang = lang, items = results }
end
return export