--- 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()", "d%1")
text = rsub(text, "t()", "d%1")
text = rsub(text, "k()", "g%1")
text = rsub(text, "s()", "z%1")
text = rsub(text, ":", "ː")
text = "/" .. text .. "/"
return text
end
function export.assign_stress(frame)
PAGENAME = mw.title.getCurrentTitle().text
text = frame.args
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, "", "V")
mod_text = rsub(mod_text, "", "L")
mod_text = rsub(mod_text, "", "C")
end
return mod_stress
end
return export