This is a private module sandbox of Thadh, for their own experimentation. Items in this module may be added and removed at Thadh's discretion; do not rely on this module's stability.
local export={}
local m_IPA = require("Module:IPA")
local lang = require("Module:languages").getByCode("ltg")
local s = mw.upstring.gsub
local title = mw.title.getCurrentTitle().text
local palatalmark = u(0x02b2)
local capital = {
="a", ="ā", ="b", ="c", ="č", ="d",
="e", ="ē", ="f", ="g", ="ģ", ="h",
="i", ="ī", ="j", ="k", ="ķ", ="l",
="ļ", ="m", ="n", ="ņ", ="o", ="ō",
="p", ="r", ="s", ="š", ="t", ="u",
="ū", ="v", ="z", ="ž", ="ẹ",
};
local charc = {
="a", ="aː", ="b", ="t͡s", ="t͡ʃ",
="d", ="æ", ="æː", ="f", ="ɡ", ="gʲ",
="x", ="i", ="iː", ="j", ="k", ="kʲ",
="l", ="lʲ", ="m", ="n", ="nʲ", ="ɔ",
="uɔ̯", ="p", ="r", ="s", ="ʃ", ="t",
="u", ="uː", ="v", ="ɨ", ="z", ="ʒ", ="ɛ", ="",
};
local const = { "p", "b", "t", "d", "k", "ɡ", "v", "s", "z", "t͡s", "d͡z" };
local prepvowel = ""
local postconst = ""
local postnconst = { "p", "b", "d", "k", "g", "v", "z", "t͡s", "d͡z", "t͡ʃ", "d͡ʒ", "ʃ", "ʒ" };
local pconst = const .. palatalmark
local alveol = { "ʃ", "ʒ", "t͡ʃ", "d͡ʒ" };
local digraph = {
="iɛ̯", ="uɔ̯", ="au̯", ="iu̯", ="ɨu̯", ="ou̯",
="d͡ʒ", ="ai̯", ="æi̯", ="ɔi̯", ="ui̯", ="ɛi̯",
};
local devoiced = { "p", "k", "t͡s","t͡ʃ", "ʃ", "t", "s", "f", };
local devoice = {
="p", ="pʲ", ="t", ="tʲ", ="k", ="kʲ", ="t͡sʲ",
="f", ="fʲ", ="s", ="sʲ", ="ʃ", ="t͡ʃ", ="t͡s",
};
local voiced = { "b", "g", "d͡z","d͡ʒ", "ʒ", "d", "z", "v", };
local voice = {
="b", ="bʲ", ="d", ="dʲ", ="g", ="gʲ", ="d͡zʲ",
="v", ="vʲ", ="z", ="zʲ", ="ʒ", ="d͡ʒ", ="d͡z",
};
function export.pronunciation_phonemic(word)
word = s(word, ".", capital) -- converting capitals
word = s(word, ".", digraph) -- converting digraphs
word = s(word, ".", charc) -- converting regular consonants
word = s(word, "(" .. const .. ")%f" .. prepvowel, "%1" .. palatalmark .. "%2") -- palatilsation followed by front vowel
word = s(word, "(" .. const .. ")%f" .. pconst, "%1" .. palatalmark .. "%2") -- palatalisation followed by a palatal consonant
word = s(word, "(" .. prepvowel .. postnconst .. "?" .. postnconst .. "?" .. postnconst .. "?" .. postnconst .. "?)%f" .. postconst, "%1" .. palatalmark .. "%2")
word = s(word, "(" .. alveol .. ")%fæ", "%1ɛ") -- e is ɛ after an alveolar consonant
word = s(word, "æ(" .. const .. "?" .. const .. "?" .. const .. "?" .. const .. "?" .. const .. "?)i", "ɛ%1i") -- e is ɛ before an i
word = s(word, ".$", devoice) -- final devoicing
word = s(word, "%f" .. devoiced, devoice) -- final devoicing
word = s(word, "%f" .. voiced, voice) -- pre-voiced voicing
word = "/ˈ" .. word .. "/"
return word
end
return export