Module:qlu-pron: Difference between revisions

No edit summary
No edit summary
Line 22: Line 22:
local vowels = "[aáâăɐ" .. front .. back .. c.acute .. c.breve .. c.circ .. c.diaer .. "jw]"
local vowels = "[aáâăɐ" .. front .. back .. c.acute .. c.breve .. c.circ .. c.diaer .. "jw]"


local function dediacv(str)
local function dediacv(str, diacritic)
return gsub(mw.ustring.toNFD(str), "(" .. vowels .. ")[" .. c.diacritics .. "]", "%1")
return gsub(mw.ustring.toNFD(str), diacritic, "")
end
end


Line 102: Line 102:
word = gsub(word, "·(" .. consonants .. ")$", "%1"); word = gsub(word, "^(" .. consonants .. ")·", "%1")
word = gsub(word, "·(" .. consonants .. ")$", "%1"); word = gsub(word, "^(" .. consonants .. ")·", "%1")
word = gsub(word, "·(.)·", "%1·")
word = gsub(word, "·(.)·", "%1·")
word = gsub(word, "·s(" .. voiceless .. ")", "s·%1")
--word = gsub(word, "·s(" .. voiceless .. ")", "s·%1")
--word = gsub(word, "(" .. consonants .. ")s·(" .. voiceless .. ")", "%1·s%2")
--word = gsub(word, "(" .. consonants .. ")s·(" .. voiceless .. ")", "%1·s%2")
word = gsub(word, "ï(" .. vowels .. ")", "i·%1")
word = gsub(word, "ï(" .. vowels .. ")", "i·%1")
Line 118: Line 118:
if match(word, first_stress) then
if match(word, first_stress) then
if match(syllables[i], first_stress) then
if match(syllables[i], first_stress) then
syllables[i] = "ˈ" .. dediacv(syllables[i])
syllables[i] = "ˈ" .. dediacv(syllables[i], c.circ)
end
end
elseif match(word, "a[eu]") or match(word, "ei") then
elseif match(word, "a[eu]") or match(word, "ei") then
if match(syllables[i], "a[eu]") or match(syllables[i], "ei") then
if match(syllables[i], "a[eu]") or match(syllables[i], "ei") then
syllables[i] = "ˈ" .. dediacv(syllables[i])
syllables[i] = "ˈ" .. syllables[i]
end
end
elseif match(syllables[i], second_stress) then
elseif match(syllables[i], second_stress) then
syllables[i] = "ˌ" .. dediacv(syllables[i])
syllables[i] = "ˌ" .. dediacv(syllables[i], c.acute)
end
end
end
end