replace replace by sub

This commit is contained in:
Chrys 2019-08-29 18:08:22 +02:00
parent 1155103389
commit 7dd5b609de

View File

@ -38,8 +38,10 @@ class punctuationManager():
resultText = str(text) resultText = str(text)
if customDict: if customDict:
for key,item in customDict.items(): for key,item in customDict.items():
#resultText = resultText.replace(str(key),seperator + str(item) + seperator) try:
resultText = re.sub(str(key), seperator + str(item) + seperator, resultText) resultText = re.sub(str(key), seperator + str(item) + seperator, resultText)
except:
resultText = resultText.replace(str(key),seperator + str(item) + seperator)
return resultText return resultText
def usePunctuationDict(self, text, punctuationDict, punctuation): def usePunctuationDict(self, text, punctuationDict, punctuation):
resultText = str(text) resultText = str(text)