Module:qlu-pron: Difference between revisions

No edit summary
No edit summary
Line 18: Line 18:
local voiceless = "ptʈkɸfsθʃxʦʧʨḱ"
local voiceless = "ptʈkɸfsθʃxʦʧʨḱ"
local consonants = "[" .. voiced .. voiceless .. "ʷː]"
local consonants = "[" .. voiced .. voiceless .. "ʷː]"
local front = "iïíĬIÎÍeĕéêɛɪæyʏøœ"
local front = "ieɛɪæyʏøœ"
local back = "uoɔʊʌɑɒ"
local back = "uoɔʊʌɑɒ"
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)
return gsub(mw.ustring.toNFD(str), "(" .. vowels .. ")[" .. c.diacritics .. "]", "%1")
end


local function laxen(v)
local function laxen(v)
Line 49: Line 53:
{"ch", "k"}, {"g([ckqg])", "ŋ%1"},
{"ch", "k"}, {"g([ckqg])", "ŋ%1"},
{"sc([eêiïIÍ])", "ʃ%1"}, {"([^ŋ])c([eêiïIÍ])", "%1ʧ%2"},
{"sc([eêĕéiïíî])", "ʃ%1"}, {"([^ŋ])c([eêĕéiïíî])", "%1ʧ%2"},
{"g([eêiïIÍ])", "ʤ%1"}, {"gh", "g"},
{"g([eêĕéiïíî])", "ʤ%1"}, {"gh", "g"},
{"c", "k"}, {"ŋʤ", "dʤ"}, {"dz", "ʣ"},
{"c", "k"}, {"ŋʤ", "dʤ"}, {"dz", "ʣ"},
{"ŋgü", "gǵ"}, {"gu(" .. vowels .. ")", "ǵ%1"},
{"ŋgü", "gǵ"}, {"gu(" .. vowels .. ")", "ǵ%1"},
{"gl([iïIÎÍ]?)", "ʎ%1"}, {"gn([iïIÎÍ]?)", "ɲ%1"},
{"gl([iïíî]?)", "ʎ%1"}, {"gn([iïíî]?)", "ɲ%1"},
{"(" .. vowels .. ")([ʣʎɲ])(" .. vowels .. ")", "%1%2%2%3"},
{"(" .. vowels .. ")([ʣʎɲ])(" .. vowels .. ")", "%1%2%2%3"},
Line 106: Line 110:
if #syllables == 1 then return table.concat(syllables) end -- account for monosyllables
if #syllables == 1 then return table.concat(syllables) end -- account for monosyllables
local first_stress = "[âêîÎôû" .. c.circ .. "]"
local first_stress = "[âêîôû]"
local second_stress = "[áéíÍóú" .. c.acute .. "]"
local second_stress = "[áéíóú]"
local unstressed = "[ăĕ" .. c.breve .. "]"
local unstressed = "[ăĕ]"
for i, syll in ipairs(syllables) do
for i, syll in ipairs(syllables) do
if match(syll, first_stress) then
if match(word, first_stress) then
syll = "ˈ" .. gsub(mw.ustring.toNFD(syll), c.circ, "")
if match(syll, first_stress) then
elseif match(word, "[ɛɔI]") then
syll = "ˈ" .. dediacv(syll)
if match(syll, "[ɛɔI]") then
else break end
syll = "ˈ" .. syll
elseif match(word, "a[eu]") or match(word, "ei") then
end
if match(syll, "a[eu]") or match(syll, "ei") then
syll = "ˈ" .. dediacv(syll)
else break end
end
end