The fix for hopefully not reading all spaces broke review by character. Hopefully fix that.
This commit is contained in:
parent
e2fb28d92f
commit
d935ef2e3c
@ -101,7 +101,7 @@ class outputManager():
|
|||||||
cleanText = self.env['runtime']['textManager'].replaceHeadLines(cleanText)
|
cleanText = self.env['runtime']['textManager'].replaceHeadLines(cleanText)
|
||||||
cleanText = self.env['runtime']['punctuationManager'].proceedPunctuation(cleanText, ignorePunctuation)
|
cleanText = self.env['runtime']['punctuationManager'].proceedPunctuation(cleanText, ignorePunctuation)
|
||||||
cleanText = re.sub(' +$', ' ', cleanText)
|
cleanText = re.sub(' +$', ' ', cleanText)
|
||||||
self.env['runtime']['speechDriver'].speak(cleanText)
|
self.env['runtime']['speechDriver'].speak(cleanText, True, ignorePunctuation)
|
||||||
self.env['runtime']['debug'].writeDebugOut("Speak: "+ cleanText, debug.debugLevel.INFO)
|
self.env['runtime']['debug'].writeDebugOut("Speak: "+ cleanText, debug.debugLevel.INFO)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.env['runtime']['debug'].writeDebugOut("\"speak\" in outputManager.speakText ", debug.debugLevel.ERROR)
|
self.env['runtime']['debug'].writeDebugOut("\"speak\" in outputManager.speakText ", debug.debugLevel.ERROR)
|
||||||
|
@ -65,15 +65,16 @@ class punctuationManager():
|
|||||||
def isPuctuation(self, char):
|
def isPuctuation(self, char):
|
||||||
return char in self.env['punctuation']['PUNCTDICT']
|
return char in self.env['punctuation']['PUNCTDICT']
|
||||||
def proceedPunctuation(self, text, ignorePunctuation=False):
|
def proceedPunctuation(self, text, ignorePunctuation=False):
|
||||||
|
if ignorePunctuation:
|
||||||
|
return text
|
||||||
resultText = text
|
resultText = text
|
||||||
resultText = self.useCustomDict(resultText, self.env['punctuation']['CUSTOMDICT'])
|
resultText = self.useCustomDict(resultText, self.env['punctuation']['CUSTOMDICT'])
|
||||||
if self.env['runtime']['settingsManager'].getSettingAsBool('general', 'emoticons'):
|
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 = ''
|
currPunctLevel = ''
|
||||||
if not ignorePunctuation and self.env['runtime']['settingsManager'].getSetting('general', 'punctuationLevel').lower() in self.env['punctuation']['LEVELDICT']:
|
if 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()]
|
currPunctLevel = self.env['punctuation']['LEVELDICT'][self.env['runtime']['settingsManager'].getSetting('general', 'punctuationLevel').lower()]
|
||||||
elif not ignorePunctuation:
|
else:
|
||||||
# Only use fallback punctuation if ignorePunctuation is False
|
|
||||||
currPunctLevel = string.punctuation +' §'
|
currPunctLevel = string.punctuation +' §'
|
||||||
resultText = self.usePunctuationDict(resultText, self.env['punctuation']['PUNCTDICT'], currPunctLevel)
|
resultText = self.usePunctuationDict(resultText, self.env['punctuation']['PUNCTDICT'], currPunctLevel)
|
||||||
resultText = self.removeUnused(resultText, currPunctLevel)
|
resultText = self.removeUnused(resultText, currPunctLevel)
|
||||||
|
@ -24,7 +24,7 @@ class speechDriver():
|
|||||||
self.cancel()
|
self.cancel()
|
||||||
self._isInitialized = False
|
self._isInitialized = False
|
||||||
|
|
||||||
def speak(self,text, queueable=True):
|
def speak(self,text, queueable=True, ignorePunctuation=False):
|
||||||
if not self._isInitialized:
|
if not self._isInitialized:
|
||||||
return
|
return
|
||||||
if not queueable:
|
if not queueable:
|
||||||
|
@ -22,7 +22,7 @@ class driver(speechDriver):
|
|||||||
self._isInitialized = False
|
self._isInitialized = False
|
||||||
print('Speech Debug Driver: Shutdown')
|
print('Speech Debug Driver: Shutdown')
|
||||||
|
|
||||||
def speak(self,text, queueable=True):
|
def speak(self,text, queueable=True, ignorePunctuation=False):
|
||||||
if not self._isInitialized:
|
if not self._isInitialized:
|
||||||
return
|
return
|
||||||
if not queueable:
|
if not queueable:
|
||||||
|
@ -52,7 +52,7 @@ class driver(speechDriver):
|
|||||||
self.cancel()
|
self.cancel()
|
||||||
self.textQueue.put(-1)
|
self.textQueue.put(-1)
|
||||||
|
|
||||||
def speak(self,text, queueable=True):
|
def speak(self,text, queueable=True, ignorePunctuation=False):
|
||||||
if not self._isInitialized:
|
if not self._isInitialized:
|
||||||
return
|
return
|
||||||
if not queueable:
|
if not queueable:
|
||||||
|
@ -37,7 +37,7 @@ class driver(speechDriver):
|
|||||||
pass
|
pass
|
||||||
self._isInitialized = False
|
self._isInitialized = False
|
||||||
|
|
||||||
def speak(self,text, queueable=True):
|
def speak(self,text, queueable=True, ignorePunctuation=False):
|
||||||
if not queueable:
|
if not queueable:
|
||||||
self.cancel()
|
self.cancel()
|
||||||
if not self._isInitialized:
|
if not self._isInitialized:
|
||||||
@ -66,7 +66,10 @@ class driver(speechDriver):
|
|||||||
self.env['runtime']['debug'].writeDebugOut('speechDriver setVoice:' + str(e),debug.debugLevel.ERROR)
|
self.env['runtime']['debug'].writeDebugOut('speechDriver setVoice:' + str(e),debug.debugLevel.ERROR)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self._sd.set_punctuation(self._punct.NONE)
|
if ignorePunctuation:
|
||||||
|
self._sd.set_punctuation(self._punct.ALL)
|
||||||
|
else:
|
||||||
|
self._sd.set_punctuation(self._punct.NONE)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.env['runtime']['debug'].writeDebugOut('speechDriver set_punctuation:' + str(e),debug.debugLevel.ERROR)
|
self.env['runtime']['debug'].writeDebugOut('speechDriver set_punctuation:' + str(e),debug.debugLevel.ERROR)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user