Bugfix for Add Sentence Spacing format option

This commit is contained in:
KoboldAI Dev 2021-05-14 02:24:05 -04:00
parent c9b6f89d1d
commit 0e038b8727

View File

@ -66,9 +66,12 @@ def removespecialchars(txt):
#==================================================================# #==================================================================#
# If the next action follows a sentence closure, add a space # If the next action follows a sentence closure, add a space
#==================================================================# #==================================================================#
def addsentencespacing(txt, acts): def addsentencespacing(txt, vars):
# Get last character of last action # Get last character of last action
lastchar = acts[-1][-1] if(len(vars.actions) > 0):
lastchar = vars.actions[-1][-1]
else:
lastchar = vars.prompt[-1]
if(lastchar == "." or lastchar == "!" or lastchar == "?" or lastchar == "," or lastchar == ";" or lastchar == ":"): if(lastchar == "." or lastchar == "!" or lastchar == "?" or lastchar == "," or lastchar == ";" or lastchar == ":"):
txt = " " + txt txt = " " + txt
return txt return txt