45,645
edits
No edit summary |
No edit summary |
||
Line 66: | Line 66: | ||
term = gsub(term, "·(" .. consonants .. ")·", "%1·") | term = gsub(term, "·(" .. consonants .. ")·", "%1·") | ||
local | local syllables = split(term, "·"); local weight = {}; local st = ""; | ||
for i, | for i, syll in ipairs(syllables) do | ||
if match( | if match(syll, "´") then -- if the user inputted manual stress, ignore all the rest | ||
table.insert(syllables, i, "ˈ") | table.insert(syllables, i, "ˈ") | ||
return table.concat(syllables) | return table.concat(syllables) | ||
end | end | ||
if match( | if match(syll, "ː") then weight[i] = "sh" | ||
elseif match( | elseif match(syll, "ŋ$") or match(syll, "[aeiouɛɪɔʊ][aeiouɛɪɔʊ]") then weight[i] = "h" | ||
else weight[i] = "l" | else weight[i] = "l" | ||
end | end | ||
Line 84: | Line 84: | ||
end | end | ||
if (# | if (#syllables ~= 1) and (not st) then | ||
local p, f = weight[#weight-1], weight[#weight] -- penultimate and final syllables | local p, f = weight[#weight-1], weight[#weight] -- penultimate and final syllables | ||
if p == "l" and f == "h" then table.insert(syllables, #syllables, "ˈ") | if p == "l" and f == "h" then table.insert(syllables, #syllables, "ˈ") |