Module:Hoo-ipac: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 16: Line 16:
local export = {}
local export = {}


local cons = "[pbfmʋstdnlkgŋʁɬjhχ]"
local cons = "[pbfmʋstdnlkgɡŋʁɬjhχ]"
local vow = "[aiuɛeɔoʉɟə]"
local vow = "[aiuɛeɔoʉɟə]"


Line 33: Line 33:
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", "ɣ"}, {"ɣɣ", "ɡː"},
{"([fʋsnlŋʁɬχ])([pbtdkg])", function(c1,c2) return c1..c2.."⁽ᵊ⁾" end},
{"([fʋsnlŋʁɬχ])([pbtdkg])", function(c1,c2) return c1..c2.."⁽ᵊ⁾" end},
{"([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
}
}


function export.crux(term)
local makrules = {
{"ʰ", ""}, {"eː", "ɛː"}, {"oː", "ɔː"},
{"ʁ([ptkfsnɬə])", function(c1) return "χ"..c1 end},
}
 
local kalrules = {
{"ɡ", "ɣ"}, {"ɣː", "ɡː"}, {"u", "ʉ"},
{"i", "ɪ"}, {"ɪː", "iː"},
{"ː(" ..vow..")", function(v1) return "q"..v1 end}, {"ː", ""}, {"q", "ː"}
}
 
function export.crux(term, dialect)
term = mw.ustring.lower(term)
term = mw.ustring.lower(term)
Line 47: Line 60:
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
end
end
Line 55: Line 74:
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 94:


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})
"* (''Maaknuna'') " .. m_IPA.format_IPA_full({lang = lang, items = mIPA_args})
"* (''Kalaalann'') " .. m_IPA.format_IPA_full({lang = lang, items = kIPA_args})
end
end


3,764

edits