Module:rad-IPA: Difference between revisions

Jump to navigation Jump to search
Added voicing assimilation
(Added progressive voicing resolution)
(Added voicing assimilation)
Line 103: Line 103:
["þ"] = "θ",
["þ"] = "θ",
["·"] = "·",
["·"] = "·",
["-"] = "-",
[" "] = " ",
[" "] = " ",
["."] = "|",
["."] = "|",
Line 114: Line 115:


data[","] = data["."]
data[","] = data["."]
data[":"] = data["."]
data["ș"] = data["."]
data["!"] = data["."]
data["!"] = data["."]
data["?"] = data["."]
data["?"] = data["."]
Line 159: Line 162:
consonant[temp] = true
consonant[temp] = true
end
end
local obstruent = {
["b"] = true, ["ç"] = true, ["d"] = true, ["ð"] = true, ["dz"] = true,
["dʒ"] = true, ["f"] = true, ["ɡ"] = true, ["ɣ"] = true, ["h"] = true,
["k"] = true, ["p"] = true, ["s"] = true, ["ʃ"] = true,
["t"] = true, ["ts"] = true, ["tʃ"] = true, ["v"] = true,
["z"] = true, ["ʒ"] = true, ["θ"] = true,
}
local obstruent_voiced = {
["b"] = true, ["ç"] = false, ["d"] = true, ["ð"] = true, ["dz"] = true,
["dʒ"] = true, ["f"] = false, ["ɡ"] = true, ["ɣ"] = true, ["h"] = false,
["k"] = false, ["p"] = false, ["s"] = false, ["ʃ"] = false,
["t"] = false, ["ts"] = false, ["tʃ"] = false, ["v"] = true,
["z"] = true, ["ʒ"] = true, ["θ"] = false,
}
local obstruent_devoice = {
["b"] = "p", ["ç"] = "ç", ["d"] = "t", ["ð"] = "θ", ["dz"] = "ts",
["dʒ"] = "tʃ", ["f"] = "f", ["ɡ"] = "k", ["ɣ"] = "h", ["h"] = "h",
["k"] = "k", ["p"] = "p", ["s"] = "s", ["ʃ"] = "ʃ",
["t"] = "t", ["ts"] = "ts", ["tʃ"] = "tʃ", ["v"] = "f",
["z"] = "s", ["ʒ"] = "ʃ", ["θ"] = "θ",
}
local obstruent_voice = {
["b"] = "b", ["ç"] = "j", ["d"] = "d", ["ð"] = "ð", ["dz"] = "dz",
["dʒ"] = "dʒ", ["f"] = "v", ["ɡ"] = "ɡ", ["ɣ"] = "ɣ", ["h"] = "h",
["k"] = "ɡ", ["p"] = "b", ["s"] = "z", ["ʃ"] = "ʒ",
["t"] = "d", ["ts"] = "dz", ["tʃ"] = "dʒ", ["v"] = "v",
["z"] = "z", ["ʒ"] = "ʒ", ["θ"] = "ð",
}
local sibilant = {
local sibilant = {
Line 502: Line 537:
p_current = p_new
p_current = p_new
p_new = ""
p_new = ""
end
local function p_RemoveNext()
table.remove(working_phones, i + 1)
p_next = working_phones[i + 1]
p_next2 = working_phones[i + 2]
p_next3 = working_phones[i + 3]
end
end
Line 507: Line 549:
if iotate[p_current] and p_next == "j" then
if iotate[p_current] and p_next == "j" then
mw.log("[" .. p_current .. "j] found in position " .. i .. ".")
mw.log("[" .. p_current .. "][j] found in position " .. i .. ".")
p_Convert(iotate[p_current])
p_Convert(iotate[p_current])
table.remove(working_phones, i + 1)
p_RemoveNext()
mw.log("[j] removed from position " .. i + 1 .. ".")
mw.log("[j] removed from position " .. i + 1 .. ".")
elseif p_current == "ĵ" then
elseif p_current == "ĵ" then
Line 515: Line 557:
end
end
-- Resolution of -s, --
-- Resolution of Ss, Sș, ts, ds, tș, dș (progressive voicing assimilation) --
if p_next == "s" then
if p_next == "s" then
if sibilant[p_current] then
if sibilant[p_current] then
table.remove(working_phones, i + 1)
p_RemoveNext()
mw.log("[s] removed from position " .. i + 1 .. " following a sibilant.")
mw.log("[s] removed from position " .. i + 1 .. " following a sibilant.")
elseif p_current == "t" then
elseif p_current == "t" then
p_Convert("ts")
p_Convert("ts")
table.remove(working_phones, i + 1)
p_RemoveNext()
mw.log("[t][s] → [ts] in position " .. i .. ".")
mw.log("[t][s] → [ts] in position " .. i .. ".")
elseif p_current == "d" then
elseif p_current == "d" then
p_Convert("dz")
p_Convert("dz")
table.remove(working_phones, i + 1)
p_RemoveNext()
mw.log("[d][s] → [dz] in position " .. i .. ".")
mw.log("[d][s] → [dz] in position " .. i .. ".")
end
end
elseif p_next == "ʃ" then
elseif p_next == "ʃ" then
if sibilant_post[p_current] == true then
if sibilant_post[p_current] == true then
table.remove(working_phones, i + 1)
p_RemoveNext()
mw.log("[ʃ] removed from position " .. i + 1 .. " following a postalveolar sibilant.")
mw.log("[ʃ] removed from position " .. i + 1 .. " following a postalveolar sibilant.")
elseif sibilant_alv[p_current] then
elseif sibilant_alv[p_current] then
mw.log("[" .. p_current .. "][ʃ] → [" .. sibilant_alv_to_post[p_current] .. "] in position " .. i .. ".")
mw.log("[" .. p_current .. "][ʃ] → [" .. sibilant_alv_to_post[p_current] .. "] in position " .. i .. ".")
p_Convert(sibilant_alv_to_post[p_current])
p_Convert(sibilant_alv_to_post[p_current])
table.remove(working_phones, i + 1)
p_RemoveNext()
elseif p_current == "t" then
elseif p_current == "t" then
p_Convert("tʃ")
p_Convert("tʃ")
table.remove(working_phones, i + 1)
p_RemoveNext()
mw.log("[t][ʃ] → [tʃ] in position " .. i .. ".")
mw.log("[t][ʃ] → [tʃ] in position " .. i .. ".")
elseif p_current == "d" then
elseif p_current == "d" then
p_Convert("dʒ")
p_Convert("dʒ")
table.remove(working_phones, i + 1)
p_RemoveNext()
mw.log("[d][ʃ] → [dʒ] in position " .. i .. ".")
mw.log("[d][ʃ] → [dʒ] in position " .. i .. ".")
end
end
end
end
-- Resolution of t --
if obstruent[p_current] == true then
mw.log("Obstruent [" .. p_current .. "] found in position " .. i .. ". Searching for cluster.")
local final_i = i
-- find voicing of final obstruent in cluster --
for j = i + 1, #working_phones do
local check_phone = working_phones[j]
if obstruent[check_phone] == true then
final_i = j
else break
end
end
if final_i > i then -- if cluster recognised --
final_obs = working_phones[final_i]
mw.log("Final obstruent in cluster is [" .. final_obs .. "], cluster length " .. final_i - i + 1 .. ".")
-- assimilate --
if not obstruent_voiced[p_current] == obstruent_voiced[final_obs] then
mw.log("Voicing mismatch found in cluster at position " .. i .. ".")
if obstruent_voiced[final_obs] == true then
p_Convert(obstruent_voice[p_current])
else
p_Convert(obstruent_devoice[p_current])
end
else
mw.log("No voicing mismatch found.")
end
else
mw.log("No cluster found.")
end
end
-- Resolution of voicing --
-- Resolution of geminates --
-- Resolution of ts, tș, ts|s --
end
end
Line 573: Line 646:
local args = getArgs(frame)
local args = getArgs(frame)
local outputIPA = generate_IPA(args[1])
local outputIPA = generate_IPA(args[1])
local hj = args[2] or false
if hj == "false" then
hj = false
end
outputIPA = resolve_vowels(outputIPA)
outputIPA = resolve_vowels(outputIPA)
outputIPA = resolve_consonants(outputIPA)
outputIPA = resolve_consonants(outputIPA)

Navigation menu