Module:rad-pronunciation: Difference between revisions

Jump to navigation Jump to search
m
ਕੋਈ ਸੋਧ ਸਾਰ ਨਹੀਂ
mNo edit summary
mNo edit summary
Line 29: Line 29:
mw.log("——— Processing arguments ———")
mw.log("——— Processing arguments ———")
while args_frame[p] do
while args_frame[p] do
table.insert(args, args_frame[p])
table.insert(args, args_frame[p])
mw.log("Argument " .. p .. ": " .. args_frame[p])
mw.log("Argument " .. p .. ": " .. args_frame[p])
p = p + 1
p = p + 1
end
end
-- All possible "modes":
-- All possible "modes":
Line 79: Line 79:
local working_syllables = ""
local working_syllables = ""
for i = 1, #args do
if #args > 0 and args ~= nil then
mw.log("Processing argument " .. i .. ".")
for i = 1, #args do
if parameter[args[i]] ~= nil then -- mode changer
mw.log("Processing argument " .. i .. ".")
mode = args[i]
if parameter[args[i]] ~= nil then -- mode changer
mode_dialect = "standard"
mode = args[i]
mode_register = "plain"
mode_dialect = "standard"
elseif dialect[args[i]] ~= nil then
mode_register = "plain"
mode_dialect = args[i]
elseif dialect[args[i]] ~= nil then
mode_register = "plain"
mode_dialect = args[i]
elseif register[args[i]] ~= nil then
mode_register = "plain"
mode_register = args[i]
elseif register[args[i]] ~= nil then
mode_register = args[i]
-- begin adding data to tables --  
elseif mode == "IPA" then
-- begin adding data to tables --  
if args[i] == "no auto" then
elseif mode == "IPA" then
IPA_no_auto = true
if args[i] == "no auto" then
else
IPA_no_auto = true
table.insert(IPA[mode_dialect][mode_register], args[i])
else
mw.log("IPA: added '" .. args[i] .. "' to IPA[" .. mode_dialect .. "][" .. mode_register .. "]")
table.insert(IPA[mode_dialect][mode_register], args[i])
mw.log("IPA: added '" .. args[i] .. "' to IPA[" .. mode_dialect .. "][" .. mode_register .. "]")
if mode_dialect == "standard" or mode_dialect == "hjádvanþs" then
local just_phonemic = mw.ustring.match(args[i], "%/(.*)%/")
if mode_dialect == "standard" or mode_dialect == "hjádvanþs" then
insert_rhyme(just_phonemic)
local just_phonemic = mw.ustring.match(args[i], "%/(.*)%/")
insert_rhyme(just_phonemic)
end
end
end
end
elseif mode == "syllables" then
elseif mode == "syllables" then
if args[i] == "no auto" then
if args[i] == "no auto" then
syllables_no_auto = true
syllables_no_auto = true
elseif args[i] == "" then
elseif args[i] == "" then
if mw.ustring.find(working_syllables, "(%|)") then
if mw.ustring.find(working_syllables, "(%|)") then
table.insert(syllables, working_syllables)
table.insert(syllables, working_syllables)
mw.log("Syllables: " .. working_syllables .. " registered.")
mw.log("Syllables: " .. working_syllables .. " registered.")
end
working_syllables = ""
elseif args[i+1] == nil then
working_syllables = working_syllables .. "|" .. args[i]
if mw.ustring.find(working_syllables, "(%|)") then
table.insert(syllables, working_syllables)
mw.log("Syllables: " .. working_syllables .. " registered.")
end
else
working_syllables = working_syllables .. "|" .. args[i]
end
end
working_syllables = ""
elseif mode == "homophones" then
elseif args[i+1] == nil then
table.insert(homophones, args[i])
working_syllables = working_syllables .. "|" .. args[i]
mw.log("Homophones: " .. args[i] .. " registered.")
if mw.ustring.find(working_syllables, "(%|)") then
table.insert(syllables, working_syllables)
mw.log("Syllables: " .. working_syllables .. " registered.")
end
else
working_syllables = working_syllables .. "|" .. args[i]
end
end
elseif mode == "homophones" then
table.insert(homophones, args[i])
mw.log("Homophones: " .. args[i] .. " registered.")
end
end
end
end
-- add auto values --
-- add auto values --
if IPA_no_auto == false then
if IPA_no_auto == false then

Navigation menu