Module:qay-pron: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 36: Line 36:
end
end


local shared_rules = {
local first_rules = {
{"n(·?)([kg])", "ŋ%1%2"}, {"ŋg", "ŋ"}, {"c", "ʧ"}, {"j", "ʤ"}, {"y", "j"}, {"g", "ɡ"},  
{"n(·?)([kg])", "ŋ%1%2"}, {"ŋg", "ŋ"}, {"c", "ʧ"}, {"j", "ʤ"}, {"y", "j"}, {"g", "ɡ"},  
-- Long vowels
-- Long vowels
Line 42: Line 42:
-- Diphthongs
-- Diphthongs
{"(" .. vowels .. ")y", function(v) return laxen(v) .. "ɪ" end}, {"au", "aʊ"},
{"(" .. vowels .. ")y", function(v) return laxen(v) .. "ɪ" end}, {"au", "aʊ"},
}
local phonemic_rules = {
{"ˈ·", "ˈ"}, {"·ˈ", "ˈ"}, {"h?u([aeiouɛɪɔʊ])", "u%1"}, {"([^nŋ][·ˈ])([tkdɡ])j", "%1%2ʲ"},
{"(" .. consonants .. ")(·?ˈ?)(" .. consonants .. ")", function(c1, st, c2) return same(c1,c2) and st .. c1 or c1 .. st .. c2 end},
{"jj", "j"},
}
}


Line 87: Line 81:
end
end


function export.phonemic(term)
function export.crux(term)
term = mw.ustring.lower(term)
term = mw.ustring.lower(term)
for _, rule in ipairs(shared_rules) do
for _, rule in ipairs(first_rules) do
term = gsub(term, rule[1], rule[2])
term = gsub(term, rule[1], rule[2])
end
end
Line 96: Line 90:
term = syllabify(term)
term = syllabify(term)
for _, micrule in ipairs(phonemic_rules) do
for _, micrule in ipairs(phonetic_rules) do
term = gsub(term, micrule[1], micrule[2])
term = gsub(term, micrule[1], micrule[2])
end
end
term = gsub(term, "·", ".")
return term
end
function export.phonetic(term)
term = mw.ustring.lower(term)
for _, rule in ipairs(shared_rules) do
term = gsub(term, rule[1], rule[2])
end
term = syllabify(term)
for _, ticrule in ipairs(phonetic_rules) do
term = gsub(term, ticrule[1], ticrule[2])
end
term = gsub(term, "a", "ä")
term = gsub(term, "·", ".")
term = gsub(term, "·", ".")
Line 133: Line 108:


local IPA_args = {}
local IPA_args = {}
local phonemic = export.phonemic(term)
local phonetic = export.crux(term)
local phonetic = export.phonetic(term)
table.insert(IPA_args, {pron = '[' .. phonetic .. ']'})
table.insert(IPA_args, {pron = '/' .. phonemic .. '/'})
if phonemic ~= phonetic then
table.insert(IPA_args, {pron = '[' .. phonetic .. ']'})
end


return "* " .. m_IPA.format_IPA_full(lang, IPA_args)
return "* " .. m_IPA.format_IPA_full(lang, IPA_args)

Navigation menu