Module:rad-IPA: Difference between revisions

Jump to navigation Jump to search
m
ਕੋਈ ਸੋਧ ਸਾਰ ਨਹੀਂ
mNo edit summary
mNo edit summary
Line 155: Line 155:
}
}
local valid_phone_temp = {"iːj", "uːj", "yːj", "ù", "ū", "ĵ"}
local valid_phone_temp = {"iːj", "uːj", "yːj", "ù", "ū", "ĵ"}
for _, temp in ipairs(valid_phone_temp) do
valid_phone[temp] = true
end
-- CONSONANT GROUPS --
-- CONSONANT GROUPS --
Line 174: Line 171:
}
}
local consonant_temp = {"ĵ"}
local consonant_temp = {"ĵ"}
for _, temp in ipairs(consonant_temp) do
consonant[temp] = true
end
local velar = {
local velar = {
Line 272: Line 266:
}
}
local glide_temp = {"ĵ"}
local glide_temp = {"ĵ"}
for _, temp in ipairs(glide_temp) do
glide[temp] = true
end
local iotate = {
local iotate = {
Line 375: Line 366:
}
}
local vowel_temp = {"iːj", "uːj", "yːj", "ù", "ū"}
local vowel_temp = {"iːj", "uːj", "yːj", "ù", "ū"}
for _, temp in ipairs(vowel_temp) do
vowel[temp] = true
end
local marked_hiatus = {
local marked_hiatus = {
Line 418: Line 406:
[" "] = true, ["|"] = true, ["·"] = true, ["‿"] = true,
[" "] = true, ["|"] = true, ["·"] = true, ["‿"] = true,
}
}
function process_temp()
for _, temp in ipairs(valid_phone_temp) do
valid_phone[temp] = true
end
for _, temp in ipairs(vowel_temp) do
vowel[temp] = true
end
for _, temp in ipairs(consonant_temp) do
consonant[temp] = true
end
for _, temp in ipairs(glide_temp) do
glide[temp] = true
end
end


-- PROCESS FUNCTIONS --
-- PROCESS FUNCTIONS --
Line 431: Line 434:
if mw.ustring.find(s, toReplace) then
if mw.ustring.find(s, toReplace) then
s = mw.ustring.gsub(s, "(" .. toReplace .. ")", ReplaceKey)
s = mw.ustring.gsub(s, "(" .. toReplace .. ")", ReplaceKey)
-- mw.log("Irregular spelling <" .. toReplace .. "> recognised. Treating as <" .. ReplaceKey .. ">.")
mw.log("Irregular spelling <" .. toReplace .. "> recognised. Treating as <" .. ReplaceKey .. ">.")
end
end
end
end
Line 554: Line 557:
function resolve_vowels(phones)
function resolve_vowels(phones)
local working_phones = phones
local working_phones = phones
-- mw.log("————— BEGINNING VOWEL RESOLUTION —————")
mw.log("————— BEGINNING VOWEL RESOLUTION —————")


