Module:qlu-pron: Difference between revisions

No edit summary
No edit summary
Line 41: Line 41:
local first_rules = {
local first_rules = {
-- vowel digraphs
-- vowel digraphs
{"ăe", "ɛ" .. c.breve}, {"âe", "ɛ" .. c.circ}, {"áe", "ɛ" .. c.acute}, {"ae", "ɛ"},
--{"ăe", "ɛ" .. c.breve}, {"âe", "ɛ" .. c.circ}, {"áe", "ɛ" .. c.acute}, {"ae", "ɛ"},
{"ău", "ɔ" .. c.breve}, {"âu", "ɔ" .. c.circ}, {"áu", "ɔ" .. c.acute}, {"au", "ɔ"},
--{"ău", "ɔ" .. c.breve}, {"âu", "ɔ" .. c.circ}, {"áu", "ɔ" .. c.acute}, {"au", "ɔ"},
{"ĕi", "Ĭ"}, {"êi", "Î"}, {"éi", "Í"}, {"ei", "I"},
--{"ĕi", "Ĭ"}, {"êi", "Î"}, {"éi", "Í"}, {"ei", "I"},
-- Graco-Roman digraphs
-- Graco-Roman digraphs
Line 110: Line 110:
local unstressed = "[ăĕ" .. c.breve .. "]"
local unstressed = "[ăĕ" .. c.breve .. "]"
for i, syll in ipairs(syllables) do
for i, syll in ipairs(syllables) do
if match(word, first_stress) then
if match(syll, first_stress) then
if match(syll, first_stress) then
syll = "ˈ" .. gsub(mw.ustring.toNFD(syll), c.circ, "")
syll = "ˈ" .. gsub(mw.ustring.toNFD(syll), c.circ, "")
end
elseif match(word, "[ɛɔI]") then
elseif match(word, "[ɛɔI]") then
if match(syll, "[ɛɔI]") then
if match(syll, "[ɛɔI]") then
syll = "ˈ" .. syll
syll = "ˈ" .. syll
end
end
else
table.insert(syllables, #syllables-1, "ˈ")
return table.concat(syllables, "·")
end
end
Line 153: Line 148:
end
end
return table.concat(syllables, "·")
local ret = syllables
if table.concat(ret, "·") == word then
table.insert(ret, #ret-1, "ˈ")
end
return table.concat(ret, "·")
end
end