Module:qay-pron: Difference between revisions
Created page with "local sub = mw.ustring.sub local find = mw.ustring.find local gmatch = mw.ustring.gmatch local gsub = mw.ustring.gsub local match = mw.ustring.match local u = mw.ustring.char..." |
No edit summary |
||
| Line 21: | Line 21: | ||
local vowels = "[aeiouyáéíóúýàèìòùỳː" .. NONSYLLABIC .. DIPHTHONG .. "]" | local vowels = "[aeiouyáéíóúýàèìòùỳː" .. NONSYLLABIC .. DIPHTHONG .. "]" | ||
local | local phonemic_rules = { | ||
{" | {"mh", "m"}, | ||
} | |||
local phonetic_rules = { | |||
{"mh", "m"}, {"th", "θ"}, {"lj", "ʎ"}, {"ñ", "ɲ"}, {"kh", "x"}, {"[gɡ]h", "ɣ"}, {"g", "ɡ"}, | |||
} | } | ||
| Line 36: | Line 33: | ||
} | } | ||
function | local function write_stress(term) | ||
local pattern = "(" .. consonants .. "*".. vowels .. "*" .. consonants .. "-)" | --[=[local pattern = "(" .. consonants .. "*".. vowels .. "*" .. consonants .. "-)" | ||
local weight = {} | local weight = {} | ||
term = gsub(term, pattern, "·%1") | term = gsub(term, pattern, "·%1") | ||
| Line 71: | Line 68: | ||
else table.insert(syllables, #syllables-1, "ˈ") end | else table.insert(syllables, #syllables-1, "ˈ") end | ||
return table.concat(syllables) | return table.concat(syllables)]=] | ||
return term | |||
end | end | ||
function export. | function export.phonemic(term) | ||
term = mw.ustring.lower(term) | term = mw.ustring.lower(term) | ||
for _, | for _, micrule in ipairs(phonemic_rules) do | ||
term = gsub(term, | term = gsub(term, micrule[1], micrule[2]) | ||
end | end | ||
return | return write_stress(term) | ||
end | end | ||
function export. | function export.phonetic(term) | ||
term = mw.ustring.lower(term) | |||
for _, | for _, ticrule in ipairs(phonetic_rules) do | ||
term = gsub(term, | term = gsub(term, ticrule[1], ticrule[2]) | ||
end | end | ||
return term | return write_stress(term) | ||
end | end | ||