Module:ábḫ-ipa/remake: Difference between revisions

no edit summary
No edit summary
No edit summary
 
(30 intermediate revisions by the same user not shown)
Line 25: Line 25:
local export = {}
local export = {}


local composer = {
local vowels = "[aäeɛʊiɪɔɐ" .. NONSYLL .. "]"
["s"] = "s",
local consonants = "[βðɺɕθʑɲjxɦDGPTKBmnpkɟt]"
}
 
local vowels = "[aäeɛʊiɪɔɐ]"
local tones = "[ˆˇ´]"
local tones = "[ˆˇ´]"


local rules = {
local start_rules = {
{"[áíó]", function(v) return ("á" and "a" or "í" and "i" or "ó" and "o" or "") .. "´" end},
{"á", ""},
{"aá", "aaˇ"}, {"áa", "aaˆ"}, {"ií", "iiˇ"}, {"íi", "iiˆ"},
{"aá", "aaˇ"}, {"áa", "aaˆ"}, {"ií", "iiˇ"}, {"íi", "iiˆ"},
Line 41: Line 38:
{"(" .. vowels .. "ː?" .. tones .. "?)u", "%1ʊ" .. NONSYLL},
{"(" .. vowels .. "ː?" .. tones .. "?)u", "%1ʊ" .. NONSYLL},
{".", {
{"r", "ɺ"}, {"b", "β"}, {"g", "ɡ"}, {"o", "ɔ"}, {"a", "ä"}, {"s", "ɕ"}, {"z", "θ"}, {"d", "ð"},
["r"] = "ɺ",
{"jh", "ʑ"}, {"j", "ɲ"}, {"y", "j"}, {"", "x"}, {"h", "ɦ"}, {"nð", "D"},
["b"] = "β",
{"nɡ", "G"}, {"mp", "P"}, {"nt", "T"}, {"nk", "K"}, {"^mβ", "B"},
["g"] = "ɡ", -- double- to single-storey
 
["o"] = "ɔ",
 
["a"] = "ä",
 
[""] = "x",
["s"] = "ɕ",
["z"] = "θ",
}}, {"jh", "ʑ"}, {"j", "ɲ"}, {"y", "j"}, {"", ""}, {"", ""},  
{"", ""}, {"", ""}, {"", ""}, {"", ""}, {"", ""}, {"", ""}, {"", ""}, {"", ""}, {"", ""},  
{"", ""}, {"", ""}, {"", ""}, {"", ""}, {"", ""}, {"", ""}, {"", ""}, {"", ""}, {"", ""},  
{"", ""}, {"", ""}, {"", ""}, {"", ""}, {"", ""}, {"", ""}, {"", ""}, {"", ""}, {"", ""},
{"", ""}, {"", ""}, {"", ""}, {"", ""}, {"", ""}, {"", ""}, {"", ""}, {"", ""}, {"", ""},
{"", ""}, {"", ""}, {"", ""}, {"", ""}, {"", ""}, {"", ""}, {"", ""}, {"", ""}, {"", ""},
{"", ""}, {"", ""}, {"", ""}, {"", ""}, {"", ""}, {"", ""}, {"´", "˦"}, {"ˆ", "˥˩"}, {"ˇ", "˩˥"},
 
 
}
}


function export.test(frame)
local end_rules = {
local word = frame.args[1]
{"g", "f"},
}
 
local function syllable_and_stress(word)
local syllables = {}
word = gsub(word, "(" .. consonants .. vowels .. ")", "·%1")
word = gsub(word, "^·", "")
syllables = split(word, "·")
if match(syllables[1], "^[mnjɲβDGPpTtKkBθðɕʑxɦɺ]?" .. vowels .. "ː?" .. tones) then
syllables[1] = "x" .. syllables[1] --table.insert(syllables, 1, "ˈ")
else
end
return table.concat(syllables, "-")
end
 
function export.show(word)
--local word = frame.args[1] or word
for _, srule in ipairs(start_rules) do
word = word:gsub(srule[1], srule[2])
end
word = syllable_and_stress(word)
for _, rule in ipairs(rules) do
for _, erule in ipairs(end_rules) do
word = word:gsub(rule[1], rule[2])
word = word:gsub(erule[1], erule[2])
end
end