Module:siwa-pron: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 11: Line 11:
local u = mw.ustring.char
local u = mw.ustring.char
local split = mw.text.split
local split = mw.text.split
local function rsub(term, foo, bar, n)
local retval = mw.ustring.gsub(term, foo, bar, n)
return retval
end


local export = {}
local export = {}
Line 46: Line 41:
local otc = {}
local otc = {}
local switch = {["ɑ"] = "a", ["e"] = "ɛ", ["i"] = "ɪ", ["ɔ"] = "ɔ", ["u"] = "ʊ", ["y"] = "œ",
local switch = {["ɑ"] = "a", ["e"] = "ɛ", ["i"] = "ɪ", ["ɔ"] = "ɔ", ["u"] = "ʊ", ["y"] = "œ",
["ø"] = (w and "ɤ") or "œ"}
["ø"] = "ü",} -- dialectal variation, will be changed later


for vc in gmatch(v, ".") do
for vc in gmatch(v, ".") do
Line 128: Line 123:
{"lʦ(x?)v", "ɬʦ%1w"}, {"lʦx", "ɬʦx"},
{"lʦ(x?)v", "ɬʦ%1w"}, {"lʦx", "ɬʦx"},
{"(ł[mnꬶ])", "%1ː"},
{"(ł[mnꬶ])", "%1ː"},
{"(ꬶ[msɕ])", "%1ː"}, {"ꬶl", "ʔł", {"w"}}, {"ꬶl", "klː"},
{"(ꬶ[msɕ])", "%1ː"}, {"ꬶsꬶ", "kskː"}, {"ꬶsl", "ksł"},
{"ꬶsꬶ", "kskː"}, {"ꬶsl", "ksł"},
{"ɣ([mn])", "ŋ%1ː"}, {"ɣ([vsl])", "k%1"},
{"ɣ([mn])", "ŋ%1ː"}, {"ɣ([vsl])", "k%1"},
-- closed vowels
-- closed vowels
{"(" .. vowel .. "*)(" .. consonant .. consonant .. ")", function(s1, s2) return open_to_closed(s1) .. s2 end, "w"},
{"(" .. vowel .. "*)(" .. consonant .. consonant .. ")", function(s1, s2) return open_to_closed(s1) .. s2 end},
{"(" .. vowel .. "*)(" .. consonant .. consonant .. ")", function(s1, s2) return open_to_closed(s1) .. s2 end},
{"(" .. vowel .. "*)(" .. consonant .. ")$", function(s1, s2) return open_to_closed(s1) .. s2 end, {"w"}},
{"(" .. vowel .. "*)(" .. consonant .. ")$", function(s1, s2) return open_to_closed(s1) .. s2 end},
{"(" .. vowel .. "*)(" .. consonant .. ")$", function(s1, s2) return open_to_closed(s1) .. s2 end},
{"ɑ$", "a"},
{"ɑ$", "a"},
{"(" .. vowel .. ")đ$", "%1ʔ%1"}, -- -Vt becomes -VʔV (or -Vht, not considered)
{"(" .. vowel .. ")đ$", "%1ʔ%1"}, -- -Vt becomes -VʔV (or -Vht, not considered)
}


local final_rules = {
--undo ligatures
--undo ligatures
{"ʨ", "t͡ɕ"}, {"ʥ", "d͡ʑ"}, {"ł", "tɬ"}, {"ʣ", "d͡z"}, {"ʦ", "t͡s"},
{"ʨ", "t͡ɕ"}, {"ʥ", "d͡ʑ"}, {"ł", "tɬ"}, {"ʣ", "d͡z"}, {"ʦ", "t͡s"},
Line 157: Line 151:
for _, rule in ipairs(rules) do
for _, rule in ipairs(rules) do
local fordialect = rule[3]
term = gsub(term, rule[1], rule[2])
if (not fordialect) or (w and fordialect == "w") then
end
term = gsub(term, rule[1], rule[2])
end
if w then
term = gsub(term, "ü", "ɤ")
term = gsub(term, "ꬶl", "ʔł")
else
term = gsub(term, "ü", "œ")
term = gsub(term, "ꬶl", "klː")
end
for _, final_rule in ipairs(final_rules) do
term = gsub(term, final_rule[1], final_rule[2])
end
end