From 572435bd124cea0b2f02826fcc772ec8a943ae4a Mon Sep 17 00:00:00 2001 From: Michael Taboada Date: Fri, 11 Oct 2019 05:59:14 -0700 Subject: [PATCH 1/2] 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 2/2] 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