fix punctuation inside of a word seperate the word

This commit is contained in:
chrys 2016-09-29 20:35:53 +02:00
parent 2fd167e510
commit 0ee990eb62

View File

@ -12,6 +12,7 @@ class punctuationManager():
pass pass
def initialize(self, environment): def initialize(self, environment):
self.env = environment self.env = environment
self.allPunctNone = dict.fromkeys(map(ord, string.punctuation), None)
self.punctuation = { self.punctuation = {
'currLevel':'3', 'currLevel':'3',
'levels':{ 'levels':{
@ -60,7 +61,8 @@ class punctuationManager():
def shutdown(self): def shutdown(self):
pass pass
def removeUnused(self, text): def removeUnused(self, text):
return text.translate(text.maketrans(string.punctuation, ' '*len(string.punctuation))) return text.translate(self.allPunctNone)
def useCustomDict(self, text, customDict): def useCustomDict(self, text, customDict):
resultText = str(text) resultText = str(text)
if customDict: if customDict: