From: Antonio Ospite Date: Mon, 14 Dec 2015 16:38:35 +0000 (+0100) Subject: MorseTranslator.py: fix sanitize_text X-Git-Url: https://git.ao2.it/SaveMySugar/python3-savemysugar.git/commitdiff_plain/475721658d2f3e83eb323e19fde9570e9ebdbd45?ds=inline 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. --- 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)