Module:anui-pron: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 21: Line 21:
local front_vowel = "iea"
local front_vowel = "iea"
local vowel = "[" .. back_vowel .. front_vowel .. "]"
local vowel = "[" .. back_vowel .. front_vowel .. "]"
local oral_to_nasal = {["a"] = "ã", ["i"] = "ĩ", ["ɔ"] = "ṍ", ["u"] = "ᴍ"}
local oral_to_nasal = {["a"] = "ã", ["i"] = "ĩ", ["ɔ"] = "ṍ", ["u"] = "ᴍ"} -- ṍ = ɔ̃
local modal_to_glottal = {["a"] = "à", ["i"] = "ì", ["ɔ"] = "ò", ["u"] = "ù"} -- ṏ = ɔ̰
local nasalized = "[ãĩṍᴍ]"
local nasalized = "[ãĩṍᴍ]"
local glottalic = "[àèìòù]"


local function same(foo, bar)
local function same(foo, bar)
foo, bar = mw.ustring.toNFD(foo), mw.ustring.toNFD(bar)
foo, bar = mw.ustring.toNFD(foo), mw.ustring.toNFD(bar) -- decompose diacritics
foo, bar = match(foo, "^."), match(bar, "^.")
foo, bar = match(foo, "^."), match(bar, "^.") -- sort out the letter
return foo == bar and true or false
return foo == bar and true or false
end
end
Line 38: Line 40:
{"(" .. vowel .. ")(".. vowel .. ")", function(s1, s2) return same(s1, s2) and s1 .. "ː˧" or s1 .. s2 .. "˧" end},
{"(" .. vowel .. ")(".. vowel .. ")", function(s1, s2) return same(s1, s2) and s1 .. "ː˧" or s1 .. s2 .. "˧" end},
{"(" .. vowel .. ")(" .. nasalized .. ")", function(s1, s2) return same(s1, s2) and s2 .. "ː" .. HIGHFALL or oral_to_nasal[s1] .. s2 .. HIGHFALL end},
{"(" .. vowel .. ")(" .. nasalized .. ")", function(s1, s2) return same(s1, s2) and s2 .. "ː" .. HIGHFALL or oral_to_nasal[s1] .. s2 .. HIGHFALL end},
 
{"([" .. front_vowel .. "])(" .. glottalic .. ")", function(s1, s2) return same(s1, s2) and s2 .. "ː" .. HIGHFALL or modal_to_glottal[s1] .. s2 .. HIGHFALL end},
{"ṍ", "ɔ" .. NASAL},
{"ṍ", "ɔ" .. NASAL},
}
}

Navigation menu