From 475721658d2f3e83eb323e19fde9570e9ebdbd45 Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Mon, 14 Dec 2015 17:38:35 +0100 Subject: [PATCH] MorseTranslator.py: fix sanitize_text Use a regex more adherent to the characters actually translated, also follow the order in which the characters appear in the signals table. --- src/savemysugar/MorseTranslator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/savemysugar/MorseTranslator.py b/src/savemysugar/MorseTranslator.py index 8184829..630aba7 100755 --- a/src/savemysugar/MorseTranslator.py +++ b/src/savemysugar/MorseTranslator.py @@ -138,7 +138,7 @@ class MorseTranslator(object): def sanitize_text(self, text): sanitized = text.lower() - sanitized = re.sub(r"[^a-z0-9.,?\'\"/() \-=\+@]", "", sanitized) + sanitized = re.sub(r"[^a-z0-9.,:?\'-/()\"=\+@ ]", "", sanitized) sanitized = re.sub(r"\s+", " ", sanitized) sanitized = re.sub(r"^\s+", "", sanitized) sanitized = re.sub(r"\s+$", "", sanitized) -- 2.1.4