local export = {}
local PAGENAME = mw.title.getCurrentTitle().text
local m_IPA = require("Module:IPA")
local lang = require("Module:languages").getByCode("bbl")
local scripts_IPA_single = {
["ა"] = "a", ["ა̄"] = "aː", ["ბ"] = "b", ["გ"] = "ɡ", ["დ"] = "d",
["ე"] = "e", ["ე̆"] = "ĕ", ["ვ"] = "ʋ", ["ზ"] = "z", ["თ"] = "t",
["ი"] = "i", ["ი̆"] = "ĭ", ["კ"] = "kʼ", ["ლ"] = "l", ["მ"] = "m",
["ნ"] = "n", ["ჲ"] = "j", ["ო"] = "o", ["ო̆"] = "ŏ", ["პ"] = "pʼ",
["ჟ"] = "ʒ", ["რ"] = "r", ["ს"] = "s", ["ტ"] = "tʼ", ["უ"] = "u",
["უ̆"] = "ŭ", ["ფ"] = "p", ["ქ"] = "k", ["ღ"] = "ɣ", ["ყ"] = "qʼ",
["შ"] = "ʃ", ["ჩ"] = "t͡ʃ", ["ც"] = "t͡s", ["ძ"] = "d͡z", ["წ"] = "t͡sʼ",
["ჭ"] = "t͡ʃʼ", ["ხ"] = "x", ["ჴ"] = "q", ["ჯ"] = "d͡ʒ", ["ჰ"] = "h",
["ჰ̡"] = "ħ", ["ჵ"] = "ʡ", ["ჺ"] = "ʕ", ["ჸ"] = "ʔ", ["ჶ"] = "p",
["̄"] = "ː", ["̆"] = "\204\134"
}
local scripts_IPA_double = {
["აჼ"] = "ã", ["ეჼ"] = "ẽ", ["თთ"] = "tː", ["იჼ"] = "ĩ", ["ლლ"] = "lː",
["ლʻ"] = "ɬ", ["ჲჼ"] = "j̃", ["ოჼ"] = "õ", ["სს"] = "sː", ["ტტ"] = "tʼː",
["უჼ"] = "ũ", ["ყყ"] = "qʼː", ["ხხ"] = "xː", ["ჴჴ"] = "qː"
}
function export.to_IPA(word)
word = mw.ustring.lower(word)
for pat, repl in pairs(scripts_IPA_double) do
word = mw.ustring.gsub(word, pat, repl)
end
if mw.ustring.find(word, "'") then
word = mw.ustring.gsub(word, "([^აეიოუ]?)'([აეიოუ])", function(consonant, vowel)
return "ˈ" .. (consonant or "") .. (scripts_IPA_single[vowel] or vowel)
end)
else
word = mw.ustring.gsub(word, "([^აეიოუ])([^აეიოუ])([აეიოუ])", function(c1, c2, vowel)
return "ˈ" .. (c1 or "") .. (c2 or "") .. (scripts_IPA_single[vowel] or vowel)
end)
word = mw.ustring.gsub(word, "^([^აეიოუ]?)([აეიოუ])", function(consonant, vowel)
return "ˈ" .. (consonant or "") .. (scripts_IPA_single[vowel] or vowel)
end)
end
word = mw.ustring.gsub(word, "'", "")
word = mw.ustring.gsub(word, "([ეიოუ])$", "%1\204\134")
word = mw.ustring.gsub(word, ".", scripts_IPA_single)
return "/" .. word .. "/"
end
function export.pronunciation(frame)
local args = frame:getParent().args
local word = args["head"] or args[1] or mw.title.getCurrentTitle().text
local ipa = export.to_IPA(word)
local items = { { pron = ipa, note = nil } }
return m_IPA.format_IPA_full { lang = lang, items = items }
end
return export