Module:siwa-pron: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 5: Line 5:
local m_table = require("Module:table")
local m_table = require("Module:table")
local m_sm = mw.loadData('Module:siwa-pron/data')
local m_sm = mw.loadData('Module:siwa-pron/data')
local sub = mw.ustring.sub
local find = mw.ustring.find
local gmatch = mw.ustring.gmatch
local gsub = mw.ustring.gsub


local rules = {
local rules = {
[1] = {
{
["mm"] = "mː",
["mm"] = "mː",
["bb"] = "pː",
["bb"] = "pː",
Line 26: Line 31:
["ḥḥ"] = "ʔː",
["ḥḥ"] = "ʔː",
},
},
[2] = {
{
--consonants not affected by stress
--consonants not affected by stress
["ṡ"] = "ɕ",
["ṡ"] = "ɕ",
Line 37: Line 42:
["ġ"] = "x",
["ġ"] = "x",
},
},
[3] = {
{
--long vowels and o remain unchanged
--long vowels and o remain unchanged
["ẻu"] = "øː",
["ẻu"] = "øː",
Line 48: Line 53:
["ủ"] = "uː",
["ủ"] = "uː",
["ỷ"] = "yː",
["ỷ"] = "yː",
["ů"] = "ø",
},
}
{"^(" .. m_sm.initial .. ")", "%1ʰ"},
}
}


local consonant = "[" .. "mpbvntdsṡrklgġhįų" .. "]"
local consonant = "[" .. "mpbvntdsṡrklgġhįų" .. "]"
Line 63: Line 68:


function export.crux(term)
function export.crux(term)
--local IPA = {}
--IPA = table.concat(IPA)
for _, rule in ipairs(rules) do
for _, rule in ipairs(rules) do
for regex, replacement in pairs(rule) do
for regex, replacement in pairs(rule) do
term = mw.ustring.gsub(term, regex, replacement)
term = gsub(term, regex, replacement)
end
end
end
end