Module:qhv-pron: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 15: Line 15:
local NONSYLLABIC = u(0x032F) -- non-syllabic, combining inverted breve below
local NONSYLLABIC = u(0x032F) -- non-syllabic, combining inverted breve below
local DIPHTHONG = u(0x035C) -- double articulation, combining double breve below
local DIPHTHONG = u(0x035C) -- double articulation, combining double breve below
local vowels = "[aeiouyː" .. NONSYLLABIC .. DIPHTHONG .. "]"
local vowels = "[aeiouyáéíóúýàèìòùỳː" .. NONSYLLABIC .. DIPHTHONG .. "]"


local rules = {
local rules = {
{"rh", "ṛ"}, {"th", "θ"}, {"lj", "ʎ"}, {"ñ", "ɲ"}, {"kh", "x"}, {"[gɡ]h", "ɣ"}, {"g", "ɡ"},
{"rh", "ṛ"}, {"th", "θ"}, {"lj", "ʎ"}, {"ñ", "ɲ"}, {"kh", "x"}, {"[gɡ]h", "ɣ"}, {"g", "ɡ"},
{"([][eo])", "%1" .. NONSYLLABIC}, {"([iu])([aāeēoō])", "%1" .. DIPHTHONG .. "%2"},  
{"([aāáà][eo])", "%1" .. NONSYLLABIC}, {"([iíuú])([aāeēoōáéóàèò])", "%1" .. DIPHTHONG .. "%2"},  
{"ā", "aː"}, {"ē", "eː"}, {"ī", "iː"}, {"ō", "oː"}, {"ū", "uː"}, {"ȳ", "yː"},
{"ā", "aː"}, {"ē", "eː"}, {"ī", "iː"}, {"ō", "oː"}, {"ū", "uː"}, {"ȳ", "yː"},
{"à", "áː"}, {"è", "éː"}, {"ì", "íː"}, {"ò", "óː"}, {"ù", "úː"}, {"ỳ", "ýː"},
{"n([" .. velar .. "])", "ŋ%1"}, {"n([" .. uvular .. "])", "ɴ%1"}, {"(" .. vowels .. ")r(" .. vowels .. ")", "%1ɾ%2"},  
{"n([" .. velar .. "])", "ŋ%1"}, {"n([" .. uvular .. "])", "ɴ%1"}, {"(" .. vowels .. ")r(" .. vowels .. ")", "%1ɾ%2"},  
Line 39: Line 40:
local syllables = split(term, "·")
local syllables = split(term, "·")
for i, syllable in ipairs(syllables) do
for i, syllable in ipairs(syllables) do
if match(syllable, "[àèìòùỳáéíóúý]") then
table.insert(syllables, i, "ˈ")
return table.concat(syllables)
end
if match(syllable, consonants .. "$") or match(syllable, "ː$") then weight[i] = "h"
if match(syllable, consonants .. "$") or match(syllable, "ː$") then weight[i] = "h"
elseif match(syllable, NONSYLLABIC .. "$") then weight[i] = "h"
elseif match(syllable, NONSYLLABIC .. "$") then weight[i] = "h"