Module:User:Mofvanes/moh-pron

--- I'm gonna be taking inspiration from how de-IPA does it

--- It won't be able to handle i, en, and on at the beginning

local export = {}

local rfind = mw.ustring.find local rsubn = mw.ustring.gsub local ulower = mw.ustring.lower local str_len = mw.ustring.len

local function rsub(term, foo, bar) local retval = rsubn(term, foo, bar) return retval end

function export.IPA(text, pos) if type(text) == 'table' then text, pos = "Kahnawà:ke", "noun" end text = text or mw.title.getCurrentTitle.text text = ulower(text) text = mw.ustring.toNFD(text) text = rsub(text, "t([aeiouv])", "d%1") text = rsub(text, "t([aeiouv])", "d%1") text = rsub(text, "k([aeiouv])", "g%1") text = rsub(text, "s([aeiouv])", "z%1") text = rsub(text, ":", "ː") text = "/" .. text .. "/"	return text end

function export.assign_stress(frame) PAGENAME = mw.title.getCurrentTitle.text text = frame.args[1] if text == nil or text == "" then text = "Kahnawa’ke" end mod_text = text for i = 1, str_len(text) do		mod_text = rsub(mod_text, "[aeo]", "V") mod_text = rsub(mod_text, "[h’]", "L") mod_text = rsub(mod_text, "[kmrsw]", "C") end return mod_stress end

return export