add space for emoji dict

This commit is contained in:
chrys 2017-10-20 21:02:45 +02:00
parent 5f76423c27
commit 3ef411435c

View File

@ -32,11 +32,11 @@ class punctuationManager():
pass
return text.translate(currAllPunctNone)
def useCustomDict(self, text, customDict):
def useCustomDict(self, text, customDict, seperator=''):
resultText = str(text)
if customDict:
for key,item in customDict.items():
resultText = resultText.replace(str(key),str(item))
resultText = resultText.replace(str(key),seperator + str(item) + seperator)
return resultText
def usePunctuationDict(self, text, punctuationDict, punctuation):
@ -59,7 +59,7 @@ class punctuationManager():
resultText = text
resultText = self.useCustomDict(resultText, self.env['punctuation']['CUSTOMDICT'])
if self.env['runtime']['settingsManager'].getSettingAsBool('general', 'emoticons'):
resultText = self.useCustomDict(resultText, self.env['punctuation']['EMOTICONDICT'])
resultText = self.useCustomDict(resultText, self.env['punctuation']['EMOTICONDICT'], ' ')
currPunctLevel = ''
if not ignorePunctuation and self.env['runtime']['settingsManager'].getSetting('general', 'punctuationLevel').lower() in self.env['punctuation']['LEVELDICT']:
currPunctLevel = self.env['punctuation']['LEVELDICT'][self.env['runtime']['settingsManager'].getSetting('general', 'punctuationLevel').lower()]