Module:siwa-pron: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 45: Line 45:
local function open_to_closed(v, w)
local function open_to_closed(v, w)
local otc = {}
local otc = {}
local switch = {["ɑ"] = "a", ["e"] = "ɛ", ["i"] = "ɪ", ["ɔ"] = "ɔ", ["u"] = "ʊ", ["y"] = "œ",
local switch = {["ɑ"] = "a", ["e"] = "ɛ", ["i"] = "ɪ", ["ɔ"] = "ɔ", ["u"] = "ʊ", ["y"] = "œ", ["ø"] = "œ"}
["ø"] = w~=nil and "ɤ" or "œ"}
 
for vc in gmatch(v, ".") do
vc = gsub(vc, vc, switch[vc])
table.insert(otc, vc)
end
return table.concat(otc)
end
 
local function wopen_to_closed(v, w)
local otc = {}
local switch = {["ɑ"] = "a", ["e"] = "ɛ", ["i"] = "ɪ", ["ɔ"] = "ɔ", ["u"] = "ʊ", ["y"] = ", ["ø"] = "ɤ"}


for vc in gmatch(v, ".") do
for vc in gmatch(v, ".") do
Line 132: Line 142:
{"ɣ([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, "w") .. s2 end, {"w"}},
{"(" .. vowel .. "*)(" .. consonant .. consonant .. ")", function(s1, s2) return wopen_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, "w") .. s2 end, {"w"}},
{"(" .. vowel .. "*)(" .. consonant .. ")$", function(s1, s2) return wopen_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"},
Line 148: Line 158:


function export.crux(term, e, w)
function export.crux(term, e, w)
if type(term) == "table" then
pos = term.args["pos"]
term = term[1]
end
term=mw.ustring.lower(term)
term=mw.ustring.lower(term)
term=export.morphemes(term)
term=export.morphemes(term)