sanitized = text.lower()
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):
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):