Skip to content

Commit abfea4e

Browse files
committed
Worked around a case where the date bug would still be triggered if NVDA sent something like heading level 3 decryption. Also improves the IBMTTS experience a bit, too
1 parent 654750f commit abfea4e

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

addon/synthDrivers/ibmeci.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ def speak(self,speechSequence):
264264
if self._sendParams:
265265
embeds+=b"`vv%d `vs%d " % (_ibmeci.getVParam(ECIVoiceParam.eciVolume), _ibmeci.getVParam(ECIVoiceParam.eciSpeed))
266266
outlist.append((_ibmeci.speak, (embeds,)))
267+
speechSequence= self.combine_adjacent_strings(speechSequence)
267268
for item in speechSequence:
268269
if isinstance(item, string_types):
269270
s = self.processText(item)
@@ -335,6 +336,21 @@ def speak(self,speechSequence):
335336
_ibmeci.eciQueue.put(outlist)
336337
_ibmeci.process()
337338

339+
def combine_adjacent_strings(self, lst):
340+
""" If several strings are sent at once, combines them into one large string so regular expressions can match on it, most useful for the date bug in English, but improves the experience for IBMTTS as well. """
341+
result = []
342+
current_string = ''
343+
for item in lst:
344+
if isinstance(item, str):
345+
current_string += item
346+
else:
347+
if current_string:
348+
result.append(current_string)
349+
current_string = ''
350+
result.append(item)
351+
if current_string:
352+
result.append(current_string)
353+
return result
338354
def processText(self,text):
339355
#this converts to ansi for anticrash. If this breaks with foreign langs, we can remove it.
340356
text = text.encode(self.currentEncoding, 'replace') # special unicode symbols may encode to backquote. For this reason, backquote processing is after this.

0 commit comments

Comments
 (0)