diff --git a/src/fenrirscreenreader/core/punctuationManager.py b/src/fenrirscreenreader/core/punctuationManager.py index 0c8592a1..d665141f 100644 --- a/src/fenrirscreenreader/core/punctuationManager.py +++ b/src/fenrirscreenreader/core/punctuationManager.py @@ -57,7 +57,8 @@ class punctuationManager(): else: resultText = resultText.replace(str(key),' ' +str(item) + ' ') return resultText - + def isPuctuation(self, char): + return char in self.env['punctuation']['PUNCTDICT'] def proceedPunctuation(self, text, ignorePunctuation=False): resultText = text resultText = self.useCustomDict(resultText, self.env['punctuation']['CUSTOMDICT']) diff --git a/src/fenrirscreenreader/core/textManager.py b/src/fenrirscreenreader/core/textManager.py index b68aad34..05633f30 100644 --- a/src/fenrirscreenreader/core/textManager.py +++ b/src/fenrirscreenreader/core/textManager.py @@ -31,6 +31,9 @@ class textManager(): newText += text[lastPos:span[0]] numberOfChars = len(text[span[0]:span[1]]) name = text[span[0]:span[1]][:2] + if not self.env['runtime']['punctuationManager'].isPuctuation(name[0]): + lastPos = span[1] + continue if name[0] == name[1]: newText += ' ' + str(numberOfChars) + ' ' + self.env['runtime']['punctuationManager'].proceedPunctuation(name[0], True) + ' ' else: @@ -45,6 +48,9 @@ class textManager(): result += text[lastPos:span[0]] numberOfChars = len(newText[span[0]:span[1]]) name = newText[span[0]:span[1]][:2] + if not self.env['runtime']['punctuationManager'].isPuctuation(name[0]): + lastPos = span[1] + continue if name[0] == name[1]: result += ' ' + str(numberOfChars) + ' ' + self.env['runtime']['punctuationManager'].proceedPunctuation(name[0], True) + ' ' else: