Module:lfv-IPA: Difference between revisions

Jump to navigation Jump to search
Added affix accommodation
mNo edit summary
(Added affix accommodation)
Line 5: Line 5:


local data = {
local data = {
["a"] = "a",
["a"] = "a", ["e"] = "e", ["ê"] = "ɛ",
["e"] = "e",
["i"] = "i", ["o"] = "o", ["ô"] = "ɔ",
["ê"] = "ɛ",
["ø"] = "ø", ["u"] = "u", ["y"] = "y",
["i"] = "i",
["o"] = "o",
["ô"] = "ɔ",
["ø"] = "ø",
["u"] = "u",
["y"] = "y",
["b"] = "b",
["b"] = "b",
Line 149: Line 143:


local working_IPA = {}
local working_IPA = {}
local is_affix = false
-- base generation --  
-- base generation --  
Line 164: Line 159:
table.insert(working_IPA, data[mw.ustring.sub(word, 1, 1)])
table.insert(working_IPA, data[mw.ustring.sub(word, 1, 1)])
word = mw.ustring.sub(word, 2)
word = mw.ustring.sub(word, 2)
elseif data[mw.ustring.sub(word, 1, 1)] == "·" then
elseif mw.ustring.sub(word, 1, 1) == "-" then
if #working_IPA > 0 and #word > 1 then -- if not at the beginning and not at the end
table.insert(working_IPA, "ˌ")
else
table.insert(working_IPA, "-")
is_affix = true
end
word = mw.ustring.sub(word, 2)
elseif mw.ustring.sub(word, 1, 1) == "·" then
word = mw.ustring.sub(word, 2)
word = mw.ustring.sub(word, 2)
else
else
Line 318: Line 321:
-- stress --
-- stress --
if boundary[p_prev] or p_prev == nil then
if (boundary[p_prev] or p_prev == nil) and is_affix == false then
p_resolve("ˈ" .. p_current)
p_resolve("ˈ" .. p_current)
end
end

Navigation menu