X-Git-Url: https://git.ao2.it/SaveMySugar/python3-savemysugar.git/blobdiff_plain/88fce7811221c360966eb3af691a719930a2514d..dab7317e13aca92f7364a9015a571ad3a94a42cc:/src/savemysugar/MorseTranslator.py?ds=inline diff --git a/src/savemysugar/MorseTranslator.py b/src/savemysugar/MorseTranslator.py index 8184829..068a0b9 100755 --- a/src/savemysugar/MorseTranslator.py +++ b/src/savemysugar/MorseTranslator.py @@ -138,10 +138,8 @@ 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) return sanitized def char_to_signal(self, character): @@ -161,11 +159,8 @@ class MorseTranslator(object): def sanitize_morse(self, morse): sanitized = re.sub("_", "-", morse) sanitized = re.sub(r"[^\-\.\/]", " ", sanitized) - sanitized = re.sub(r"\|", "/", sanitized) sanitized = re.sub(r"\s+", " ", sanitized) sanitized = re.sub(r"( ?/ ?)+", " / ", sanitized) - sanitized = re.sub(r"^[ /]+", "", sanitized) - sanitized = re.sub(r"[ /]+$", "", sanitized) return sanitized def signal_to_character(self, signal):