improved r2h2 detecton for new syllable starts

This commit is contained in:
UndeadMaelys
2022-05-05 08:27:07 +02:00
parent 977b68249d
commit 720aefbffa
3 changed files with 28 additions and 26 deletions

View File

@@ -91,15 +91,12 @@ function convertToHeonian(text)
-- 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"
if i == 1 then new_syllable = true end
if string.sub(text,i,i) == "\t"
or string.sub(text,i,i) == "-" then -- check if its an unsupported symbol to skip it.
-- adjust i
if string.sub(text,i,i) == " " then -- spaces are exception
transcribed_text = transcribed_text .. " "
new_syllable = true
end
i = i + 1
pos = i
char_step = false
@@ -107,7 +104,12 @@ function convertToHeonian(text)
-- init checkup
if string.sub(text,i,i) == "."
or string.sub(text,i,i) == "'"
or string.sub(text,i,i) == " "
or string.sub(text,i,i) == "" then -- this forces the new syllable, since . is the syllable separator, also skips the symbol and repositions
if string.sub(text,i,i) == " " then -- spaces are exception
transcribed_text = transcribed_text .. " "
new_syllable = true
end
-- debug log
if debug then print("") end
if debug then print(" @[".. tostring(i).."]"..debug_s.." new syllable MARKER found") end