10,794
edits
TheNightAvl (talk | contribs) mNo edit summary |
TheNightAvl (talk | contribs) (Added Cv resolution) |
||
Line 1: | Line 1: | ||
local export = {} | local export = {} | ||
local getArgs = require('Module:Arguments').getArgs | local getArgs = require('Module:Arguments').getArgs | ||
-- DATA -- | |||
local data = { | local data = { | ||
Line 240: | Line 242: | ||
["t"] = "tʃ", ["ts"] = "tʃ", | ["t"] = "tʃ", ["ts"] = "tʃ", | ||
["z"] = "ʒ", | ["z"] = "ʒ", | ||
} | |||
local Cv_fixed = { | |||
["b"] = true, | |||
["f"] = true, | |||
["p"] = true, | |||
} | |||
local Cv_split = { | |||
["m"] = true, ["n"] = true, | |||
} | } | ||
Line 262: | Line 274: | ||
[" "] = true, ["|"] = true, ["·"] = true, | [" "] = true, ["|"] = true, ["·"] = true, | ||
} | } | ||
-- PROCESS FUNCTIONS -- | |||
local IPA = {} | local IPA = {} | ||
function generate_IPA(word) | function generate_IPA(word) | ||
Line 510: | Line 522: | ||
end | end | ||
function resolve_consonants(phones) | function resolve_consonants(phones, hj_dv) | ||
local working_phones = phones | local working_phones = phones | ||
mw.log("————— BEGINNING CONSONANT RESOLUTION —————") | mw.log("————— BEGINNING CONSONANT RESOLUTION —————") | ||
Line 557: | Line 569: | ||
end | end | ||
-- Resolution of Ss, Sș, ts, ds, tș, dș (progressive voicing assimilation) -- | -- Resolution of hjádvanþs -- | ||
if hj_dv == false then | |||
if p_current == "ç" then | |||
mw.log("hjádvanþs = false:") | |||
p_Convert("ʃ") | |||
elseif p_current == "j" and (boundary[p_prev] or p_prev == nil) and consonant[p_next] then | |||
mw.log("hjádvanþs = false:") | |||
p_Convert("ʒ") | |||
end | |||
end | |||
-- Resolution of (T)Ss, (T)Sș, ts, ds, tș, dș (progressive voicing assimilation) -- | |||
if p_next == "s" then | if p_next == "s" then | ||
Line 590: | Line 614: | ||
end | end | ||
end | end | ||
-- Resolution of Cv -- | |||
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 .. ".") | |||
p_RemoveNext() | |||
end | |||
-- Resolution of regressive voicing assimilation -- | |||
if obstruent[p_current] == true then | if obstruent[p_current] == true then | ||
Line 598: | Line 631: | ||
for j = i + 1, #working_phones do | for j = i + 1, #working_phones do | ||
local check_phone = working_phones[j] | local check_phone = working_phones[j] | ||
if obstruent[check_phone] == true then | if obstruent[check_phone] == true and not check_phone == "v" then -- /v/ is excluded | ||
final_i = j | final_i = j | ||
else break | else break | ||
Line 651: | Line 684: | ||
end | end | ||
function get_syllables(phones) | |||
local working_phones = phones | |||
local syllables = {} | |||
local working_syllable = { | |||
["onset"] = {}, | |||
["nucleus"] = {}, | |||
["coda"] = {}, | |||
} | |||
local syllable_no = 1 | |||
local function register_syllable() | |||
syllables[syllable_no] = working_syllable | |||
mw.log("Syllable " .. syllable_no .. " registered.") | |||
syllable_no = syllable_no + 1 | |||
working_syllable = {} | |||
end | |||
local function register_boundary() | |||
register_syllable() | |||
syllables[syllable_no] = "|" | |||
mw.log("Boundary syllable " .. syllable_no .. " registered.") | |||
syllable_no = syllable_no + 1 | |||
end | |||
-- division into syllables -- | |||
while #working_phones > 0 do | |||
local p_check = working_phones[1] | |||
if consonant[p_check] or p_check == "·" or p_check == "-" then | |||
if working_syllable["nucleus"] == nil then | |||
table.append(working_syllable["onset"], p_check) | |||
mw.log("[" .. p_check .. "] appended to working onset.") | |||
table.remove(working_phones, 1) | |||
else | |||
--add to coda until new syllable | |||
end | |||
elseif vowel[p_check] then | |||
if working_syllable["nucleus"] == nil then | |||
working_syllable["nucleus"] = p_check | |||
else | |||
-- register syllable and begin new syllable | |||
end | |||
else | |||
-- register current syllable and register boundary -- | |||
end | |||
end | |||
mw.log("——— STRING EXHAUSTED ———") | |||
return syllables | |||
end | |||
function export.generate(frame) | function export.generate(frame) | ||
Line 661: | Line 744: | ||
outputIPA = resolve_vowels(outputIPA) | outputIPA = resolve_vowels(outputIPA) | ||
outputIPA = resolve_consonants(outputIPA) | outputIPA = resolve_consonants(outputIPA, hj) | ||
outputIPA = table.concat(outputIPA,"][") | outputIPA = table.concat(outputIPA,"][") | ||
Line 672: | Line 755: | ||
Debug console test string: | Debug console test string: | ||
=p.generate(mw.getCurrentFrame():newChild{title="whatever",args={"rjaovs"}}) | =p.generate(mw.getCurrentFrame():newChild{title="whatever",args={"rjaovs"}}) | ||
=p.generate(mw.getCurrentFrame():newChild{title="whatever",args={"rjaovs", "true"}}) (for hjádvanþs) | |||
]] | ]] |