Module:User:Qwertygiy/gd-pron

--to call this a work in progress is understating the work and overstating the progress --do NOT attempt to use this barely-edited copy-paste job local export = {}

local m_IPA = require("Module:IPA") local lang = require("Module:languages").getByCode("gd") local rsub = mw.ustring.gsub local rlower = mw.ustring.lower local rfind = mw.ustring.find

--live fast, die young, and leave... local acutegrave = { ['á'] = 'à', ['é'] = 'è', ['í'] = 'ì', ['ó'] = 'ò', ['ú'] = 'ù' } --some historical forms use the acute; standardization brought grave changes

local stressors = { --[1] = 'my ex', ['ˈao'] = 'ɯ:', ['ˈai'] = 'ɛ̯', }

local nns = { [''] = 'j', }

local inventory = { ['b'] = 'b', ['b́'] = 'bʲ', ['d'] = 'd', ['ď'] = 'dʲ', ['ʒ'] = 'd͡z', ['ʒ́'] = 'd͡zʲ', ['f'] = 'f', ['g'] = 'ɡ', ['j'] = 'j', ['k'] = 'k', ['l'] = 'l', ['ľ'] = 'lʲ', ['m'] = 'm', ['ḿ'] = 'mʲ', ['n'] = 'n', ['ń'] = 'nʲ', ['p'] = 'p', ['ṕ'] = 'pʲ', ['r'] = 'r', ['ŕ'] = 'rʲ', ['s'] = 's', ['ś'] = 'sʲ', ['š'] = 'ʃ', ['t'] = 't', ['ť'] = 'tʲ', ['c'] = 't͡s', ['ć'] = 't͡sʲ', ['v'] = 'v', ['v́'] = 'vʲ', ['x'] = 'x', ['x́'] = 'xʲ', ['z'] = 'z', ['ź'] = 'zʲ', ['ž'] = 'ʒ', ['́'] = 'ʲ', ['a'] = 'a', ['ą'] = 'ã', ['å'] = 'ɒ', ['ă'] = 'ɐ', ['ĕ'] = 'ə', ['e'] = 'ɛ', ['i'] = 'i', ['o'] = 'ɔ', ['ǫ'] = 'ɔ̃', ['ö'] = 'œ', ['u'] = 'u', ['ü'] = 'y', }

local function phonemic(text) text = rlower(text) --no caps, Iain. impropriety is required at this ceilidh text = rsub(text, "[áéíóú]", acutegrave) if rfind(text, "-") then text = rsub(text, "-", " ˈ") --add stress after the break. just like my ex in college else text = "ˈ" .. text --typically, stress comes first. just like my ex in college end if rfind(text, "nn") then --double n changes the preceding vowel end text = rsub(text, "..", stressors) text = rsub("1" .. text, "..", stressors) text = rsub(text, "1", "") text = rsub(text, ".", inventory) text = rsub(text, "'", " ") --apostrophes explicitly mean a lack of pronunciation return text end

function export.IPA(frame) local words = {} for _, word in ipairs(frame:getParent.args) do		table.insert(words, word) end if #words == 0 then words = {mw.title.getCurrentTitle.text} end local IPA_results = {} for _, word in ipairs(words) do table.insert(IPA_results, { pron = "/" .. phonemic(word) .. "/" }) end return m_IPA.format_IPA_full { lang = lang, items = IPA_results } end

return export