มอดูล:ka-IPA
หน้าตา
- This มอดูล lacks a documentation subpage. Please create it.
- Useful links: subpage list • links • transclusions • testcases • sandbox
local export = {}
local gsub = mw.ustring.gsub
local lang = require("Module:languages").getByCode("ka")
local ipa = require("Module:IPA")
local mapping = {
["ა"] = "a", ["ბ"] = "b", ["გ"] = "ɡ", ["დ"] = "d",
["ე"] = "e", ["ვ"] = "v", ["ზ"] = "z", ["თ"] = "tʰ",
["ი"] = "i", ["კ"] = "kʼ", ["ლ"] = "l", ["მ"] = "m",
["ნ"] = "n", ["ო"] = "o", ["პ"] = "pʼ", ["ჟ"] = "ʒ",
["რ"] = "r", ["ს"] = "s", ["ტ"] = "tʼ", ["უ"] = "u",
["ფ"] = "pʰ", ["ქ"] = "kʰ", ["ღ"] = "ɣ", ["ყ"] = "qʼ",
["შ"] = "ʃ", ["ჩ"] = "t͡ʃ", ["ც"] = "t͡s", ["ძ"] = "d͡z",
["წ"] = "t͡sʼ", ["ჭ"] = "t͡ʃʼ", ["ხ"] = "x", ["ჯ"] = "d͡ʒ",
["ჰ"] = "h",
-- special character:
["ჶ"] = "f",
}
local narrow = {
["რ"] = "ɾ", ["ღ"] = "ʁ", ["ყ"] = "χʼ", ["ჩ"] = "t͡ʃʰ",
["ც"] = "t͡sʰ", ["ხ"] = "χ"
}
function export.pronunciation(word, is_phonetic)
-- make text lowercase
word = mw.ustring.lower(word)
require("Module:script utilities").checkScript(word, "Geor")
if is_phonetic then
-- /v/ is labialised to the previous consonant
word = gsub(word, "([ბგდვზთკლმნპჟრსტფქღყშჩცძწჭხჯჰ])ვ", "%1ʷ")
-- /v/ is devoiced before a devoiced consonant
word = gsub(word, "ვ([თკპსტფქშჩცწჭხჰ])", "f%1")
-- /l/ is velarised before a back vowel
word = gsub(word, "ლ([აოუ])", "ɫ%1")
-- /n/ is velarised before a velar consonant
word = gsub(word, "ნ([ქკგ])", "ŋ%1")
-- word-initial /b, d, ɡ/ is devoiced
word = gsub(word, "^([ბდ])", "%1" .. mw.ustring.char(0x0325))
word = gsub(word, "^გ", "გ" .. mw.ustring.char(0x030a))
word = gsub(word, " ([ბდ])", " %1" .. mw.ustring.char(0x0325))
word = gsub(word, " გ", " გ" .. mw.ustring.char(0x030a))
-- word-final /b, d, ɡ/ is devoiced and aspirated
word = gsub(word, "ბ$", "ფ")
word = gsub(word, "დ$", "თ")
word = gsub(word, "გ$", "ქ")
word = gsub(word, "ბ ", "ფ ")
word = gsub(word, "დ ", "თ ")
word = gsub(word, "გ ", "ქ ")
word = gsub(word, ".", narrow)
end
word = gsub(word, "%p", "")
word = gsub(word, ".", mapping)
return word
end
function export.show(frame)
local args = frame:getParent().args
local pagetitle = mw.title.getCurrentTitle().text
local p, results = {}, {}
if args[1] then
for _, v in ipairs(args) do
if v == "+" then v = pagetitle end
table.insert(p, (v ~= "") and v or nil)
end
else
if mw.title.getCurrentTitle().nsText == "แม่แบบ" then
p = {"ქართული ენა"}
else p = { pagetitle } end
end
local has_f = false
for input_index, word in ipairs(p) do
-- check for character ჶ /f/
if mw.ustring.find(word, "ჶ") then
has_f = true
end
local phonemic = export.pronunciation(word, false)
local phonetic = export.pronunciation(word, true)
table.insert(results, { pron = "/" .. phonemic .. "/" })
local qual = args["q"..input_index]
if qual then
results[#results].qualifiers = { qual }
end
if phonemic ~= phonetic then table.insert(results, { pron = "[" .. phonetic .. "]" }) end
end
local ret = ipa.format_IPA_full { lang = lang, items = results }
if has_f then
ret = ret .. require("Module:utilities").format_categories({"Georgian terms with /f/"}, lang)
end
return ret
end
return export