replace replace by sub
This commit is contained in:
parent
1155103389
commit
7dd5b609de
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user