Module:rad-IPA: Difference between revisions

Jump to navigation Jump to search
Added nasalisation to phonetic realisation
(Added rhyme)
(Added nasalisation to phonetic realisation)
Line 171: Line 171:
consonant[temp] = true
consonant[temp] = true
end
end
local velar = {
["k"] = true, ["ɡ"] = true, ["ɣ"] = true, ["ŋ"] = true,
-- allophones --
["x"] = true,
}
local obstruent = {
local obstruent = {
Line 185: Line 193:


local obstruent_voiced = {
local obstruent_voiced = {
["b"] = true, ["ç"] = false, ["d"] = true, ["ð"] = true, ["dz"] = true,
["b"] = true, ["d"] = true, ["ð"] = true, ["dz"] = true,
["dʒ"] = true, ["f"] = false, ["ɡ"] = true, ["ɣ"] = true, ["h"] = false,
["dʒ"] = true, ["ɡ"] = true, ["ɣ"] = true,  
["k"] = false, ["p"] = false, ["s"] = false, ["ʃ"] = false,
["v"] = true,
["t"] = false, ["ts"] = false, ["tʃ"] = false, ["v"] = true,
["z"] = true, ["ʒ"] = true,  
["z"] = true, ["ʒ"] = true, ["θ"] = false,  
}
}
Line 336: Line 343:
}
}
local CN = continuant
local CN = continuant
local fricative = {  -- excludes [h]
["ç"] = true, ["ð"] = true,
["f"] = true, ["ɣ"] = true,
["l"] = true, ["r"] = true, ["s"] = true, ["ʃ"] = true,
["v"] = true,
["z"] = true, ["ʒ"] = true, ["θ"] = true,
-- allophones --
["x"] = true,
}


-- VOWEL GROUPS --
-- VOWEL GROUPS --
Line 362: Line 381:
local long = {
local long = {
["a"] = false, ["aː"] = true, ["aːː"] = true, ["æː"] = true, ["ai"] = true, ["au"] = true,
["aː"] = true, ["aːː"] = true, ["æː"] = true, ["ai"] = true, ["au"] = true,
["eː"] = true, ["ei"] = true, ["ɛ"] = false, ["ɤ"] = false, ["ɤi"] = true, ["i"] = false,
["eː"] = true, ["ei"] = true, ["ɤi"] = true,  
["iː"] = true, ["iːː"] = true, ["iːe"] = true, ["ia"] = true, ["ie"] = true, ["oː"] = true,
["iː"] = true, ["iːː"] = true, ["iːe"] = true, ["ia"] = true, ["ie"] = true, ["oː"] = true,
["œ"] = false, ["œa"] = true, ["øi"] = true, ["ɔ"] = false, ["ɔː"] = true, ["ɔa"] = true,
["œa"] = true, ["øi"] = true, ["ɔː"] = true, ["ɔa"] = true,
["ɔi"] = true, ["u"] = false, ["uː"] = true, ["uːː"] = true, ["uːo"] = true, ["ua"] = true,
["ɔi"] = true, ["uː"] = true, ["uːː"] = true, ["uːo"] = true, ["ua"] = true,
["uo"] = true, ["y"] = false,
["uo"] = true,  
}
}


