From c3d1ccd10bedb5e9baed2e662fb647f4035eacb9 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Wed, 13 Mar 2024 00:56:53 -0400 Subject: [PATCH] Added setting readNumbersAsDigits. --- config/settings/espeak.settings.conf | 3 +++ config/settings/settings-chime.conf | 4 +++- config/settings/settings-daemon.conf | 3 +++ config/settings/settings-pty.conf | 3 +++ config/settings/settings.conf | 3 +++ config/settings/settings.conf.dectalk | 3 +++ config/settings/settings.conf.example | 3 +++ config/settings/settings.conf.storm | 3 +++ config/settings/speech-dispatcher.settings.conf | 3 +++ src/fenrirscreenreader/core/outputManager.py | 2 ++ src/fenrirscreenreader/core/settingsData.py | 1 + 11 files changed, 30 insertions(+), 1 deletion(-) diff --git a/config/settings/espeak.settings.conf b/config/settings/espeak.settings.conf index 64d5c086..8d3d0c34 100644 --- a/config/settings/espeak.settings.conf +++ b/config/settings/espeak.settings.conf @@ -64,6 +64,9 @@ language=en_US # Read new text as it happens? autoReadIncoming=True + +# Speak individual numbers instead of whole string. +readNumbersAsDigits': False # genericSpeechCommand is the command that is executed for talking # the following variables are replaced with values diff --git a/config/settings/settings-chime.conf b/config/settings/settings-chime.conf index f796ed60..ce89dc03 100644 --- a/config/settings/settings-chime.conf +++ b/config/settings/settings-chime.conf @@ -72,7 +72,9 @@ language=en # Read new text as it happens? autoReadIncoming=True -# genericSpeechCommand is the command that is executed for talking +# Speak individual numbers instead of whole string. +readNumbersAsDigits': False# genericSpeechCommand is the command that is executed for talking + # the following variables are replaced with values # fenrirText = is the text that should be spoken # fenrirModule = may be the speech module like used in speech-dispatcher, not every TTY need this diff --git a/config/settings/settings-daemon.conf b/config/settings/settings-daemon.conf index 851fd4a1..6cc42d51 100644 --- a/config/settings/settings-daemon.conf +++ b/config/settings/settings-daemon.conf @@ -66,6 +66,9 @@ voice=en-us # Read new text as it happens? autoReadIncoming=True + +# Speak individual numbers instead of whole string. +readNumbersAsDigits': False # genericSpeechCommand is the command that is executed for talking # the following variables are replaced with values diff --git a/config/settings/settings-pty.conf b/config/settings/settings-pty.conf index 851fd4a1..6cc42d51 100644 --- a/config/settings/settings-pty.conf +++ b/config/settings/settings-pty.conf @@ -66,6 +66,9 @@ voice=en-us # Read new text as it happens? autoReadIncoming=True + +# Speak individual numbers instead of whole string. +readNumbersAsDigits': False # genericSpeechCommand is the command that is executed for talking # the following variables are replaced with values diff --git a/config/settings/settings.conf b/config/settings/settings.conf index 5985be79..f75d1a14 100644 --- a/config/settings/settings.conf +++ b/config/settings/settings.conf @@ -68,6 +68,9 @@ volume=1.0 # Read new text as it happens? autoReadIncoming=True +# Speak individual numbers instead of whole string. +readNumbersAsDigits': False + # genericSpeechCommand is the command that is executed for talking # the following variables are replaced with values # fenrirText = is the text that should be spoken diff --git a/config/settings/settings.conf.dectalk b/config/settings/settings.conf.dectalk index e9c065ca..0f087c76 100644 --- a/config/settings/settings.conf.dectalk +++ b/config/settings/settings.conf.dectalk @@ -68,6 +68,9 @@ voice=0 # Read new text as it happens? autoReadIncoming=True +# Speak individual numbers instead of whole string. +readNumbersAsDigits': False + # genericSpeechCommand is the command that is executed for talking # the following variables are replaced with values # fenrirText = is the text that should be spoken diff --git a/config/settings/settings.conf.example b/config/settings/settings.conf.example index c67130fb..f7aa4e7f 100644 --- a/config/settings/settings.conf.example +++ b/config/settings/settings.conf.example @@ -67,6 +67,9 @@ voice=en-us # Read new text as it happens? autoReadIncoming=True + +# Speak individual numbers instead of whole string. +readNumbersAsDigits': False # genericSpeechCommand is the command that is executed for talking # the following variables are replaced with values diff --git a/config/settings/settings.conf.storm b/config/settings/settings.conf.storm index 0b8d2bd8..bee08d10 100644 --- a/config/settings/settings.conf.storm +++ b/config/settings/settings.conf.storm @@ -21,6 +21,9 @@ voice=en-us language=en-us volume=0.6 autoReadIncoming=True + +# Speak individual numbers instead of whole string. +readNumbersAsDigits': False # genericSpeechCommand is the command that is executed for talking # the following variables are replaced with values diff --git a/config/settings/speech-dispatcher.settings.conf b/config/settings/speech-dispatcher.settings.conf index c898d2ee..4b6a974c 100644 --- a/config/settings/speech-dispatcher.settings.conf +++ b/config/settings/speech-dispatcher.settings.conf @@ -66,6 +66,9 @@ language=english-us # Read new text as it happens? autoReadIncoming=True + +# Speak individual numbers instead of whole string. +readNumbersAsDigits': False # genericSpeechCommand is the command that is executed for talking # the following variables are replaced with values diff --git a/src/fenrirscreenreader/core/outputManager.py b/src/fenrirscreenreader/core/outputManager.py index 618923cb..fd59912e 100644 --- a/src/fenrirscreenreader/core/outputManager.py +++ b/src/fenrirscreenreader/core/outputManager.py @@ -27,6 +27,8 @@ class outputManager(): def presentText(self, text, interrupt=True, soundIcon = '', ignorePunctuation=False, announceCapital=False, flush=True, brailleAlternative = ''): if text == '': return + if self.env['runtime']['settingsManager'].getSettingAsBool('speech', 'readNumbersAsDigits'): + text = re.sub(r"(\d)", r"\1 ", text).rstrip() self.env['runtime']['debug'].writeDebugOut("presentText:\nsoundIcon:'"+soundIcon+"'\nText:\n" + text ,debug.debugLevel.INFO) if self.playSoundIcon(soundIcon, interrupt): self.env['runtime']['debug'].writeDebugOut("soundIcon found" ,debug.debugLevel.INFO) diff --git a/src/fenrirscreenreader/core/settingsData.py b/src/fenrirscreenreader/core/settingsData.py index eb8bc41b..f9dd8255 100644 --- a/src/fenrirscreenreader/core/settingsData.py +++ b/src/fenrirscreenreader/core/settingsData.py @@ -27,6 +27,7 @@ settingsData = { 'voice': 'en-us', 'language': '', 'autoReadIncoming': True, + 'readNumbersAsDigits': False, 'genericSpeechCommand':'espeak -a fenrirVolume -s fenrirRate -p fenrirPitch -v fenrirVoice "fenrirText"', 'fenrirMinVolume':0, 'fenrirMaxVolume':200,