Module:rad-IPA: Difference between revisions

m
ਕੋਈ ਸੋਧ ਸਾਰ ਨਹੀਂ
mNo edit summary
mNo edit summary
Line 105: Line 105:
local IPA = {}
local IPA = {}


function append_IPA(working_IPA)
function append_IPA (working_IPA)
local IPA_size = #IPA --This variable needs to be set before the function or it breaks.
local IPA_size = #IPA --This variable needs to be set before the function or it breaks.
print("————— REGISTERING PHONE —————")
print("————— REGISTERING PHONE —————")
Line 121: Line 121:


function generate_IPA(s)
function generate_IPA(s)
local s_len = utf8.len(s)
local s_len = mw.ustring.len(s)
IPA = {}
IPA = {}


local split_s = {}
local split_s = {}
for i = 1, s_len do
for i = 1, s_len do
  split_s[i] = string.sub(s, i,i)
  split_s[i] = mw.ustring.sub(s, i,i)
end
end


Line 138: Line 138:
local i_iteration = -2
local i_iteration = -2


print("\n=========================\n\nCURRENT TEST STRING: <".. s:upper() .. ">")
print("\n=========================\n\nCURRENT TEST STRING: <".. mw.ustring.upper(s) .. ">")


if s_len < 3 then
if s_len < 3 then
Line 213: Line 213:
  print("Target acquired of length " .. 1 - i .. ", converting to [" .. getData .. "].")
  print("Target acquired of length " .. 1 - i .. ", converting to [" .. getData .. "].")
  append_IPA(getData)
  append_IPA(getData)
  s = string.sub(s, 1, s_len + i - 1)
  s = mw.ustring.sub(s, 1, s_len + i - 1)
  s_len = string.len(s)
  s_len = mw.ustring.len(s)
  break
  break
elseif deadEnd == false then
elseif deadEnd == false then