local i = 0
local i = 0
Line 569: Line 572:
local function p_Resolve(p_new)
local function p_Resolve(p_new)
working_phones[i] = p_new
working_phones[i] = p_new
-- mw.log("[" .. p_current .. "] resolved to [" .. p_new .. "] in position ".. i .. ".")
mw.log("[" .. p_current .. "] resolved to [" .. p_new .. "] in position ".. i .. ".")
p_new = ""
p_new = ""
end
end
Line 575: Line 578:
local function p_Convert(p_new)
local function p_Convert(p_new)
working_phones[i] = p_new
working_phones[i] = p_new
-- mw.log("[" .. p_current .. "] converted to [" .. p_new .. "] in position ".. i .. ".")
mw.log("[" .. p_current .. "] converted to [" .. p_new .. "] in position ".. i .. ".")
p_current = p_new
p_current = p_new
p_new = ""
p_new = ""
Line 582: Line 585:
-- Resolution of [aù] --
-- Resolution of [aù] --
if p_prev == "a" and p_current == "ù" then
if p_prev == "a" and p_current == "ù" then
-- mw.log("<aù> recognised in position " .. i .. ". Converting to resolvable [u].")
mw.log("<aù> recognised in position " .. i .. ". Converting to resolvable [u].")
p_Convert("u")
p_Convert("u")
p_current = "u"
p_current = "u"
Line 590: Line 593:
-- Resolution of [u], [ù] and [ū] --
-- Resolution of [u], [ù] and [ū] --
if p_current == "u" then
if p_current == "u" then
-- mw.log("[u] found in position " .. i .. ". Testing for resolution.")
mw.log("[u] found in position " .. i .. ". Testing for resolution.")
if consonant[p_next] then
if consonant[p_next] then
if glide[p_next2] then
if glide[p_next2] then
if not vowel[p_next3] then
if not vowel[p_next3] then
-- mw.log("ɤCj!V environment identified.")
mw.log("ɤCj!V environment identified.")
p_Resolve("ɤ")
p_Resolve("ɤ")
else
else
-- mw.log("No resolution needed.")
mw.log("No resolution needed.")
end
end
elseif not vowel[p_next2] and not glide[p_next2] then
elseif not vowel[p_next2] then
-- mw.log("ɤC!V environment identified.")
mw.log("ɤC!V environment identified.")
p_Resolve("ɤ")
p_Resolve("ɤ")
else
else
-- mw.log("No resolution needed.")
mw.log("No resolution needed.")
end
end
else
else
-- mw.log("No resolution needed.")
mw.log("No resolution needed.")
end
end
elseif p_current == "ù" or p_current == "ū" then
elseif p_current == "ù" or p_current == "ū" then
-- mw.log("Fixed [u] found in position " .. i .. ".")
mw.log("Fixed [u] found in position " .. i .. ".")
working_phones[i] = "u"
p_Resolve("u")
end
end
Line 618: Line 621:
local check_phone = working_phones[i - j]
local check_phone = working_phones[i - j]
if boundary[check_phone] or check_phone == nil then
if boundary[check_phone] or check_phone == nil then
-- mw.log("Initial [ei] found in position" .. i .. ".")
mw.log("Initial [ei] found in position" .. i .. ".")
p_Resolve("ai")
p_Resolve("ai")
break
break
Line 632: Line 635:
if p_current == "iej" or p_current == "yej" or p_current == "uoj" then
if p_current == "iej" or p_current == "yej" or p_current == "uoj" then
-- mw.log("Pre-vocalic <" .. p_current .. "> found in position " .. i .. ".")
mw.log("Pre-vocalic <" .. p_current .. "> found in position " .. i .. ".")
if p_current == "uoj" then
if p_current == "uoj" then
p_Resolve("uo")
p_Resolve("uo")
table.insert(working_phones, i + 1, "j")
table.insert(working_phones, i + 1, "j")
-- mw.log("[j] inserted to position " .. i + 1 .. ".")
mw.log("[j] inserted to position " .. i + 1 .. ".")
else
else
p_Resolve("iː")
p_Resolve("iː")
Line 677: Line 680:
end
end
-- mw.log("Vowel resolution result: [" .. table.concat(working_phones,"][") .. "]")
mw.log("Vowel resolution result: [" .. table.concat(working_phones,"][") .. "]")
return working_phones
return working_phones
Line 684: Line 687:
function resolve_consonants(phones, hj_dv, phon)
function resolve_consonants(phones, hj_dv, phon)
local working_phones = phones
local working_phones = phones
-- mw.log("————— BEGINNING CONSONANT RESOLUTION —————")
mw.log("————— BEGINNING CONSONANT RESOLUTION —————")


