From ba2465a3bfe02fe7c13f0bcc96ce67487fd6bda2 Mon Sep 17 00:00:00 2001 From: UndeadMaelys Date: Sun, 1 May 2022 12:37:26 +0200 Subject: [PATCH] fixed r2h2, added words --- R2H2.lua | 41 ++++++++++++++++++++++------------------- words.lua | 4 +++- 2 files changed, 25 insertions(+), 20 deletions(-) diff --git a/R2H2.lua b/R2H2.lua index cfd0c03..8db3a9f 100644 --- a/R2H2.lua +++ b/R2H2.lua @@ -62,24 +62,24 @@ function convertToHeonian(text) if v == "-c" or v == "--copy" then autocopy = true end end - -- we check if it's necessary to check anything at all + -- evaluate conditions that cancel the script if text == "" then step = false end + -- if its necessary to run the script, then we continue :D + if step then -- prepare text - if step ~= false then - -- 1. add syllable marker at start if it isn't already present. - if string.sub(text,1,1) ~= "." then text = "." .. text end - -- 2. turn [x] into [ksh] - text = string.gsub(text,"x","ksh") - -- 3. turn [z] into [dsh] - text = string.gsub(text,"z","d.sh") - end - - -- read input and transcribe - if step == true then + -- 1. add syllable marker at start if it isn't already present. + if string.sub(text,1,1) ~= "." then text = "." .. text end + -- 2. turn [x] into [ksh] + text = string.gsub(text,"x","ksh") + -- 3. turn [z] into [dsh] + text = string.gsub(text,"z","d.sh") + -- 4. turn [j] into [y] + text = string.gsub(text,"j","y") + -- read input and transcribe -- debug log if debug then print("") end if debug then print("src: ".. text) end @@ -88,22 +88,25 @@ function convertToHeonian(text) -- sort through all the letters local i = 1 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 + -- 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 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) == " " 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 i = i + 1 pos = i char_step = false end -- 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 if debug then print("") end if debug then print(" @[".. tostring(i).."]"..debug_s.." new syllable MARKER found") end @@ -120,7 +123,7 @@ function convertToHeonian(text) -- debug log 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 if char_step == true then @@ -219,7 +222,7 @@ function convertToHeonian(text) end end - -- if no idea, move on + -- if no idea, move on, and just be confused. prints ? if char_step == true then -- debug log if debug then print(" [!] no idea; moving on to next [".. pos + 1 .."]") end diff --git a/words.lua b/words.lua index 1784f42..bf10ba4 100644 --- a/words.lua +++ b/words.lua @@ -82,7 +82,7 @@ table.insert(t,{"fo.ri","hair","noun","","",""}) table.insert(t,{"fow","deer","noun","","from fox in deerfox",""}) table.insert(t,{"fu.fo","belly","noun","","",""}) 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.le","stick","noun","","",""}) 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,{"chasku","to be hungry","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