replace replace by sub
This commit is contained in:
parent
6b6de57c9e
commit
1155103389
@ -34,14 +34,13 @@ class punctuationManager():
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
return text.translate(currAllPunctNone)
|
return text.translate(currAllPunctNone)
|
||||||
|
|
||||||
def useCustomDict(self, text, customDict, seperator=''):
|
def useCustomDict(self, text, customDict, seperator=''):
|
||||||
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)
|
#resultText = resultText.replace(str(key),seperator + str(item) + seperator)
|
||||||
|
resultText = re.sub(str(key), seperator + str(item) + seperator, resultText)
|
||||||
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