Module:Hoo-ipac: Difference between revisions
No edit summary |
No edit summary |
||
| (16 intermediate revisions by the same user not shown) | |||
| Line 16: | Line 16: | ||
local export = {} | local export = {} | ||
local cons = "[ | local cons = "[pbfmʋstdnlkgɡŋʁɬjhχ]" | ||
local vow = "[ | local vow = "[ɑaiuɛeɔoʉɟə]" | ||
local function same(foo, bar) | local function same(foo, bar) | ||
| Line 26: | Line 26: | ||
local translit = { | local translit = { | ||
{"v", "ʋ"}, {"ng", "ŋ"}, {"nk", "ŋk"}, {"nk", "ŋk"}, {"r", "ʁ"}, {"ł", "ɬ"}, | {"æ", "ææ"}, {"v", "ʋ"}, {"ng", "ŋ"}, {"nk", "ŋk"}, {"nk", "ŋk"}, {"r", "ʁ"}, {"ł", "ɬ"}, | ||
{"aa", " | {"aa", "ɑː"}, {"ii", "iː"}, {"uu", "uː"}, {"åå", "oː"}, {"ææ", "eː"}, | ||
{"au", "aʊ"}, {"ai", "aj"}, {"åʁ", "ɟʁ"}, {"å", "u"}, {"æ", "i"}, {"eʁ", "ɛʁ"}, {"e", "ə"}, {"o", "ɔ"} | {"au", "aʊ"}, {"ai", "aj"}, {"åʁ", "ɟʁ"}, {"å", "u"}, {"æ", "i"}, {"eʁ", "ɛʁ"}, {"e", "ə"}, {"o", "ɔ"}, {"əɛ", "eː"}, {"əə", "eː"}, {"ɔɔ", "oː"} | ||
} | } | ||
local rules = { | local rules = { | ||
{"ɟʁ" ..vow, function(v1) return "uʁ"..v1 end}, {"uʁɟʁ", "uʁ"}, {"ɟʁ", "ɔʁ"}, --dealing with å | {"ɟʁ" ..vow, function(v1) return "uʁ"..v1 end}, {"uʁɟʁ", "uʁ"}, {"ɟʁ", "ɔʁ"}, --dealing with å | ||
{"([ | {"g(" ..vow..")", function(v1) return "ɡ"..v1 end}, {"g", "ɣ"}, {"ɣɣ", "ɡː"}, | ||
{"([ptk])("..vow..")", function(c,v) return c.."ʰ"..v end}, | |||
{"(" .. cons .. ")(" .. cons .. ")", function(c1,c2) return same(c1,c2) and c1 .. "ː" or c1 .. c2 end}, --gemination, should go at end | {"(" .. cons .. ")(" .. cons .. ")", function(c1,c2) return same(c1,c2) and c1 .. "ː" or c1 .. c2 end}, --gemination, should go at end | ||
{"(" .. cons .. ")(" .. cons .. ")(" .. cons .. ")", function(c1,c2,c3) return same(c2,c3) and c1..c2.. "ː" or c1 .. c2 .. c3 end}, --gemination, should go at end | {"(" .. cons .. ")(" .. cons .. ")(" .. cons .. ")", function(c1,c2,c3) return same(c2,c3) and c1..c2.. "ː" or c1 .. c2 .. c3 end}, --gemination, should go at end | ||
{"([fʋsnlŋʁɬχ])([pbtdkg])("..cons..")", function(c1,c2,c3) return c1..c2.."⁽ᵊ⁾"..c3 end}, | |||
{"([fʋsnlŋʁɬχ])("..cons..")$", function(c1,c2) return c1..c2.."⁽ᵊ⁾" end}, | |||
} | } | ||
function export.crux(term) | local postrules = { | ||
{"ːʰ", "ː"}, | |||
{"("..cons..")("..cons..")ʰ", function(c1,c2) return c1..c2.."" end}, | |||
} | |||
local makrules = { | |||
{"ʰ", ""}, {"eː", "ɛː"}, {"oː", "ɔː"}, {"ːʰ", "ː"}, {"ɑ", "a"}, | |||
{"ʁ([ptkfsnɬə])", function(c1) return "χ"..c1 end}, | |||
} | |||
local kalrules = { | |||
{"ɡ", "ɣ"}, {"ɣː", "ɡː"}, {"u", "ʉ"}, | |||
{"i", "ɪ"}, {"ɪː", "iː"}, | |||
{"("..cons..")ː(" ..vow..")", function(c1, v1) return c1.."q"..v1 end}, | |||
{"("..vow..")ː", function(v1) return v1.."q" end}, {"ː", ""}, {"q", "ː"} | |||
} | |||
function export.crux(term, dialect) | |||
term = mw.ustring.lower(term) | term = mw.ustring.lower(term) | ||
| Line 47: | Line 67: | ||
for _, rule in ipairs(rules) do | for _, rule in ipairs(rules) do | ||
term = gsub(term, rule[1], rule[2]) | term = gsub(term, rule[1], rule[2]) | ||
end | |||
if dialect == "mak" then | |||
for _, rule in ipairs(makrules) do | |||
term = gsub(term, rule[1], rule[2]) | |||
end | |||
elseif dialect == "kal" then | |||
for _, rule in ipairs(kalrules) do | |||
term = gsub(term, rule[1], rule[2]) | |||
end | |||
else | |||
for _, rule in ipairs(postrules) do | |||
term = gsub(term, rule[1], rule[2]) | |||
end | |||
end | end | ||
| Line 55: | Line 89: | ||
end | end | ||
function separate_word(term) | function separate_word(term, dialect) | ||
local result = {} | local result = {} | ||
for word in gsplit(term, " ") do | for word in gsplit(term, " ") do | ||
table.insert(result, export.crux(word)) | table.insert(result, export.crux(word, dialect)) | ||
end | end | ||
| Line 74: | Line 109: | ||
local IPA_args = {} | local IPA_args = {} | ||
local phonetic = separate_word(term) | local mIPA_args = {} | ||
local kIPA_args = {} | |||
local phonetic = separate_word(term, "standard") | |||
local mphonetic = separate_word(term, "mak") | |||
local kphonetic = separate_word(term, "kal") | |||
table.insert(IPA_args, {pron = '[' .. phonetic .. ']'}) | table.insert(IPA_args, {pron = '[' .. phonetic .. ']'}) | ||
table.insert(mIPA_args, {pron = '[' .. mphonetic .. ']'}) | |||
table.insert(kIPA_args, {pron = '[' .. kphonetic .. ']'}) | |||
return | return | ||
"* (''Standard'')" .. m_IPA.format_IPA_full({lang = lang, items = IPA_args}) | "* (''Standard'') " .. m_IPA.format_IPA_full({lang = lang, items = IPA_args}).. | ||
"\n* (''Maaknuna'') " .. m_IPA.format_IPA_full({lang = lang, items = mIPA_args}).. | |||
"\n* (''Kalaalann'') " .. m_IPA.format_IPA_full({lang = lang, items = kIPA_args}) | |||
end | end | ||