local weak = {
local weak = {
["a"] = false, ["aː"] = false, ["aːː"] = false, ["æː"] = false, ["ai"] = false, ["au"] = false,
["ɤ"] = true, ["i"] = true,
["eː"] = false, ["ei"] = false, ["ɛ"] = false, ["ɤ"] = true, ["ɤi"] = false, ["i"] = true,
}
["iː"] = false, ["iːː"] = false, ["iːe"] = false, ["ia"] = false, ["ie"] = false, ["oː"] = false,
 
["œ"] = false, ["œa"] = false, ["øi"] = false, ["ɔ"] = false, ["ɔː"] = false, ["ɔa"] = false,
-- allophonic only --
["ɔi"] = false, ["u"] = false, ["uː"] = false, ["uːː"] = false, ["uːo"] = false, ["ua"] = false,
local nasalise = {
["uo"] = false, ["y"] = false,
["a"] = "ãˑ", ["aː"] = "ãːˑ", ["aːː"] = "ãːːˑ", ["æː"] = "æ̃ːˑ", ["ai"] = "ãˑĩ", ["au"] = "ãˑũ",
["eː"] = "ẽːˑ", ["ei"] = "ẽˑĩ", ["ɛ"] = "ɛ̃ˑ", ["ɤ"] = "ɤ̃ˑ", ["ɤi"] = "ɤ̃ˑĩ", ["i"] = "ĩˑ",
["iː"] = "ĩːˑ", ["iːː"] = "ĩːːˑ", ["iːe"] = "ĩːˑẽ", ["ia"] = "ĩˑã", ["ie"] = "ĩˑẽ", ["oː"] = "õːˑ",
["œ"] = "œ̃ˑ", ["œa"] = "œ̃ˑã", ["øi"] = "ø̃ˑĩ", ["ɔ"] = "ɔ̃ˑ", ["ɔː"] = "ɔ̃ːˑ", ["ɔa"] = "ɔ̃ˑã",
["ɔi"] = "ɔ̃ˑĩ", ["u"] = "ũˑ", ["uː"] = "ũːˑ", ["uːː"] = "ũːːˑ", ["uːo"] = "ũːˑõ", ["ua"] = "ũˑã",
["uo"] = "ũˑõ", ["y"] = "ỹˑ",
}
}
Line 792: Line 816:
-- PHONETIC RESOLUTION --
-- PHONETIC RESOLUTION --
if phon == true then
if phon == true then
if p_current == "h" and not vowel[p_next] then
if p_current == "h" and not vowel[p_next] then -- hC
mw.log("phon = true:")
mw.log("phon = true:")
p_Resolve("x")
p_Convert("x")
elseif p_current == "h" and p_next == "j" then
elseif p_current == "h" and p_next == "j" then
mw.log("phon = true:")
mw.log("phon = true:")
p_Resolve("ç")
p_Convert("ç")
p_RemoveNext()
p_RemoveNext()
end
end
end
-- Resolution of NK --
if p_current == "n" and velar[p_next] then
mw.log("n + velar cluster found.")
p_Resolve("ŋ")
end
end
Line 1,307: Line 1,339:
end
end


function syllables_to_string(syllables)
function syllables_to_string(syllables, phon)


local output = ""
local output = ""
Line 1,320: Line 1,352:
-- add hiatus marker --
-- add hiatus marker --
if syllables[i+1] then
if syllables[i+1] then
if syllables[i]["coda"] == nil and marked_hiatus[syllables[i]["nucleus"]] and syllables[i+1]["onset"] == nil then
if syllables[i]["coda"] == nil and marked_hiatus[syllables[i]["nucleus"]] and syllables[i+1]["onset"] == nil and type(syllables[i+1]) == "table" then
syllables[i]["coda"] = {"."}
syllables[i]["coda"] = {"."}
mw.log("Hiatus marked between syllables " .. i .. " and " .. i+1 .. ".")
mw.log("Hiatus marked between syllables " .. i .. " and " .. i+1 .. ".")
end
end
-- phonetic nasalisation --
if phon then
local function get_nasal(check)
if check then
mw.log("Phonetic nasalisation in syllable " .. i .. ": " .. syllables[i]["nucleus"] .. " → " .. nasalise[syllables[i]["nucleus"]])
syllables[i]["nucleus"] = nasalise[syllables[i]["nucleus"]]
table.remove(syllables[i]["coda"], 1)
end
end
if syllables[i]["coda"][1] == "n" then
if fricative[syllables[i]["coda"][2]] then
get_nasal(true)
elseif syllables[i]["coda"][2] == nil and fricative[syllables[i+1]["onset"][1]] then
get_nasal(true)
end
elseif syllables[i]["coda"][1] == "ŋ" then
if syllables[i]["coda"][2] == "h" or syllables[i]["coda"][2] == "x" or syllables[i]["coda"][2] == "ɣ" then
get_nasal(true)
elseif syllables[i]["coda"][2] == nil and (syllables[i+1]["onset"][1] == "h" or syllables[i+1]["onset"][1] == "x" or syllables[i+1]["onset"][1] == "ɣ") then
get_nasal(true)
end
end
end
end
end
Line 1,397: Line 1,459:
outputIPA = get_stress(outputIPA)
outputIPA = get_stress(outputIPA)
outputIPA = resolve_syllables(outputIPA)
outputIPA = resolve_syllables(outputIPA)
outputIPA = syllables_to_string(outputIPA)
outputIPA = syllables_to_string(outputIPA, parameters["phon"])
if parameters["rhyme"] then
if parameters["rhyme"] then

Navigation menu