replace replace by sub
This commit is contained in:
parent
6b6de57c9e
commit
1155103389
@ -34,14 +34,13 @@ class punctuationManager():
|
||||
except:
|
||||
pass
|
||||
return text.translate(currAllPunctNone)
|
||||
|
||||
def useCustomDict(self, text, customDict, seperator=''):
|
||||
resultText = str(text)
|
||||
if customDict:
|
||||
for key,item in customDict.items():
|
||||
resultText = resultText.replace(str(key),seperator + str(item) + seperator)
|
||||
#resultText = resultText.replace(str(key),seperator + str(item) + seperator)
|
||||
resultText = re.sub(str(key), seperator + str(item) + seperator, resultText)
|
||||
return resultText
|
||||
|
||||
def usePunctuationDict(self, text, punctuationDict, punctuation):
|
||||
resultText = str(text)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user