Module:qay-pron: Difference between revisions
No edit summary |
No edit summary |
||
| (18 intermediate revisions by the same user not shown) | |||
| Line 14: | Line 14: | ||
local export = {} | local export = {} | ||
local consonants = "[ | local consonants = "[pbmvstdnrɾlkɡŋhxçʤʧjwçx2]" | ||
local front = "iɪeɛ" | local front = "iɪeɛ" | ||
local back = " | local back = "oɔuʊ" | ||
local vowels = "[a" .. front .. back .. " | local vowels = "[a" .. front .. back .. "ː´2]" | ||
local function laxen(v) | local function laxen(v) | ||
local otc = {} | local otc = {} | ||
local switch = {["e"] = "ɛ", ["i"] = "ɪ", ["o"] = "ɔ", ["u"] = "ʊ | local switch = {["e"] = "ɛ", ["i"] = "ɪ", ["o"] = "ɔ", ["u"] = "ʊ"} | ||
for vc in gmatch(v, ".") do | for vc in gmatch(v, ".") do | ||
vc = gsub(vc, vc, switch[vc]) | if switch[vc] then vc = gsub(vc, vc, switch[vc]) end | ||
table.insert(otc, vc) | table.insert(otc, vc) | ||
end | end | ||
| Line 37: | Line 37: | ||
local first_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 | ||
{"ā", "aː"}, {"ē", "eː"}, {"ī", "iː"}, {"ō", "oː"}, {"ū", "uː"}, | {"ā", "aː"}, {"ē", "eː"}, {"ī", "iː"}, {"ō", "oː"}, {"ū", "uː"}, | ||
| Line 45: | Line 45: | ||
local phonetic_rules = { | local phonetic_rules = { | ||
{" | {"([ˈˌ])·", "%1"}, {"·([ˈˌ])", "%1"}, {"ˈˌ", "ˌ"}, {"·ˈ´·", "ˈ"}, | ||
{"h([" .. front .. "])", "ç%1"}, {"h([" .. back .. "])", "x%1"}, | {"h([" .. front .. "])", "ç%1"}, {"h([" .. back .. "])", "x%1"}, | ||
| Line 67: | Line 67: | ||
local function syllabify(word) | local function syllabify(word) | ||
word = gsub(word, "2", "ˌ") | |||
word = gsub(word, "(ː)(" .. vowels .. ")", "%1·%2") | word = gsub(word, "(ː)(" .. vowels .. ")", "%1·%2") | ||
word = gsub(word, "(" .. consonants .. "*)(" .. vowels .. "*)", "%1%2·") | word = gsub(word, "(" .. consonants .. "*)(" .. vowels .. "*)", "%1%2·") | ||
| Line 74: | Line 75: | ||
word = gsub(word, "·(" .. consonants .. ")·", "%1·") | word = gsub(word, "·(" .. consonants .. ")·", "%1·") | ||
word = gsub(word, "(" .. consonants .. ")·(" .. consonants .. ")([pbmvstdnrɾlkɡŋhxçʤʧçx])", "%1%2·%3") | word = gsub(word, "(" .. consonants .. ")·(" .. consonants .. ")([pbmvstdnrɾlkɡŋhxçʤʧçx])", "%1%2·%3") | ||
word = gsub(word, "a·ʊ", "aʊ·") | |||
local syllables = split(word, "·"); | local syllables = split(word, "·"); | ||
| Line 79: | Line 81: | ||
if #syllables ~= 1 then | if #syllables ~= 1 then | ||
for i, syll in ipairs(syllables) do | for i, syll in ipairs(syllables) do | ||
if match(syll, "´") | if match(word, "´") and not match(syll, "´") then | ||
break | |||
elseif match(syll, "´") then | |||
syll = syll:gsub("´","ˈ") | |||
return table.concat(syllables, "·") | |||
elseif match(syll, "ː") then | |||
table.insert(syllables, i, "ˈ") | table.insert(syllables, i, "ˈ") | ||
return table.concat(syllables, "·") | return table.concat(syllables, "·") | ||
| Line 144: | Line 151: | ||
table.insert(IPA_args, {pron = '[' .. phonetic .. ']'}) | table.insert(IPA_args, {pron = '[' .. phonetic .. ']'}) | ||
return "* " .. m_IPA.format_IPA_full(lang, IPA_args) | return "* " .. m_IPA.format_IPA_full({lang = lang, items = IPA_args}) | ||
end | end | ||
return export | return export | ||