Update punctuationManager.py
This commit is contained in:
parent
1f263b2cf0
commit
217ec6a2c0
@ -30,15 +30,16 @@ class punctuationManager():
|
||||
def shutdown(self):
|
||||
pass
|
||||
def removeUnused(self, text):
|
||||
resultText = text.translate(text.maketrans(string.punctuation, ' '*len(string.punctuation)))
|
||||
return resultText
|
||||
return text.translate(text.maketrans(string.punctuation, ' '*len(string.punctuation)))
|
||||
def useCustomDict(self, text, customDict):
|
||||
resultText = text
|
||||
if customDict:
|
||||
for key,item in customDict.items():
|
||||
resultText = resultText.replace(str(key),str(item))
|
||||
return resultText
|
||||
def usePunctuationDict(self, text, punctuationDict, punctuation):
|
||||
resultText = str(text)
|
||||
if punctuationDict and punctuation != '':
|
||||
for key,item in punctuationDict.items():
|
||||
if key in punctuation:
|
||||
resultText = resultText.replace(str(key),' ' +str(item) +' ')
|
||||
|
Loading…
Reference in New Issue
Block a user