Module:mg-pron: Difference between revisions

Jump to navigation Jump to search
No edit summary
No edit summary
Line 13: Line 13:
local RET = u(0x0320) -- COMBINING MINUS SIGN BELOW, ̠
local RET = u(0x0320) -- COMBINING MINUS SIGN BELOW, ̠
local CEN = u(0x0308) -- COMBINING DIAERESIS, ̈
local CEN = u(0x0308) -- COMBINING DIAERESIS, ̈
local ACUTE = u(0x0301) -- COMBINING ACUTE ACCENT, ́


local velar = "[kɡɣɫw]"; local palatal = "[ɲʧʃʎ]"
local velar = "[kɡɣɫw]"; local palatal = "[ɲʧʃʎ]"
Line 46: Line 47:
local monosyll = {["n"] = "ˈ", ["pron"] = "", ["particle"] = "(ˈ)", ["prep"] = "(ˈ)", ["conj"] = "(ˈ)"}
local monosyll = {["n"] = "ˈ", ["pron"] = "", ["particle"] = "(ˈ)", ["prep"] = "(ˈ)", ["conj"] = "(ˈ)"}
if #syll == 1 then
if #syll == 1 then
if not pos then error('Part of speech needed to determine stress') end
if not pos then error('Part of speech needed to determine stress') end
syll[1] = mw.ustring.toNFC(gsub(mw.ustring.toNFD(syll[1]), ACUTE, ""))
syll[1] = monosyll[pos] .. syll[1]
syll[1] = monosyll[pos] .. syll[1]
else
else
for _, s in ipairs(syll) do
if match(mw.ustring.toNFD(s), ACUTE) then
s = "ˈ" .. s
return table.concat(syll, "·")
end
end
syll[#syll - 1] = "ˈ" .. syll[#syll - 1]
syll[#syll - 1] = "ˈ" .. syll[#syll - 1]
end
end