Module:mg-pron: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 24: Line 24:
foo, bar = match(foo, "^."), match(bar, "^.") -- sort out the letter
foo, bar = match(foo, "^."), match(bar, "^.") -- sort out the letter
return foo == bar and true or false
return foo == bar and true or false
end
local function remove_acute(str)
return mw.ustring.toNFC(gsub(mw.ustring.toNFD(str), ACUTE, ""))
end
end


Line 50: Line 54:
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] = remove_acute(syll[1])
syll[1] = monosyll[pos] .. syll[1]
syll[1] = monosyll[pos] .. syll[1]
else
else
for _, s in ipairs(syll) do
for _, s in ipairs(syll) do
if match(mw.ustring.toNFD(s), ACUTE) then
if match(mw.ustring.toNFD(s), ACUTE) then
s = "ˈ" .. s
s = "ˈ" .. remove_acute(s)
return table.concat(syll, "·")
return table.concat(syll, "·")
end
end

Navigation menu