Module:qay-pron: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 66: Line 66:
term = gsub(term, "·(" .. consonants .. ")·", "%1·")
term = gsub(term, "·(" .. consonants .. ")·", "%1·")
local syll = split(term, "·"); local weight = {}; local st = "";
local syllables = split(term, "·"); local weight = {}; local st = "";
for i, syllable in ipairs(syllables) do
for i, syll in ipairs(syllables) do
if match(syllable, "´") then -- if the user inputted manual stress, ignore all the rest
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(syllable, "ː") then weight[i] = "sh"
if match(syll, "ː") then weight[i] = "sh"
elseif match(syllable, "ŋ$") or match(syllable, "[aeiouɛɪɔʊ][aeiouɛɪɔʊ]") then weight[i] = "h"
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 (#syllable ~= 1) and (not st) then
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, "ˈ")

Navigation menu