add regex;
This commit is contained in:
@ -39,9 +39,12 @@ class punctuationManager():
|
||||
if customDict:
|
||||
for key,item in customDict.items():
|
||||
try:
|
||||
resultText = re.sub(str(key), seperator + str(item) + seperator, resultText)
|
||||
except:
|
||||
resultText = resultText.replace(str(key),seperator + str(item) + seperator)
|
||||
if item.upper().startswith('REGEX;') and (len(item) > 6):
|
||||
resultText = re.sub(str(key), seperator + str(item[6:]) + seperator, resultText)
|
||||
else:
|
||||
resultText = resultText.replace(str(key),seperator + str(item) + seperator)
|
||||
except Exception as e:
|
||||
self.env['runtime']['debug'].writeDebugOut("useCustomDict replace:'" + key + "' with '" + item +"' failed:" + str(e),debug.debugLevel.ERROR, onAnyLevel=False)
|
||||
return resultText
|
||||
def usePunctuationDict(self, text, punctuationDict, punctuation):
|
||||
resultText = str(text)
|
||||
|
Reference in New Issue
Block a user