local i = 0
local i = 0
Line 699: Line 702:
local function p_Resolve(p_new)
local function p_Resolve(p_new)
working_phones[i] = p_new
working_phones[i] = p_new
-- mw.log("[" .. p_current .. "] resolved to [" .. p_new .. "] in position ".. i .. ".")
mw.log("[" .. p_current .. "] resolved to [" .. p_new .. "] in position ".. i .. ".")
p_new = ""
p_new = ""
end
end
Line 705: Line 708:
local function p_Convert(p_new)
local function p_Convert(p_new)
working_phones[i] = p_new
working_phones[i] = p_new
-- mw.log("[" .. p_current .. "] converted to [" .. p_new .. "] in position ".. i .. ".")
mw.log("[" .. p_current .. "] converted to [" .. p_new .. "] in position ".. i .. ".")
p_current = p_new
p_current = p_new
p_new = ""
p_new = ""
Line 720: Line 723:
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])
p_RemoveNext()
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
p_Convert("j")
p_Convert("j")
Line 732: Line 735:
if not hj_dv then
if not hj_dv then
if p_current == "ç" then
if p_current == "ç" then
-- mw.log("hj = false:")
mw.log("hj = false:")
p_Convert("ʃ")
p_Convert("ʃ")
elseif p_current == "j" and (boundary[p_prev] or p_prev == nil) and consonant[p_next] then
elseif p_current == "j" and (boundary[p_prev] or p_prev == nil) and consonant[p_next] then
-- mw.log("hj = false:")
mw.log("hj = false:")
p_Convert("ʒ")
p_Convert("ʒ")
end
end
Line 745: Line 748:
if sibilant[p_current] then
if sibilant[p_current] then
p_RemoveNext()
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")
p_RemoveNext()
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")
p_RemoveNext()
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
p_RemoveNext()
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])
p_RemoveNext()
p_RemoveNext()
Line 766: Line 769:
p_Convert("tʃ")
p_Convert("tʃ")
p_RemoveNext()
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ʒ")
p_RemoveNext()
p_RemoveNext()
-- mw.log("[d][ʃ] → [dʒ] in position " .. i .. ".")
mw.log("[d][ʃ] → [dʒ] in position " .. i .. ".")
end
end
Line 778: Line 781:
if p_next == "v" and ((Cv_split[p_current] and not vowel[p_prev]) or Cv_fixed[p_current]) then
if p_next == "v" and ((Cv_split[p_current] and not vowel[p_prev]) or Cv_fixed[p_current]) then
-- mw.log("Cluster [" .. p_current .. "][v] resolved to [" .. p_current .. "] at position " .. i .. ".")
mw.log("Cluster [" .. p_current .. "][v] resolved to [" .. p_current .. "] at position " .. i .. ".")
p_RemoveNext()
p_RemoveNext()
end
end
Line 785: Line 788:
if obstruent[p_current] then
if obstruent[p_current] then
-- mw.log("Obstruent [" .. p_current .. "] found in position " .. i .. ". Searching for cluster.")
mw.log("Obstruent [" .. p_current .. "] found in position " .. i .. ". Searching for cluster.")
local final_i = i
local final_i = i
Line 800: Line 803:
if final_i ~= i then -- if cluster recognised --
if final_i ~= i then -- if cluster recognised --
final_obs = working_phones[final_i]
final_obs = working_phones[final_i]
-- mw.log("Final obstruent in cluster is [" .. final_obs .. "], cluster length " .. final_i - i + 1 .. ".")
mw.log("Final obstruent in cluster is [" .. final_obs .. "], cluster length " .. final_i - i + 1 .. ".")
-- assimilate --
-- assimilate --
if obstruent_voiced[p_current] ~= obstruent_voiced[final_obs] then
if obstruent_voiced[p_current] ~= obstruent_voiced[final_obs] then
-- mw.log("Voicing mismatch found in cluster at position " .. i .. ".")
mw.log("Voicing mismatch found in cluster at position " .. i .. ".")
if obstruent_voiced[final_obs] == true then
if obstruent_voiced[final_obs] == true then
p_Convert(obstruent_voice[p_current])
p_Convert(obstruent_voice[p_current])
Line 812: Line 815:
end
end
else
else
-- mw.log("No voicing mismatch found.")
mw.log("No voicing mismatch found.")
end
end
else
else
-- mw.log("No cluster found.")
mw.log("No cluster found.")
end
end
end
end
Line 822: Line 825:
if (p_current == "v") and (p_prev == "t" or p_prev == "k") then
if (p_current == "v") and (p_prev == "t" or p_prev == "k") then
p_Convert("f")
p_Convert("f")
-- mw.log("[" .. p_prev .. "][v] → [" .. p_prev .. "][f] in position " .. i .. ".")
mw.log("[" .. p_prev .. "][v] → [" .. p_prev .. "][f] in position " .. i .. ".")
end
end
Line 829: Line 832:
if p_next == p_current and (boundary[p_next2] or p_next2 == nil) and consonant[p_current] then
if p_next == p_current and (boundary[p_next2] or p_next2 == nil) and consonant[p_current] then
p_RemoveNext()
p_RemoveNext()
-- mw.log("Geminate [" .. p_current .. "] removed in final position at position " .. i .. ".")
mw.log("Geminate [" .. p_current .. "] removed in final position at position " .. i .. ".")
end
end
Line 836: Line 839:
if p_current == "'" then
if p_current == "'" then
table.remove(working_phones, i)
table.remove(working_phones, i)
-- mw.log("Apostrophe removed from position ".. i .. ".")
mw.log("Apostrophe removed from position ".. i .. ".")
p_current = working_phones[i]
p_current = working_phones[i]
end
end
-- PHONETIC RESOLUTION --
-- PHONETIC RESOLUTION --
if phon == true then
if phon then
-- Cv --
-- Cv --
Line 847: Line 850:
if p_current == "v" and obstruent[p_prev] and p_prev ~= "d" and p_prev ~= "g" then
if p_current == "v" and obstruent[p_prev] and p_prev ~= "d" and p_prev ~= "g" then
p_Resolve("ʋ")
p_Resolve("ʋ")
-- mw.log("[" .. p_prev .. "][ʋ] → [" .. p_prev .. "][ʋ] in position " .. i .. ".")
mw.log("[" .. p_prev .. "][ʋ] → [" .. p_prev .. "][ʋ] in position " .. i .. ".")
end
end
if p_current == "h" and not vowel[p_next] then -- hC
if p_current == "h" and not vowel[p_next] then -- hC
-- mw.log("phon = true:")
mw.log("phon = true:")
p_Convert("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_Convert("ç")
p_Convert("ç")
p_RemoveNext()
p_RemoveNext()
Line 860: Line 863:
if p_current == "n" and p_next == "j" then
if p_current == "n" and p_next == "j" then
-- mw.log("phon = true:")
mw.log("phon = true:")
p_Convert("ɲ")
p_Convert("ɲ")
p_RemoveNext()
p_RemoveNext()
Line 874: Line 877:
if p_current == "n" and velar[p_next] then
if p_current == "n" and velar[p_next] then
-- mw.log("n + velar cluster found.")
mw.log("n + velar cluster found.")
p_Resolve("ŋ")
p_Resolve("ŋ")
end
end
Line 898: Line 901:
end
end
-- mw.log("Consonant resolution result: [" .. table.concat(working_phones,"][") .. "]")
mw.log("Consonant resolution result: [" .. table.concat(working_phones,"][") .. "]")
return working_phones
return working_phones
Line 924: Line 927:
end
end
-- mw.log( onset .. " [ " .. working_syllable["nucleus"] .. " ] " .. coda )
mw.log( onset .. " [ " .. working_syllable["nucleus"] .. " ] " .. coda )
end
end
-- mw.log("————— BUILDING SYLLABLES —————")
mw.log("————— BUILDING SYLLABLES —————")
-- division into syllables --
-- division into syllables --
Line 945: Line 948:
syllables[syllable_no]["coda"] = nil
syllables[syllable_no]["coda"] = nil
end
end
-- mw.log("Syllable " .. syllable_no .. " registered:")
mw.log("Syllable " .. syllable_no .. " registered:")
logSyllable()
logSyllable()
-- mw.log("====================")
mw.log("====================")
syllable_no = syllable_no + 1
syllable_no = syllable_no + 1
working_syllable = {
working_syllable = {
Line 962: Line 965:
syllables[syllable_no] = p_current
syllables[syllable_no] = p_current
table.remove(working_phones, 1)
table.remove(working_phones, 1)
-- mw.log("Boundary syllable " .. syllable_no .. " registered: '" .. p_current .. "'\n====================")
mw.log("Boundary syllable " .. syllable_no .. " registered: '" .. p_current .. "'\n====================")
syllable_no = syllable_no + 1
syllable_no = syllable_no + 1
end
end
Line 971: Line 974:
if vowel[p_current] then
if vowel[p_current] then
working_syllable["nucleus"] = p_current
working_syllable["nucleus"] = p_current
-- mw.log("[" .. p_current .. "] is now the working nucleus.")
mw.log("[" .. p_current .. "] is now the working nucleus.")
elseif consonant[p_current] then
elseif consonant[p_current] then
local unit = ""
local unit = ""
Line 980: Line 983:
end
end
table.insert(working_syllable[unit], p_current)
table.insert(working_syllable[unit], p_current)
-- mw.log("[" .. p_current .. "] appended to the working " .. unit .. ".")
mw.log("[" .. p_current .. "] appended to the working " .. unit .. ".")
else
else
error("Invalid input for function register_phone")
error("Invalid input for function register_phone")
end
end
table.remove(working_phones, 1)
table.remove(working_phones, 1)
-- -- mw.log("Current working syllable:")
-- mw.log("Current working syllable:")
-- logSyllable()
-- logSyllable()
Line 1,043: Line 1,046:
end
end


-- mw.log("STRING EXHAUSTED\n====================")
mw.log("STRING EXHAUSTED\n====================")
return syllables
return syllables
Line 1,050: Line 1,053:
function tag_syllables(syllables)
function tag_syllables(syllables)


-- mw.log("————— TAGGING SYLLABLES —————")
mw.log("————— TAGGING SYLLABLES —————")
local syl_count = #syllables
local syl_count = #syllables
Line 1,060: Line 1,063:
local function tag_syllable(tag, value)
local function tag_syllable(tag, value)
syllables[i][tag] = value
syllables[i][tag] = value
-- mw.log("syllables[" .. i .. "][" .. tag .. "] = " .. tostring(value) )
mw.log("syllables[" .. i .. "][" .. tag .. "] = " .. tostring(value) )
end
end
Line 1,098: Line 1,101:
end
end


-- mw.log("—————")
mw.log("—————")
end
end
Line 1,149: Line 1,152:
local test_n = #syllables
local test_n = #syllables
-- mw.log("————— BEGINNING STRESS ASSIGNMENT —————")
mw.log("————— BEGINNING STRESS ASSIGNMENT —————")
while #syllables > 0 do
while #syllables > 0 do
Line 1,160: Line 1,163:
table.insert(working_word, syllables[1])
table.insert(working_word, syllables[1])
table.remove(syllables, 1)
table.remove(syllables, 1)
-- mw.log("Syllable " .. i .. " registered to working word.")
mw.log("Syllable " .. i .. " registered to working word.")
if syllables[1] == nil or type(syllables[1]) == "string" then -- check next syllable is a boundary (now 1 after deletion of registered syllable)
if syllables[1] == nil or type(syllables[1]) == "string" then -- check next syllable is a boundary (now 1 after deletion of registered syllable)
-- mw.log("Boundary found: continuing to stress assignment.")
mw.log("Boundary found: continuing to stress assignment.")
break
break
end -- if next syllable is a boundary, register and continue to stress assignment
end -- if next syllable is a boundary, register and continue to stress assignment
Line 1,173: Line 1,176:
if (syllables[1] == "-" or output[#output] == "·") and syllables[1] ~= "·" and output[#output] ~= "-" then -- check if following · or preceding - ; if so, assign stress regardless of monosyllabicness
if (syllables[1] == "-" or output[#output] == "·") and syllables[1] ~= "·" and output[#output] ~= "-" then -- check if following · or preceding - ; if so, assign stress regardless of monosyllabicness
working_word[syl]["stress"] = true
working_word[syl]["stress"] = true
-- mw.log("Primary stress assigned to syllable " .. syl .. ".")
mw.log("Primary stress assigned to syllable " .. syl .. ".")
elseif #working_word > 1 then -- if monosyllabic, do not add a redundant stress mark
elseif #working_word > 1 then -- if monosyllabic, do not add a redundant stress mark
if output[#output] == "-" or syllables[1] == "·" then -- check if following - or preceding ·
if output[#output] == "-" or syllables[1] == "·" then -- check if following - or preceding ·
working_word[syl]["stress2"] = true
working_word[syl]["stress2"] = true
-- mw.log("Secondary stress assigned to syllable " .. syl .. ".")
mw.log("Secondary stress assigned to syllable " .. syl .. ".")
else
else
working_word[syl]["stress"] = true
working_word[syl]["stress"] = true
-- mw.log("Primary stress assigned to syllable " .. syl .. ".")
mw.log("Primary stress assigned to syllable " .. syl .. ".")
end
end
else
else
-- mw.log("Implicit primary stress assigned to monosyllable.")
mw.log("Implicit primary stress assigned to monosyllable.")
end
end
Line 1,192: Line 1,195:
end
end
working_word = {}
working_word = {}
-- mw.log("Word registered to output.")
mw.log("Word registered to output.")
else
else
error("An empty word cannot be registered")
error("An empty word cannot be registered")
Line 1,203: Line 1,206:
-- calculate stress on the working word
-- calculate stress on the working word
-- mw.log("Syllables in working word: " .. #working_word)
mw.log("Syllables in working word: " .. #working_word)
if #working_word == 0 or working_word == nil then
if #working_word == 0 or working_word == nil then
Line 1,256: Line 1,259:
error("Empty syllable found in array. The array should contain no empty syllables")
error("Empty syllable found in array. The array should contain no empty syllables")
else -- if boundary is identified as the working word, then
else -- if boundary is identified as the working word, then
-- mw.log ("Boundary syllable identified.")
mw.log ("Boundary syllable identified.")
table.insert(output, syllables[1])
table.insert(output, syllables[1])
-- mw.log("Boundary registered to output: [" .. syllables[1] .. "]")
mw.log("Boundary registered to output: [" .. syllables[1] .. "]")
table.remove(syllables, 1)
table.remove(syllables, 1)
end
end
-- mw.log("—————")
mw.log("—————")
end
end
-- mw.log("SYLLABLES EXHAUSTED\n==========\nRemoving [·] and [-] from the system.")
mw.log("SYLLABLES EXHAUSTED\n==========\nRemoving [·] and [-] from the system.")
local screened = false
local screened = false
Line 1,285: Line 1,288:
function resolve_syllables(syllables)
function resolve_syllables(syllables)


-- mw.log("————— RESOLVING SYLLABLES —————")
mw.log("————— RESOLVING SYLLABLES —————")
if #syllables > 1 then
if #syllables > 1 then
Line 1,294: Line 1,297:
if (syllables[i]["coda"] or syllables[i+1]["onset"]) and syllables[i+1] and type(syllables[i]) == "table" and type(syllables[i+1]) == "table" then
if (syllables[i]["coda"] or syllables[i+1]["onset"]) and syllables[i+1] and type(syllables[i]) == "table" and type(syllables[i+1]) == "table" then
-- -- mw.log("Resolving clusters in syllables " .. i .. " and " .. i + 1 .. ".")
-- mw.log("Resolving clusters in syllables " .. i .. " and " .. i + 1 .. ".")
-- get intersyllabic clusters --
-- get intersyllabic clusters --
if syllables[i]["coda"] then
if syllables[i]["coda"] then
Line 1,306: Line 1,309:
end
end
end
end
-- -- mw.log("Cluster to be resolved: " .. table.concat(working_cluster))
-- mw.log("Cluster to be resolved: " .. table.concat(working_cluster))
local p_last = working_cluster[#working_cluster]
local p_last = working_cluster[#working_cluster]
Line 1,329: Line 1,332:
end
end
end
end
-- mw.log("σ" .. i .. " | σ" .. i+1 .. " : … " .. table.concat(new_coda) .. " | " .. table.concat(new_onset) .. " …")
mw.log("σ" .. i .. " | σ" .. i+1 .. " : … " .. table.concat(new_coda) .. " | " .. table.concat(new_onset) .. " …")
syllables[i]["coda"] = new_coda
syllables[i]["coda"] = new_coda
syllables[i+1]["onset"] = new_onset
syllables[i+1]["onset"] = new_onset
Line 1,371: Line 1,374:
local output = ""
local output = ""
-- mw.log("————— COMPILING OUTPUT —————")
mw.log("————— COMPILING OUTPUT —————")
for i = 1, #syllables do
for i = 1, #syllables do
Line 1,383: Line 1,386:
if not (syllables[i+1]["stress"] or syllables[i+1]["stress2"]) then
if not (syllables[i+1]["stress"] or syllables[i+1]["stress2"]) 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
end
end
Line 1,417: Line 1,420:
local function get_nasal(check)
local function get_nasal(check)
if check then
if check then
-- mw.log("Phonetic nasalisation in syllable " .. i .. ": " .. syllables[i]["nucleus"] .. " → " .. nasalise[syllables[i]["nucleus"]])
mw.log("Phonetic nasalisation in syllable " .. i .. ": " .. syllables[i]["nucleus"] .. " → " .. nasalise[syllables[i]["nucleus"]])
syllables[i]["nucleus"] = nasalise[syllables[i]["nucleus"]]
syllables[i]["nucleus"] = nasalise[syllables[i]["nucleus"]]
table.remove(syllables[i]["coda"], 1)
table.remove(syllables[i]["coda"], 1)
Line 1,528: Line 1,531:
local p = 2
local p = 2
-- mw.log("——— Parameters ———")
mw.log("——— Parameters ———")
while args[p] do
while args[p] do
parameters[args[p]] = true
parameters[args[p]] = true
-- mw.log(args[p] .. " = true")
mw.log(args[p] .. " = true")
p = p + 1
p = p + 1
end
end
process_temp()
outputIPA = mw.ustring.gsub(outputIPA, "(%&nbsp%;)", " ")
outputIPA = mw.ustring.gsub(outputIPA, "(%&nbsp%;)", " ")
Line 1,551: Line 1,556:
if outputIPA == nil then
if outputIPA == nil then
-- mw.log("Invalid rhyme request.")
mw.log("Invalid rhyme request.")
return nil
return nil
Line 1,566: Line 1,571:
end
end
-- mw.log(outputIPA)
mw.log(outputIPA)
return outputIPA
return outputIPA

Navigation menu