45,639
edits
No edit summary |
mNo edit summary |
||
(98 intermediate revisions by the same user not shown) | |||
Line 11: | Line 11: | ||
local TILDE, NASAL = u(0x0303), u(0x0303) -- COMBINING TILDE ̃◌ | local TILDE, NASAL = u(0x0303), u(0x0303) -- COMBINING TILDE ̃◌ | ||
local TILDEBELOW, CREAKY = u(0x0330), u(0x0330) -- COMBINING TILDE BELOW ̰◌ | local TILDEBELOW, CREAKY = u(0x0330), u(0x0330) -- COMBINING TILDE BELOW ̰◌ | ||
local SPH = CREAKY .. CREAKY -- sphincteric or strident vowel | |||
local GRAVE = u(0x0300) -- COMBINING GRAVE ACCENT ̀◌ | local GRAVE = u(0x0300) -- COMBINING GRAVE ACCENT ̀◌ | ||
local HIGHFALL = "˥˦" | local HIGHFALL = "˥˦" | ||
local SYLLABIC = u(0x0329) -- COMBINING VERTICAL LINE BELOW ̩◌ | local SYLLABIC = u(0x0329) -- COMBINING VERTICAL LINE BELOW ̩◌ | ||
local SYLLABICA = u(0x030D) -- COMBINING VERTICAL LINE ABOVE ̍◌ | local SYLLABICA = u(0x030D) -- COMBINING VERTICAL LINE ABOVE ̍◌ | ||
local | local DENTAL = u(0x032A) -- COMBINING BRIDGE BELOW ̪◌ | ||
local INTERDENTAL = DENTAL .. u(0x0346) -- COMBINING BRIDGE BELOW AND ABOVE ̪͆◌ | |||
local VOICELESS = u(0x0325) -- COMBINING RING BELOW ̥◌ | local VOICELESS = u(0x0325) -- COMBINING RING BELOW ̥◌ | ||
local AFFR = u(0x0361) -- COMBINING DOUBLE INVERTED BREVE ͡ | |||
local back_vowel = "uɯɔɑ" | local back_vowel = "uɯɔɑ" | ||
Line 22: | Line 25: | ||
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 nasal_to_oral = {["ã"] = "a" .. NASAL, ["ĩ"] = "i" .. NASAL, ["ṍ"] = "ɔ" .. NASAL} | ||
local modal_to_glottal = {["a"] = "à", ["e"] = "è", ["i"] = "ì", ["ɔ"] = "ò", ["u"] = "ù"} | |||
local glottal_to_modal = {["à"] = "a" .. SPH, ["è"] = "e" .. SPH, ["ì"] = "i" .. SPH, ["ò"] = "ɔ" .. CREAKY, ["ù"] = "u" .. CREAKY} | |||
local nasalized = "[ãĩṍᴍ]" | local nasalized = "[ãĩṍᴍ]" | ||
local glottalic = "[àèìòù]" | local glottalic = "[àèìòù]" | ||
local oral = "[aeiouàèìòù]" | |||
local sonorant = "[rmnɳɖɲlŋᴟ]" | |||
local click = "ǀǃʘǂǁ" | |||
local function same(foo, bar) | local function same(foo, bar) | ||
Line 35: | Line 44: | ||
local rules = { | local rules = { | ||
{"ʇ", "ǀ"}, {"õ", "ṍ"}, {"o", "ɔ"}, {"ṭ", "ʈ"}, {"j", "ɟ"}, {"ñ", "ɲ"}, | {"ʇ", "ǀ"}, {"õ", "ṍ"}, {"o", "ɔ"}, {"ṭ", "ʈ"}, {"j", "ɟ"}, {"ñ", "ɲ"}, {"ch", "tʃ"}, {"ʈr", "ʈʂ"}, {"ṇ", "ɳ"}, {"ṣ", "ʂ"}, {"š", "ʃ"}, | ||
{"ṯ([" .. front_vowel .. "])", "s%1"}, | |||
{"k([" .. front_vowel .. "])", "kx%1"}, {"k([" .. back_vowel .. "])", "q%1"}, | |||
{"([ḛḭṵaɔ]" .. TILDEBELOW .. "?)", {["ḛ"] = "è", ["ḭ"] = "ì", ["ṵ"] = "ù", ["a" .. TILDEBELOW] = "à", ["ɔ" .. TILDEBELOW] = "ò"}}, | {"([ḛḭṵaɔ]" .. TILDEBELOW .. "?)", {["ḛ"] = "è", ["ḭ"] = "ì", ["ṵ"] = "ù", ["a" .. TILDEBELOW] = "à", ["ɔ" .. TILDEBELOW] = "ò"}}, | ||
{"([uùm]ʼ?)m", "%1ᴍ"}, {"m(ʼᴍ)", "ᴍ%1"}, -- | |||
{"([" .. click .. "])(" .. glottalic .. ")", "%1ˀ%2"}, -- ꞰV̰ = ꞰˀV̰ | |||
-- tell apart between regular and syllabic <m> | |||
{"(" .. oral .. ")m(" .. vowel .. ")", "%1ᴟ%2"}, {"([uùm]ʼ?)m", "%1ᴍ"}, {"m(ʼᴍ)", "ᴍ%1"}, {"(" .. oral .. ")m", "%1ᴍ"}, | |||
{"(" .. sonorant .. ")(" .. glottalic .. ")", "%1" .. CREAKY .. "%2"}, -- MV̰ > M̰V̰ | |||
{"[mᴟ](" .. vowel .. ")", "ᴟᵇ%1"}, {"ŋ(" .. vowel .. ")", "ŋᶢ%1"}, {"ɳ(" .. vowel .. ")", "ᶯɖ%1"}, | |||
{"(" .. 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 .. ")", | ||
{"(" .. glottalic .. ")([" .. front_vowel .. "])", function(s1, s2) return same and s1 .. "ː˦" or | function(s1, s2) | ||
return same(s1, s2) and s2 .. "ː" .. HIGHFALL or oral_to_nasal[s1] .. s2 .. HIGHFALL | |||
end | |||
}, | |||
{"(" .. glottalic .. ")([" .. front_vowel .. "])", | |||
function(s1, s2) | |||
return same(s1, s2) and s1 .. "ː˦" or s1 .. modal_to_glottal[s2] .. "˦" | |||
end | |||
}, | |||
{"(" .. glottalic .. ")([" .. back_vowel .. "])", | |||
function(s1, s2) | |||
return same(s1, s2) and s1 .. "ː˨" or s1 .. modal_to_glottal[s2] .. "˨" | |||
end | |||
}, | |||
{"(" .. glottalic .. ")(" .. nasalized .. ")", | |||
function(s1, s2) | |||
return same(s1, s2) and glottal_to_modal[s1] .. NASAL .. "ː˧" or glottal_to_modal[s1] .. NASAL .. s2 .. "˧" | |||
end | |||
}, | |||
{"(" .. glottalic .. "ʼ[" .. front_vowel .. "])", "%1˦"}, {"(" .. glottalic .. "ʼ[" .. back_vowel .. "])", "%1˨"}, | |||
{"(" .. glottalic .. ")ʼ(" .. nasalized .. ")", function(s1, s2) return glottal_to_modal[s1] .. NASAL .. "ʔ" .. s2 .. HIGHFALL end}, | |||
{"ṍ", "ɔ" .. NASAL}, | {"([^uɯɔɑieaʼ])m([^uɯɔɑieaʼ])", "%1ᴍ%2"}, {"u" .. CREAKY .. NASAL, "ᴍ" .. CREAKY}, | ||
{"ᴍᴍ", "m" .. SYLLABIC .. "ː"}, {"ùᴍ", "m" .. CREAKY .. SYLLABICA .. "ː˧"}, | |||
{"ᴍʼᴍ", "m" .. SYLLABICA .. CREAKY .. "ʔm" .. SYLLABIC .. "˧"}, {"ᴍ" .. CREAKY .. "ᴍ", "m" .. CREAKY .. SYLLABICA .. "ː"}, | |||
{"ᴍ" .. CREAKY, "m" .. CREAKY .. SYLLABICA}, {"ṍṍ", "ṍː"}, {"ṍ", "ɔ" .. NASAL}, {"(" .. glottalic .. ")", function(s1) return glottal_to_modal[s1] end}, | |||
{"ᴍ", "m" .. SYLLABIC}, | |||
{"mᵇm", "mm"}, {"ŋᶢm", "ŋm"}, {"ᶯɖm", "ɳm"}, | |||
{"ɴ", "ᵑ"}, {"([" .. click .. "])ʼ", "%1ˀ"}, {"(ᵑ[" .. click .. "])x", "%1ʁ"}, {"([" .. click .. "])x", "%1χ"}, {"([^ʈɬcq])ʼ", "%1ʔ"}, | |||
{"^ʼ", "ʔ"}, {"ŋ([" .. back_vowel .. "])", "ɴ%1"}, {"(" .. vowel .. ")ᵑ", "%1" .. NASAL .. "ᵑ"}, | |||
{"([" .. click .. "][qʛχʁ]?ʼ?)a", "%1ɑ"}, {"([" .. click .. "][qʛχʁ]?ʼ?)ã", "%1ɑ" .. NASAL}, {"ɑ" .. SPH, "ɑ" .. CREAKY}, -- A-backening | |||
{"([ʈʂɳɖ])u", "%1ɯ"}, {"([ʘǃǁ][qχʁʛ]?ʼ?)u", "%1ɯ"}, -- U-unrounding | |||
{"([ʈtk])([ʂʃɬxs])", "%1" .. AFFR .. "%2"}, {"ᴟ", "m"}, | |||
{"s", "s" .. DENTAL}, {"ṯ", "t" .. INTERDENTAL .. AFFR .. "s" .. DENTAL}, {"ṉ", "n" .. INTERDENTAL .. VOICELESS}, | |||
{"([" .. click .. "])([qχʁʛ])", "%1" .. AFFR .. "%2"}, {"u" .. NASAL, "m" .. SYLLABIC}, {"ɔ" .. CREAKY .. "ɔ" .. CREAKY, "ɔ" .. CREAKY .. "ː"}, | |||
} | } | ||
function export.crux(term) | function export.crux(term) | ||
term=mw.ustring.lower(term) | term = term:gsub("N", "ɴ"); term = term:gsub("Ɠ", "ʛ") | ||
term = mw.ustring.lower(term) | |||
for _, rule in ipairs(rules) do | for _, rule in ipairs(rules) do | ||
Line 53: | Line 109: | ||
return term | return term | ||
end | |||
function IPA_span(items) | |||
local bits = {} | |||
for _, item in ipairs(items) do | |||
local bit = "<span style=\"font-size:110%;font-family:'Gentium','DejaVu Sans','Segoe UI',sans-serif>" .. item.pron .. "</span>" | |||
table.insert(bits, bit) | |||
end | |||
return table.concat(bits) | |||
end | |||
function format_IPA(items) | |||
return "[[w:IPA chart|IPA]]<sup>([[IPA for ǂA Ṇṵĩ|key]])</sup>: " .. IPA_span(items) | |||
end | |||
function line_format(pronunciation) | |||
local full_pronunciations = {} | |||
local IPA_args = {{pron = '[' .. pronunciation .. ']'}} | |||
table.insert(full_pronunciations, format_IPA(IPA_args)) | |||
return table.concat(full_pronunciations) | |||
end | |||
function separate_word(term) | |||
local result = {} | |||
for word in gsplit(term, " ") do | |||
table.insert(result, export.crux(word)) | |||
end | |||
return table.concat(result, " ") | |||
end | |||
function export.show(frame) | |||
local params = { | |||
[1] = { default = mw.title.getCurrentTitle().nsText == 'Template' and "ǂAː Ṇṵĩ" or mw.title.getCurrentTitle().text }, | |||
} | |||
local args = require("Module:parameters").process(frame:getParent().args, params) | |||
local term = args[1] | |||
local ipa = "* " | |||
ipa = ipa .. line_format(separate_word(term)) | |||
return ipa | |||
end | end | ||
return export | return export |