fixed r2h2, added words

This commit is contained in:
UndeadMaelys 2022-05-01 12:37:26 +02:00
parent db5155ea5c
commit ba2465a3bf
2 changed files with 25 additions and 20 deletions

View File

@ -62,24 +62,24 @@ function convertToHeonian(text)
if v == "-c" or v == "--copy" then autocopy = true end if v == "-c" or v == "--copy" then autocopy = true end
end end
-- we check if it's necessary to check anything at all -- evaluate conditions that cancel the script
if text == "" then if text == "" then
step = false step = false
end end
-- if its necessary to run the script, then we continue :D
if step then
-- prepare text -- prepare text
if step ~= false then -- 1. add syllable marker at start if it isn't already present.
-- 1. add syllable marker at start if it isn't already present. if string.sub(text,1,1) ~= "." then text = "." .. text end
if string.sub(text,1,1) ~= "." then text = "." .. text end -- 2. turn [x] into [ksh]
-- 2. turn [x] into [ksh] text = string.gsub(text,"x","ksh")
text = string.gsub(text,"x","ksh") -- 3. turn [z] into [dsh]
-- 3. turn [z] into [dsh] text = string.gsub(text,"z","d.sh")
text = string.gsub(text,"z","d.sh") -- 4. turn [j] into [y]
end text = string.gsub(text,"j","y")
-- read input and transcribe
if step == true then
-- read input and transcribe
-- debug log -- debug log
if debug then print("") end if debug then print("") end
if debug then print("src: ".. text) end if debug then print("src: ".. text) end
@ -88,22 +88,25 @@ function convertToHeonian(text)
-- sort through all the letters -- sort through all the letters
local i = 1 local i = 1
while i < string.len(text)+1 do while i < string.len(text)+1 do
-- know current pos
local char_step = true -- this is false when a conclusion has been reached
local pos = i local pos = i
-- know current pos, since we will be modifying i but still evaluating from the position
local char_step = true
-- this is false when a conclusion has been reached about what symbol does the next segment correspond to
local debug_s = "" local debug_s = ""
local new_syllable = false -- debug string
local new_syllable = false
-- this is true when a new syllable begins, and is used to distinguish normal vowels and consonants from trailing ones
if string.sub(text,i,i) == " " if string.sub(text,i,i) == " "
or string.sub(text,i,i) == "\t" or string.sub(text,i,i) == "\t"
or string.sub(text,i,i) == "-" then or string.sub(text,i,i) == "-" then -- check if its an unsupported symbol to skip it.
-- adjust i -- adjust i
i = i + 1 i = i + 1
pos = i pos = i
char_step = false char_step = false
end end
-- init checkup -- init checkup
if string.sub(text,i,i) == "." then if string.sub(text,i,i) == "." then -- this forces the new syllable, since . is the syllable separator, also skips the symbol and repositions
-- debug log -- debug log
if debug then print("") end if debug then print("") end
if debug then print(" @[".. tostring(i).."]"..debug_s.." new syllable MARKER found") end if debug then print(" @[".. tostring(i).."]"..debug_s.." new syllable MARKER found") end
@ -120,7 +123,7 @@ function convertToHeonian(text)
-- debug log -- debug log
if debug then print("") end if debug then print("") end
if debug then print(" @[".. tostring(i).."]"..debug_s.." checking string: ".. string.sub(text,i,i)) end if debug then print(" @[".. tostring(i).."]"..debug_s.." checking string: ".. string.sub(text,i,i)) end -- debug print positional info
-- lets check if it is a composite -- lets check if it is a composite
if char_step == true then if char_step == true then
@ -219,7 +222,7 @@ function convertToHeonian(text)
end end
end end
-- if no idea, move on -- if no idea, move on, and just be confused. prints ?
if char_step == true then if char_step == true then
-- debug log -- debug log
if debug then print(" [!] no idea; moving on to next [".. pos + 1 .."]") end if debug then print(" [!] no idea; moving on to next [".. pos + 1 .."]") end

View File

@ -82,7 +82,7 @@ table.insert(t,{"fo.ri","hair","noun","","",""})
table.insert(t,{"fow","deer","noun","","from fox in deerfox",""}) table.insert(t,{"fow","deer","noun","","from fox in deerfox",""})
table.insert(t,{"fu.fo","belly","noun","","",""}) table.insert(t,{"fu.fo","belly","noun","","",""})
table.insert(t,{"fu.ra","full, whole","modifier","","",""}) table.insert(t,{"fu.ra","full, whole","modifier","","",""})
table.insert(t,{"ga.da.la","warm","modifier","","",""}) table.insert(t,{"ga.da.la","warm, in love","modifier","","",""})
table.insert(t,{"ga.la","far","modifier","","",""}) table.insert(t,{"ga.la","far","modifier","","",""})
table.insert(t,{"ga.le","stick","noun","","",""}) table.insert(t,{"ga.le","stick","noun","","",""})
table.insert(t,{"ga.mat","there","pronoun","","",""}) table.insert(t,{"ga.mat","there","pronoun","","",""})
@ -312,4 +312,6 @@ table.insert(t,{"t.shek","sound of teeth clacking","noun","","",""})
table.insert(t,{"she","food","noun","","",""}) table.insert(t,{"she","food","noun","","",""})
table.insert(t,{"chasku","to be hungry","verb","","",""}) table.insert(t,{"chasku","to be hungry","verb","","",""})
table.insert(t,{"pme.po.ku","to climb","verb","","",""}) table.insert(t,{"pme.po.ku","to climb","verb","","",""})
table.insert(t,{"dsho.ei.an.en-ba","sweetie, honey, dear (exclusive to partners)","expression","","",""})
table.insert(t,{"maur","that's nice, although im sorry for u :< (simulatenously)","expression","","",""})
return t return t