Module:xchc-pron: Difference between revisions
No edit summary |
No edit summary |
||
| (4 intermediate revisions by the same user not shown) | |||
| Line 17: | Line 17: | ||
local nb_cons = "mnŋɲptbdkɡfvszʃʒxɣhʧʦʤʣlrɾʎ" | local nb_cons = "mnŋɲptbdkɡfvszʃʒxɣhʧʦʤʣlrɾʎ" | ||
local consonants = "[" .. nb_cons .. "]" | local consonants = "[" .. nb_cons .. "]" | ||
local consonantsAsIs = "[мньӈбдгвзжғлрйпткфсшӀчц]" | |||
local vowels = "[ыиэеаяүөуюоёӯӣɜɔ]" | |||
local export = {} | local export = {} | ||
| Line 114: | Line 117: | ||
function export.harmony(term) | function export.harmony(term) | ||
term = export.simplify(term) | term = export.simplify(term) | ||
local termR, termB = term, term | |||
local unrounded = "[ыиӣеэ]"; local rounded = "[үөуӯюоё]"; local neutralR = "[ɛɔая]" | |||
local front = "ɛ"; local back = "ɔ"; local neutralB = "[ыиӣеэүөуӯюоёая]" | |||
-- for words that violate vowel harmony (compounds and loanwords) | |||
local exception = (term:match(unrounded) and term:match(rounded)) or (term:match(front) and term:match(back)) | |||
if exception then | |||
termR = term:gsub(neutralR, ""); termB = term:gsub(neutralB, "") | |||
termR = termR:match("(".. vowels .. consonantsAsIs .. "*)$") or termR; termB = termB:match("(" .. vowels .. consonants .. "*)$") or termB | |||
end | |||
local ret = { | local ret = { | ||
["roundness"] = | ["roundness"] = termR:match(unrounded) and "u" or termR:match(rounded) and "r" or "ar", | ||
["backness"] = | ["backness"] = termB:match(front) and "f" or termB:match(back) and "b" or "ab", | ||
} | } | ||
return ret | return ret | ||
| Line 160: | Line 169: | ||
western = gsub(western, rule[1], rule[2]) | western = gsub(western, rule[1], rule[2]) | ||
end | end | ||
local ipa1 = (western ~= phonetic) and "\n** " .. m_IPA.format_IPA_multiple(lang, {{pron='[' .. western .. ']', | local ipa1 = (western ~= phonetic) and "\n** " .. m_IPA.format_IPA_multiple(lang, {{pron='[' .. western .. ']', l={"Western"}}}) or "" | ||
local surgut = phonetic | local surgut = phonetic | ||
| Line 166: | Line 175: | ||
surgut = gsub(surgut, rule[1], rule[2]) | surgut = gsub(surgut, rule[1], rule[2]) | ||
end | end | ||
local ipa2 = (surgut ~= phonetic) and "\n** " .. m_IPA.format_IPA_multiple(lang, {{pron='[' .. surgut .. ']', | local ipa2 = (surgut ~= phonetic) and "\n** " .. m_IPA.format_IPA_multiple(lang, {{pron='[' .. surgut .. ']', l={"Surgut"}}}) or "" | ||
return "* " .. m_IPA.format_IPA_full{lang = lang, items = {{pron='[' .. phonetic .. ']'}}} .. ipa1 .. ipa2 | return "* " .. m_IPA.format_IPA_full{lang = lang, items = {{pron='[' .. phonetic .. ']'}}} .. ipa1 .. ipa2 | ||