From 7f91223f945b8376340aed9f444ae1109d134235 Mon Sep 17 00:00:00 2001 From: Chrys Date: Thu, 29 Aug 2019 17:51:34 +0200 Subject: [PATCH 01/10] replace replace by sub --- .../core/punctuationManager.py | 9 ++--- .../screenDriver/ptyDriver.py | 38 +++++++++++++------ 2 files changed, 31 insertions(+), 16 deletions(-) diff --git a/src/fenrirscreenreader/core/punctuationManager.py b/src/fenrirscreenreader/core/punctuationManager.py index a98577ea..095b8506 100644 --- a/src/fenrirscreenreader/core/punctuationManager.py +++ b/src/fenrirscreenreader/core/punctuationManager.py @@ -33,15 +33,14 @@ class punctuationManager(): del currAllPunctNone[ord(char)] except: pass - return text.translate(currAllPunctNone) - + return text.translate(currAllPunctNone) def useCustomDict(self, text, customDict, seperator=''): resultText = str(text) if customDict: for key,item in customDict.items(): - resultText = resultText.replace(str(key),seperator + str(item) + seperator) + #resultText = resultText.replace(str(key),seperator + str(item) + seperator) + resultText = re.sub(str(key), str(item), resultText) return resultText - def usePunctuationDict(self, text, punctuationDict, punctuation): resultText = str(text) @@ -53,7 +52,7 @@ class punctuationManager(): if self.env['runtime']['settingsManager'].getSetting('general', 'respectPunctuationPause') and \ len(key) == 1 and \ key in "',.;:?!": - resultText = resultText.replace(str(key),' ' +str(item) + str(key) + ' ') + resultText = resultText.replace(str(key),' ' +str(item) + str(key) + ' ') else: resultText = resultText.replace(str(key),' ' +str(item) + ' ') return resultText diff --git a/src/fenrirscreenreader/screenDriver/ptyDriver.py b/src/fenrirscreenreader/screenDriver/ptyDriver.py index 7f0ced69..388083a6 100644 --- a/src/fenrirscreenreader/screenDriver/ptyDriver.py +++ b/src/fenrirscreenreader/screenDriver/ptyDriver.py @@ -87,6 +87,13 @@ class driver(screenDriver): self.env = environment self.command = self.env['runtime']['settingsManager'].getSetting('general','shell') self.shortcutType = self.env['runtime']['inputManager'].getShortcutType() + param = [sys.stdin.fileno(), sys.stdout.fileno(), self.signalPipe, self.p_out, self.p_pid] + #param[0] = sys.stdin + #param[1] = sys.stdout + #param[2] = self.signalPipe + #param[3] = self.p_out + #param[4] = self.p_pid + self.env['runtime']['processManager'].addCustomEventThread(self.terminalEmulation, pargs = param, multiprocess = False) self.env['runtime']['processManager'].addCustomEventThread(self.terminalEmulation) def getCurrScreen(self): self.env['screen']['oldTTY'] = 'pty' @@ -153,17 +160,26 @@ class driver(screenDriver): return lines, columns def handleSigwinch(self, *args): os.write(self.signalPipe[1], b'w') - def terminalEmulation(self,active , eventQueue): - try: - old_attr = termios.tcgetattr(sys.stdin) - tty.setraw(0) - lines, columns = self.getTerminalSize(0) - if self.command == '': - self.command = screen_utils.getShell() - self.terminal, self.p_pid, self.p_out = self.openTerminal(columns, lines, self.command) - lines, columns = self.resizeTerminal(self.p_out) - self.terminal.resize(lines, columns) - fdList = [sys.stdin, self.p_out, self.signalPipe[0]] + def terminalEmulation(self,active , eventQueue, param = None): + try: + #stdin = param[0] + stdin = os.fdopen(param[0]) + stdout = os.fdopen(param[1]) + signalPipe = param[2] + p_outFd = param[3] + p_pid = param[4] + old_attr = termios.tcgetattr(stdin) + tty.setraw(0) + lines, columns = self.getTerminalSize(0) + if self.command == '': + self.command = screen_utils.getShell() + terminal, p_pid.value, fd = self.openTerminal(columns, lines, self.command) + p_outFd.value = os.dup(fd) + p_out = fd + #p_out = os.fdopen(p_outFd.value, "r+b", 0) + lines, columns = self.resizeTerminal(p_out) + terminal.resize(lines, columns) + fdList = [stdin, p_out, signalPipe[0]] while active.value: r, _, _ = select(fdList, [], [], 1) # none From 6b6de57c9ec26fa2af30d8cfd93382be75da579b Mon Sep 17 00:00:00 2001 From: Chrys Date: Thu, 29 Aug 2019 17:52:57 +0200 Subject: [PATCH 02/10] Revert "replace replace by sub" This reverts commit 7f91223f945b8376340aed9f444ae1109d134235. --- .../core/punctuationManager.py | 9 +++-- .../screenDriver/ptyDriver.py | 38 ++++++------------- 2 files changed, 16 insertions(+), 31 deletions(-) diff --git a/src/fenrirscreenreader/core/punctuationManager.py b/src/fenrirscreenreader/core/punctuationManager.py index 095b8506..a98577ea 100644 --- a/src/fenrirscreenreader/core/punctuationManager.py +++ b/src/fenrirscreenreader/core/punctuationManager.py @@ -33,14 +33,15 @@ class punctuationManager(): del currAllPunctNone[ord(char)] except: pass - return text.translate(currAllPunctNone) + return text.translate(currAllPunctNone) + def useCustomDict(self, text, customDict, seperator=''): resultText = str(text) if customDict: for key,item in customDict.items(): - #resultText = resultText.replace(str(key),seperator + str(item) + seperator) - resultText = re.sub(str(key), str(item), resultText) + resultText = resultText.replace(str(key),seperator + str(item) + seperator) return resultText + def usePunctuationDict(self, text, punctuationDict, punctuation): resultText = str(text) @@ -52,7 +53,7 @@ class punctuationManager(): if self.env['runtime']['settingsManager'].getSetting('general', 'respectPunctuationPause') and \ len(key) == 1 and \ key in "',.;:?!": - resultText = resultText.replace(str(key),' ' +str(item) + str(key) + ' ') + resultText = resultText.replace(str(key),' ' +str(item) + str(key) + ' ') else: resultText = resultText.replace(str(key),' ' +str(item) + ' ') return resultText diff --git a/src/fenrirscreenreader/screenDriver/ptyDriver.py b/src/fenrirscreenreader/screenDriver/ptyDriver.py index 388083a6..7f0ced69 100644 --- a/src/fenrirscreenreader/screenDriver/ptyDriver.py +++ b/src/fenrirscreenreader/screenDriver/ptyDriver.py @@ -87,13 +87,6 @@ class driver(screenDriver): self.env = environment self.command = self.env['runtime']['settingsManager'].getSetting('general','shell') self.shortcutType = self.env['runtime']['inputManager'].getShortcutType() - param = [sys.stdin.fileno(), sys.stdout.fileno(), self.signalPipe, self.p_out, self.p_pid] - #param[0] = sys.stdin - #param[1] = sys.stdout - #param[2] = self.signalPipe - #param[3] = self.p_out - #param[4] = self.p_pid - self.env['runtime']['processManager'].addCustomEventThread(self.terminalEmulation, pargs = param, multiprocess = False) self.env['runtime']['processManager'].addCustomEventThread(self.terminalEmulation) def getCurrScreen(self): self.env['screen']['oldTTY'] = 'pty' @@ -160,26 +153,17 @@ class driver(screenDriver): return lines, columns def handleSigwinch(self, *args): os.write(self.signalPipe[1], b'w') - def terminalEmulation(self,active , eventQueue, param = None): - try: - #stdin = param[0] - stdin = os.fdopen(param[0]) - stdout = os.fdopen(param[1]) - signalPipe = param[2] - p_outFd = param[3] - p_pid = param[4] - old_attr = termios.tcgetattr(stdin) - tty.setraw(0) - lines, columns = self.getTerminalSize(0) - if self.command == '': - self.command = screen_utils.getShell() - terminal, p_pid.value, fd = self.openTerminal(columns, lines, self.command) - p_outFd.value = os.dup(fd) - p_out = fd - #p_out = os.fdopen(p_outFd.value, "r+b", 0) - lines, columns = self.resizeTerminal(p_out) - terminal.resize(lines, columns) - fdList = [stdin, p_out, signalPipe[0]] + def terminalEmulation(self,active , eventQueue): + try: + old_attr = termios.tcgetattr(sys.stdin) + tty.setraw(0) + lines, columns = self.getTerminalSize(0) + if self.command == '': + self.command = screen_utils.getShell() + self.terminal, self.p_pid, self.p_out = self.openTerminal(columns, lines, self.command) + lines, columns = self.resizeTerminal(self.p_out) + self.terminal.resize(lines, columns) + fdList = [sys.stdin, self.p_out, self.signalPipe[0]] while active.value: r, _, _ = select(fdList, [], [], 1) # none From 1155103389715321ba2c0b720571082418924110 Mon Sep 17 00:00:00 2001 From: Chrys Date: Thu, 29 Aug 2019 17:55:19 +0200 Subject: [PATCH 03/10] replace replace by sub --- src/fenrirscreenreader/core/punctuationManager.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/fenrirscreenreader/core/punctuationManager.py b/src/fenrirscreenreader/core/punctuationManager.py index a98577ea..f7c6bfb6 100644 --- a/src/fenrirscreenreader/core/punctuationManager.py +++ b/src/fenrirscreenreader/core/punctuationManager.py @@ -33,15 +33,14 @@ class punctuationManager(): del currAllPunctNone[ord(char)] except: pass - return text.translate(currAllPunctNone) - + return text.translate(currAllPunctNone) def useCustomDict(self, text, customDict, seperator=''): resultText = str(text) if customDict: for key,item in customDict.items(): - resultText = resultText.replace(str(key),seperator + str(item) + seperator) + #resultText = resultText.replace(str(key),seperator + str(item) + seperator) + resultText = re.sub(str(key), seperator + str(item) + seperator, resultText) return resultText - def usePunctuationDict(self, text, punctuationDict, punctuation): resultText = str(text) @@ -53,7 +52,7 @@ class punctuationManager(): if self.env['runtime']['settingsManager'].getSetting('general', 'respectPunctuationPause') and \ len(key) == 1 and \ key in "',.;:?!": - resultText = resultText.replace(str(key),' ' +str(item) + str(key) + ' ') + resultText = resultText.replace(str(key),' ' +str(item) + str(key) + ' ') else: resultText = resultText.replace(str(key),' ' +str(item) + ' ') return resultText From 7dd5b609de907f72d09048260e06a19ef608dace Mon Sep 17 00:00:00 2001 From: Chrys Date: Thu, 29 Aug 2019 18:08:22 +0200 Subject: [PATCH 04/10] replace replace by sub --- src/fenrirscreenreader/core/punctuationManager.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/fenrirscreenreader/core/punctuationManager.py b/src/fenrirscreenreader/core/punctuationManager.py index f7c6bfb6..767d62ae 100644 --- a/src/fenrirscreenreader/core/punctuationManager.py +++ b/src/fenrirscreenreader/core/punctuationManager.py @@ -38,8 +38,10 @@ class punctuationManager(): resultText = str(text) if customDict: for key,item in customDict.items(): - #resultText = resultText.replace(str(key),seperator + str(item) + seperator) - resultText = re.sub(str(key), seperator + str(item) + seperator, resultText) + try: + resultText = re.sub(str(key), seperator + str(item) + seperator, resultText) + except: + resultText = resultText.replace(str(key),seperator + str(item) + seperator) return resultText def usePunctuationDict(self, text, punctuationDict, punctuation): resultText = str(text) From 46427342b351c3ef117030a079591b2cea468129 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Thu, 29 Aug 2019 12:33:32 -0400 Subject: [PATCH 05/10] Emoticons escaped. Comments added explaing custom and emoticon dicts use regexp. --- config/punctuation/default.conf | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/config/punctuation/default.conf b/config/punctuation/default.conf index e3995e53..f99d0d6c 100644 --- a/config/punctuation/default.conf +++ b/config/punctuation/default.conf @@ -44,26 +44,28 @@ _:===:line =:===:equals [customDict] +# This dictionary uses regexp, so be sure to escape anything that would be parsed by regexp, e.g. *, ., ^, $, etc. [emoticonDict] +# This dictionary uses regexp, so be sure to escape anything that would be parsed by regexp, e.g. *, ., ^, $, etc. <{-.-}>:===:Raves -8-):===:smile with sunglasses +8-\):===:smile with sunglasses :-/:===:confused --.-:===:bugged ->.<:===:laughing +-\.-:===:bugged +>\.<:===:laughing 8-X:===:skull ->:):===:evil smile ->:-):===:evil smile -\o/:===:Hurray +>:\):===:evil smile +>:-\):===:evil smile +\\o/:===:Hurray :/:===:confused -8):===:smile with sunglasses +8\):===:smile with sunglasses :D:===:laugh -;):===:wink +;\):===:wink XD:===:LOL -:-):===:smile -:):===:smile +:-\):===:smile +:\):===:smile ->:===:arrow right <-:===:arrow left oO:===:WTF? Oo:===:WTF? -^^:===:enjoy smile +\^\^:===:enjoy smile From f676819eaedb881f035e05f207d4f2c829c503cf Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Thu, 29 Aug 2019 12:46:40 -0400 Subject: [PATCH 06/10] Regexp for emoticons. --- config/punctuation/default.conf | 41 ++++++++++++++++----------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/config/punctuation/default.conf b/config/punctuation/default.conf index f99d0d6c..4e127f09 100644 --- a/config/punctuation/default.conf +++ b/config/punctuation/default.conf @@ -48,24 +48,23 @@ _:===:line [emoticonDict] # This dictionary uses regexp, so be sure to escape anything that would be parsed by regexp, e.g. *, ., ^, $, etc. -<{-.-}>:===:Raves -8-\):===:smile with sunglasses -:-/:===:confused --\.-:===:bugged ->\.<:===:laughing -8-X:===:skull ->:\):===:evil smile ->:-\):===:evil smile -\\o/:===:Hurray -:/:===:confused -8\):===:smile with sunglasses -:D:===:laugh -;\):===:wink -XD:===:LOL -:-\):===:smile -:\):===:smile -->:===:arrow right -<-:===:arrow left -oO:===:WTF? -Oo:===:WTF? -\^\^:===:enjoy smile +[\s*|'|"][\s*|'|"]<{-.-}>:===:Raves +[\s*|'|"][\s*|'|"]8-\):===:smile with sunglasses +[\s*|'|"][\s*|'|"]:-/:===:confused +[\s*|'|"][\s*|'|"]-\.-:===:bugged +[\s*|'|"][\s*|'|"]>\.<:===:laughing +[\s*|'|"][\s*|'|"]8-X:===:skull +[\s*|'|"][\s*|'|"]>:\):===:evil smile +[\s*|'|"][\s*|'|"]>:-\):===:evil smile +[\s*|'|"][\s*|'|"]\\o/:===:Hurray +[\s*|'|"][\s*|'|"]:/:===:confused +[\s*|'|"][\s*|'|"]8\):===:smile with sunglasses +[\s*|'|"][\s*|'|"]:D:===:laugh +[\s*|'|"][\s*|'|"];\):===:wink +[\s*|'|"]XD[\s*|'|"]:===:LOL +[\s*|'|"]:-\)[\s*|'|"]:===:smile +[\s*|'|"]:\)[\s*|'|"]:===:smile +[\s*|'|"]->[\s*|'|"]:===:arrow right +[\s*|'|"]<-[\s*|'|"]:===:arrow left +[\s*|'|"][O|o][O|o][\s*|'|"]:===:WTF? +[\s*|'|"]\^\^[\s*|'|"]:===:enjoy smile From 45a27be67992f682fd88a8eeaab5d9a71c525110 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Fri, 30 Aug 2019 07:02:25 -0400 Subject: [PATCH 07/10] Regexp changes for smileys. --- config/punctuation/default.conf | 40 ++++++++++++++++----------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/config/punctuation/default.conf b/config/punctuation/default.conf index 4e127f09..f177c2ac 100644 --- a/config/punctuation/default.conf +++ b/config/punctuation/default.conf @@ -48,23 +48,23 @@ _:===:line [emoticonDict] # This dictionary uses regexp, so be sure to escape anything that would be parsed by regexp, e.g. *, ., ^, $, etc. -[\s*|'|"][\s*|'|"]<{-.-}>:===:Raves -[\s*|'|"][\s*|'|"]8-\):===:smile with sunglasses -[\s*|'|"][\s*|'|"]:-/:===:confused -[\s*|'|"][\s*|'|"]-\.-:===:bugged -[\s*|'|"][\s*|'|"]>\.<:===:laughing -[\s*|'|"][\s*|'|"]8-X:===:skull -[\s*|'|"][\s*|'|"]>:\):===:evil smile -[\s*|'|"][\s*|'|"]>:-\):===:evil smile -[\s*|'|"][\s*|'|"]\\o/:===:Hurray -[\s*|'|"][\s*|'|"]:/:===:confused -[\s*|'|"][\s*|'|"]8\):===:smile with sunglasses -[\s*|'|"][\s*|'|"]:D:===:laugh -[\s*|'|"][\s*|'|"];\):===:wink -[\s*|'|"]XD[\s*|'|"]:===:LOL -[\s*|'|"]:-\)[\s*|'|"]:===:smile -[\s*|'|"]:\)[\s*|'|"]:===:smile -[\s*|'|"]->[\s*|'|"]:===:arrow right -[\s*|'|"]<-[\s*|'|"]:===:arrow left -[\s*|'|"][O|o][O|o][\s*|'|"]:===:WTF? -[\s*|'|"]\^\^[\s*|'|"]:===:enjoy smile +.*[\s*|'|"][\s*|'|"]<{-.-}>.*:===:Raves +.*[\s*|'|"][\s*|'|"]8-\).*:===:smile with sunglasses +.*[\s*|'|"][\s*|'|"]:-/.*:===:confused +.*[\s*|'|"][\s*|'|"]-\.-.*:===:bugged +.*[\s*|'|"][\s*|'|"]>\.<.*:===:laughing +.*[\s*|'|"][\s*|'|"]8-X.*:===:skull +.*[\s*|'|"][\s*|'|"]>:\).*:===:evil smile +.*[\s*|'|"][\s*|'|"]>:-\).*:===:evil smile +.*[\s*|'|"][\s*|'|"]\\o/.*:===:Hurray +.*[\s*|'|"][\s*|'|"]:/.*:===:confused +.*[\s*|'|"][\s*|'|"]8\).*:===:smile with sunglasses +.*[\s*|'|"]:D[\s*|'|"].*:===:laugh +.*[\s*|'|"];\)[\s*|'|"].*:===:wink +.*[\s*|'|"]XD[\s*|'|"].*:===:LOL +.*[\s*|'|"]:-\)[\s*|'|"].*:===:smile +.*[\s*|'|"]:\)[\s*|'|"].*:===:smile +.*[\s*|'|"]->[\s*|'|"].*:===:arrow right +.*[\s*|'|"]<-[\s*|'|"].*:===:arrow left +.*[\s*|'|"][O|o][O|o][\s*|'|"].*:===:WTF? +.*[\s*|'|"]\^\^[\s*|'|"].*:===:enjoy smile From 6dbd82da7139468f67afa02137f75427279c210b Mon Sep 17 00:00:00 2001 From: chrys Date: Fri, 30 Aug 2019 13:57:28 +0200 Subject: [PATCH 08/10] Update default.conf --- config/punctuation/default.conf | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config/punctuation/default.conf b/config/punctuation/default.conf index f177c2ac..9b5e1622 100644 --- a/config/punctuation/default.conf +++ b/config/punctuation/default.conf @@ -65,6 +65,10 @@ _:===:line .*[\s*|'|"]:-\)[\s*|'|"].*:===:smile .*[\s*|'|"]:\)[\s*|'|"].*:===:smile .*[\s*|'|"]->[\s*|'|"].*:===:arrow right +# example for arrow left +#(?:[ |^])(<-)(?:[ ,.!?$]):===:arrow left +# or +#([ |^])<-([ ,.!?$]):===:arrow left\2 .*[\s*|'|"]<-[\s*|'|"].*:===:arrow left .*[\s*|'|"][O|o][O|o][\s*|'|"].*:===:WTF? .*[\s*|'|"]\^\^[\s*|'|"].*:===:enjoy smile From 572435bd124cea0b2f02826fcc772ec8a943ae4a Mon Sep 17 00:00:00 2001 From: Michael Taboada Date: Fri, 11 Oct 2019 05:59:14 -0700 Subject: [PATCH 09/10] Try to fix emoticons for regex --- config/punctuation/default.conf | 40 +++++++++---------- .../core/punctuationManager.py | 2 +- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/config/punctuation/default.conf b/config/punctuation/default.conf index 9b5e1622..22cdc00e 100644 --- a/config/punctuation/default.conf +++ b/config/punctuation/default.conf @@ -48,27 +48,27 @@ _:===:line [emoticonDict] # This dictionary uses regexp, so be sure to escape anything that would be parsed by regexp, e.g. *, ., ^, $, etc. -.*[\s*|'|"][\s*|'|"]<{-.-}>.*:===:Raves -.*[\s*|'|"][\s*|'|"]8-\).*:===:smile with sunglasses -.*[\s*|'|"][\s*|'|"]:-/.*:===:confused -.*[\s*|'|"][\s*|'|"]-\.-.*:===:bugged -.*[\s*|'|"][\s*|'|"]>\.<.*:===:laughing -.*[\s*|'|"][\s*|'|"]8-X.*:===:skull -.*[\s*|'|"][\s*|'|"]>:\).*:===:evil smile -.*[\s*|'|"][\s*|'|"]>:-\).*:===:evil smile -.*[\s*|'|"][\s*|'|"]\\o/.*:===:Hurray -.*[\s*|'|"][\s*|'|"]:/.*:===:confused -.*[\s*|'|"][\s*|'|"]8\).*:===:smile with sunglasses -.*[\s*|'|"]:D[\s*|'|"].*:===:laugh -.*[\s*|'|"];\)[\s*|'|"].*:===:wink -.*[\s*|'|"]XD[\s*|'|"].*:===:LOL -.*[\s*|'|"]:-\)[\s*|'|"].*:===:smile -.*[\s*|'|"]:\)[\s*|'|"].*:===:smile -.*[\s*|'|"]->[\s*|'|"].*:===:arrow right +[\s*|'|"][\s*|'|"]<{-.-}>:===:Raves +[\s*|'|"][\s*|'|"]8-\):===:smile with sunglasses +[\s*|'|"][\s*|'|"]:-/:===:confused +[\s*|'|"][\s*|'|"]-\.-:===:bugged +[\s*|'|"][\s*|'|"]>\.<:===:laughing +[\s*|'|"][\s*|'|"]8-X:===:skull +[\s*|'|"][\s*|'|"]>:\):===:evil smile +[\s*|'|"][\s*|'|"]>:-\):===:evil smile +[\s*|'|"][\s*|'|"]\\o/:===:Hurray +[\s*|'|"][\s*|'|"]:/:===:confused +[\s*|'|"][\s*|'|"]8\):===:smile with sunglasses +[\s*|'|"]:D[\s*|'|"]:===:laugh +[\s*|'|"];\)[\s*|'|"]:===:wink +[\s*|'|"]XD[\s*|'|"]:===:LOL +[\s*|'|"]:-\)[\s*|'|"]:===:smile +[\s*|'|"]:\)[\s*|'|"]:===:smile +[\s*|'|"]->[\s*|'|"]:===:arrow right # example for arrow left #(?:[ |^])(<-)(?:[ ,.!?$]):===:arrow left # or #([ |^])<-([ ,.!?$]):===:arrow left\2 -.*[\s*|'|"]<-[\s*|'|"].*:===:arrow left -.*[\s*|'|"][O|o][O|o][\s*|'|"].*:===:WTF? -.*[\s*|'|"]\^\^[\s*|'|"].*:===:enjoy smile +[\s*|'|"]<-[\s*|'|"]:===:arrow left +[\s*|'|"][O|o][O|o][\s*|'|"]:===:WTF? +[\s*|'|"]\^\^[\s*|'|"]:===:enjoy smile diff --git a/src/fenrirscreenreader/core/punctuationManager.py b/src/fenrirscreenreader/core/punctuationManager.py index 767d62ae..57416204 100644 --- a/src/fenrirscreenreader/core/punctuationManager.py +++ b/src/fenrirscreenreader/core/punctuationManager.py @@ -50,7 +50,7 @@ class punctuationManager(): if ' ' in punctuation: resultText = resultText.replace(' ',' ' + punctuationDict[' '] + ' ') for key,item in punctuationDict.items(): - if key in punctuation and key not in ' ': + if (punctuation != '' and key in punctuation) and key not in ' ': if self.env['runtime']['settingsManager'].getSetting('general', 'respectPunctuationPause') and \ len(key) == 1 and \ key in "',.;:?!": From 7749be508e6ecfbe1738cf1f42f761dc980435d1 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Wed, 16 Oct 2019 17:54:18 -0400 Subject: [PATCH 10/10] Fixed up punct dictionaries for all language files. They will still need to be translated. --- config/punctuation/de.conf | 31 +++++++++++++++++++++++++------ config/punctuation/en.conf | 31 +++++++++++++++++++++++++------ config/punctuation/es.conf | 31 +++++++++++++++++++++++++------ config/punctuation/fr.conf | 31 +++++++++++++++++++++++++------ config/punctuation/pl.conf | 31 +++++++++++++++++++++++++------ 5 files changed, 125 insertions(+), 30 deletions(-) diff --git a/config/punctuation/de.conf b/config/punctuation/de.conf index 7e63dfc6..81f33903 100644 --- a/config/punctuation/de.conf +++ b/config/punctuation/de.conf @@ -44,10 +44,29 @@ _:===:Lienie unten =:===:Istgleich [customDict] - [emoticonDict] -:):===:Grins -;):===:Zwinker -XD:===:loool -:D:===:Lach -<{-.-}>:===:Raves +# This dictionary uses regexp, so be sure to escape anything that would be parsed by regexp, e.g. *, ., ^, $, etc. +[\s*|'|"][\s*|'|"]<{-.-}>:===:Raves +[\s*|'|"][\s*|'|"]8-\):===:smile with sunglasses +[\s*|'|"][\s*|'|"]:-/:===:confused +[\s*|'|"][\s*|'|"]-\.-:===:bugged +[\s*|'|"][\s*|'|"]>\.<:===:laughing +[\s*|'|"][\s*|'|"]8-X:===:skull +[\s*|'|"][\s*|'|"]>:\):===:evil smile +[\s*|'|"][\s*|'|"]>:-\):===:evil smile +[\s*|'|"][\s*|'|"]\\o/:===:Hurray +[\s*|'|"][\s*|'|"]:/:===:confused +[\s*|'|"][\s*|'|"]8\):===:smile with sunglasses +[\s*|'|"]:D[\s*|'|"]:===:laugh +[\s*|'|"];\)[\s*|'|"]:===:wink +[\s*|'|"]XD[\s*|'|"]:===:LOL +[\s*|'|"]:-\)[\s*|'|"]:===:smile +[\s*|'|"]:\)[\s*|'|"]:===:smile +[\s*|'|"]->[\s*|'|"]:===:arrow right +# example for arrow left +#(?:[ |^])(<-)(?:[ ,.!?$]):===:arrow left +# or +#([ |^])<-([ ,.!?$]):===:arrow left\2 +[\s*|'|"]<-[\s*|'|"]:===:arrow left +[\s*|'|"][O|o][O|o][\s*|'|"]:===:WTF? +[\s*|'|"]\^\^[\s*|'|"]:===:enjoy smile diff --git a/config/punctuation/en.conf b/config/punctuation/en.conf index 21e51c02..005a7bb7 100644 --- a/config/punctuation/en.conf +++ b/config/punctuation/en.conf @@ -44,10 +44,29 @@ _:===:line =:===:equals [customDict] - [emoticonDict] -:):===:smile -;):===:twinker -XD:===:loool -:D:===:lought -<{-.-}>:===:Raves +# This dictionary uses regexp, so be sure to escape anything that would be parsed by regexp, e.g. *, ., ^, $, etc. +[\s*|'|"][\s*|'|"]<{-.-}>:===:Raves +[\s*|'|"][\s*|'|"]8-\):===:smile with sunglasses +[\s*|'|"][\s*|'|"]:-/:===:confused +[\s*|'|"][\s*|'|"]-\.-:===:bugged +[\s*|'|"][\s*|'|"]>\.<:===:laughing +[\s*|'|"][\s*|'|"]8-X:===:skull +[\s*|'|"][\s*|'|"]>:\):===:evil smile +[\s*|'|"][\s*|'|"]>:-\):===:evil smile +[\s*|'|"][\s*|'|"]\\o/:===:Hurray +[\s*|'|"][\s*|'|"]:/:===:confused +[\s*|'|"][\s*|'|"]8\):===:smile with sunglasses +[\s*|'|"]:D[\s*|'|"]:===:laugh +[\s*|'|"];\)[\s*|'|"]:===:wink +[\s*|'|"]XD[\s*|'|"]:===:LOL +[\s*|'|"]:-\)[\s*|'|"]:===:smile +[\s*|'|"]:\)[\s*|'|"]:===:smile +[\s*|'|"]->[\s*|'|"]:===:arrow right +# example for arrow left +#(?:[ |^])(<-)(?:[ ,.!?$]):===:arrow left +# or +#([ |^])<-([ ,.!?$]):===:arrow left\2 +[\s*|'|"]<-[\s*|'|"]:===:arrow left +[\s*|'|"][O|o][O|o][\s*|'|"]:===:WTF? +[\s*|'|"]\^\^[\s*|'|"]:===:enjoy smile diff --git a/config/punctuation/es.conf b/config/punctuation/es.conf index f95d3c73..8bfe9612 100644 --- a/config/punctuation/es.conf +++ b/config/punctuation/es.conf @@ -44,10 +44,29 @@ _:===:subrayado =:===:igual [customDict] - [emoticonDict] -:):===:sonrisa -;):===:twinker -XD:===:loool -:D:===:lought -<{-.-}>:===:Raves +# This dictionary uses regexp, so be sure to escape anything that would be parsed by regexp, e.g. *, ., ^, $, etc. +[\s*|'|"][\s*|'|"]<{-.-}>:===:Raves +[\s*|'|"][\s*|'|"]8-\):===:smile with sunglasses +[\s*|'|"][\s*|'|"]:-/:===:confused +[\s*|'|"][\s*|'|"]-\.-:===:bugged +[\s*|'|"][\s*|'|"]>\.<:===:laughing +[\s*|'|"][\s*|'|"]8-X:===:skull +[\s*|'|"][\s*|'|"]>:\):===:evil smile +[\s*|'|"][\s*|'|"]>:-\):===:evil smile +[\s*|'|"][\s*|'|"]\\o/:===:Hurray +[\s*|'|"][\s*|'|"]:/:===:confused +[\s*|'|"][\s*|'|"]8\):===:smile with sunglasses +[\s*|'|"]:D[\s*|'|"]:===:laugh +[\s*|'|"];\)[\s*|'|"]:===:wink +[\s*|'|"]XD[\s*|'|"]:===:LOL +[\s*|'|"]:-\)[\s*|'|"]:===:smile +[\s*|'|"]:\)[\s*|'|"]:===:smile +[\s*|'|"]->[\s*|'|"]:===:arrow right +# example for arrow left +#(?:[ |^])(<-)(?:[ ,.!?$]):===:arrow left +# or +#([ |^])<-([ ,.!?$]):===:arrow left\2 +[\s*|'|"]<-[\s*|'|"]:===:arrow left +[\s*|'|"][O|o][O|o][\s*|'|"]:===:WTF? +[\s*|'|"]\^\^[\s*|'|"]:===:enjoy smile diff --git a/config/punctuation/fr.conf b/config/punctuation/fr.conf index ff36dffd..475db2be 100644 --- a/config/punctuation/fr.conf +++ b/config/punctuation/fr.conf @@ -44,10 +44,29 @@ _:===:souligné =:===:égale à [customDict] - [emoticonDict] -:):===:sourire -;):===:clin d'oeil -XD:===:explosé de rire -:D:===:rire -<{-.-}>:===:Raves +# This dictionary uses regexp, so be sure to escape anything that would be parsed by regexp, e.g. *, ., ^, $, etc. +[\s*|'|"][\s*|'|"]<{-.-}>:===:Raves +[\s*|'|"][\s*|'|"]8-\):===:smile with sunglasses +[\s*|'|"][\s*|'|"]:-/:===:confused +[\s*|'|"][\s*|'|"]-\.-:===:bugged +[\s*|'|"][\s*|'|"]>\.<:===:laughing +[\s*|'|"][\s*|'|"]8-X:===:skull +[\s*|'|"][\s*|'|"]>:\):===:evil smile +[\s*|'|"][\s*|'|"]>:-\):===:evil smile +[\s*|'|"][\s*|'|"]\\o/:===:Hurray +[\s*|'|"][\s*|'|"]:/:===:confused +[\s*|'|"][\s*|'|"]8\):===:smile with sunglasses +[\s*|'|"]:D[\s*|'|"]:===:laugh +[\s*|'|"];\)[\s*|'|"]:===:wink +[\s*|'|"]XD[\s*|'|"]:===:LOL +[\s*|'|"]:-\)[\s*|'|"]:===:smile +[\s*|'|"]:\)[\s*|'|"]:===:smile +[\s*|'|"]->[\s*|'|"]:===:arrow right +# example for arrow left +#(?:[ |^])(<-)(?:[ ,.!?$]):===:arrow left +# or +#([ |^])<-([ ,.!?$]):===:arrow left\2 +[\s*|'|"]<-[\s*|'|"]:===:arrow left +[\s*|'|"][O|o][O|o][\s*|'|"]:===:WTF? +[\s*|'|"]\^\^[\s*|'|"]:===:enjoy smile diff --git a/config/punctuation/pl.conf b/config/punctuation/pl.conf index 59356403..75152d0c 100644 --- a/config/punctuation/pl.conf +++ b/config/punctuation/pl.conf @@ -44,10 +44,29 @@ _:===:podkreślnik =:===:równa się [customDict] - [emoticonDict] -:):===:smile -;):===:twinker -XD:===:loool -:D:===:lought -<{-.-}>:===:Raves +# This dictionary uses regexp, so be sure to escape anything that would be parsed by regexp, e.g. *, ., ^, $, etc. +[\s*|'|"][\s*|'|"]<{-.-}>:===:Raves +[\s*|'|"][\s*|'|"]8-\):===:smile with sunglasses +[\s*|'|"][\s*|'|"]:-/:===:confused +[\s*|'|"][\s*|'|"]-\.-:===:bugged +[\s*|'|"][\s*|'|"]>\.<:===:laughing +[\s*|'|"][\s*|'|"]8-X:===:skull +[\s*|'|"][\s*|'|"]>:\):===:evil smile +[\s*|'|"][\s*|'|"]>:-\):===:evil smile +[\s*|'|"][\s*|'|"]\\o/:===:Hurray +[\s*|'|"][\s*|'|"]:/:===:confused +[\s*|'|"][\s*|'|"]8\):===:smile with sunglasses +[\s*|'|"]:D[\s*|'|"]:===:laugh +[\s*|'|"];\)[\s*|'|"]:===:wink +[\s*|'|"]XD[\s*|'|"]:===:LOL +[\s*|'|"]:-\)[\s*|'|"]:===:smile +[\s*|'|"]:\)[\s*|'|"]:===:smile +[\s*|'|"]->[\s*|'|"]:===:arrow right +# example for arrow left +#(?:[ |^])(<-)(?:[ ,.!?$]):===:arrow left +# or +#([ |^])<-([ ,.!?$]):===:arrow left\2 +[\s*|'|"]<-[\s*|'|"]:===:arrow left +[\s*|'|"][O|o][O|o][\s*|'|"]:===:WTF? +[\s*|'|"]\^\^[\s*|'|"]:===:enjoy smile