10,794
edits
TheNightAvl (talk | contribs) mNo edit summary |
TheNightAvl (talk | contribs) mNo edit summary |
||
Line 435: | Line 435: | ||
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 558: | Line 558: | ||
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 573: | Line 573: | ||
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 579: | Line 579: | ||
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 586: | Line 586: | ||
-- 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 594: | Line 594: | ||
-- 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] 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 .. ".") | ||
p_Resolve("u") | p_Resolve("u") | ||
end | end | ||
Line 622: | Line 622: | ||
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 636: | Line 636: | ||
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 681: | Line 681: | ||
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 688: | Line 688: | ||
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 703: | Line 703: | ||
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 709: | Line 709: | ||
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 724: | Line 724: | ||
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 736: | Line 736: | ||
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 749: | Line 749: | ||
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 770: | Line 770: | ||
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 782: | Line 782: | ||
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 789: | Line 789: | ||
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 804: | Line 804: | ||
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 816: | Line 816: | ||
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 826: | Line 826: | ||
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 833: | Line 833: | ||
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 840: | Line 840: | ||
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 | ||
Line 851: | Line 851: | ||
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 864: | Line 864: | ||
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 878: | Line 878: | ||
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 902: | Line 902: | ||
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 928: | Line 928: | ||
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 941: | Line 941: | ||
local function register_syllable(check) | local function register_syllable(check) | ||
if check == true then | if check == true and working_syllable["nucleus"] ~= "" then | ||
syllables[syllable_no] = working_syllable | syllables[syllable_no] = working_syllable | ||
if #syllables[syllable_no]["onset"] == 0 then | if #syllables[syllable_no]["onset"] == 0 then | ||
Line 949: | Line 949: | ||
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 966: | Line 966: | ||
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 975: | Line 975: | ||
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 984: | Line 984: | ||
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") | ||
Line 1,047: | Line 1,047: | ||
end | end | ||
mw.log("STRING EXHAUSTED\n====================") | -- mw.log("STRING EXHAUSTED\n====================") | ||
return syllables | return syllables | ||
Line 1,054: | Line 1,054: | ||
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,064: | Line 1,064: | ||
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,102: | Line 1,102: | ||
end | end | ||
mw.log("—————") | -- mw.log("—————") | ||
end | end | ||
Line 1,153: | Line 1,153: | ||
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,164: | Line 1,164: | ||
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,177: | Line 1,177: | ||
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,196: | Line 1,196: | ||
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,207: | Line 1,207: | ||
-- 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,260: | Line 1,260: | ||
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,289: | Line 1,289: | ||
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,333: | Line 1,333: | ||
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,375: | Line 1,375: | ||
local output = "" | local output = "" | ||
mw.log("————— COMPILING OUTPUT —————") | -- mw.log("————— COMPILING OUTPUT —————") | ||
for i = 1, #syllables do | for i = 1, #syllables do | ||
Line 1,387: | Line 1,387: | ||
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,421: | Line 1,421: | ||
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,532: | Line 1,532: | ||
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 | ||
Line 1,557: | Line 1,557: | ||
if outputIPA == nil then | if outputIPA == nil then | ||
mw.log("Invalid rhyme request.") | -- mw.log("Invalid rhyme request.") | ||
return nil | return nil | ||
Line 1,572: | Line 1,572: | ||
end | end | ||
mw.log(outputIPA) | -- mw.log(outputIPA) | ||
return outputIPA | return outputIPA | ||