Module:qay-pron: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 15: Line 15:


local consonants = "[pbmvstdnrɾlkɡŋhxçʤʧj]"
local consonants = "[pbmvstdnrɾlkɡŋhxçʤʧj]"
local front = "ie"
local front = "iɪeɛ"
local back = "ou"
local back = "oɔu"
local vowels = "[a" .. front .. back .. "ː]"
local vowels = "[a" .. front .. back .. "ː´]"


local function laxen(v)
local function laxen(v)
Line 57: Line 57:
{"(" .. consonants .. ")(·?ˈ?)(" .. consonants .. ")", function(c1, st, c2) return same(c1,c2) and st .. c1 or c1 .. st .. c2 end},
{"(" .. consonants .. ")(·?ˈ?)(" .. consonants .. ")", function(c1, st, c2) return same(c1,c2) and st .. c1 or c1 .. st .. c2 end},
{"jj", "j"}, {"(·" .. consonants .. ")e$", "%1ə"},
{"jj", "j"}, {"(·" .. consonants .. ")e$", "%1ə"},
}
}


Line 68: Line 66:
term = gsub(term, "·(" .. consonants .. ")·", "%1·")
term = gsub(term, "·(" .. consonants .. ")·", "%1·")
local syll = split(term, "·"); local noa = {}
local syll = split(term, "·"); local weight = {}; local st = "";
if #syll ~= 1 then
for i, syllable in ipairs(syllables) do
if match(term, "[áéíóúĄ]") then
if match(syllable, "´") then -- if the user inputted manual stress, ignore all the rest
for _, s in ipairs(syll) do
table.insert(syllables, i, "ˈ")
s = remove_acute(s, match(s, "[áéíóúĄ]") and true or false)
return table.concat(syllables)
table.insert(noa, s)
end
end
if match(syllable, "ː") then weight[i] = "sh"
else
elseif match(syllable, "ŋ$") or match(syllable, "[aeiouɛɪɔʊ][aeiouɛɪɔʊ]") then weight[i] = "h"
syll[#syll - 1] = "ˈ" .. syll[#syll - 1]
else weight[i] = "l"
end
end
if weight[i] == "sh" then
table.insert(syllables, i, "ˈ")
st = true
end
end
if (#syllable ~= 1) and (not st) then
local p, f = weight[#weight-1], weight[#weight] -- penultimate and final syllables
if p == "l" and f == "h" then table.insert(syllables, #syllables, "ˈ")
else table.insert(syllables, #syllables-1, "ˈ") end
end
end


return table.concat(#noa > 1 and noa or syll, "·")
return table.concat(syllables, "·")
end
end


Navigation menu