Module:qhv-pron: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 38: Line 38:
syllables = split(term, "·")
syllables = split(term, "·")
for i, syllable in ipairs(syllables) do
 
weight[i] = match(syllable, "[aeiouy" .. NONSYLLABIC .. "]$") and "l" or "h"
end
local a, p = weight[#weight-2], weight[#weight-1]
if p == "l" and a == "h" then table.insert(syllables, #syllables-2, "ˈ")
elseif (p == "l" and a == "l") or (p == "h") or (a == nil) then table.insert(syllables, #syllables-1, "ˈ")
elseif p == nil then table.insert(syllables, #syllables, "ˈ")
else table.insert(syllables, #syllables-1, "ˈ") end
return table.concat(syllables)
return table.concat(syllables)