projects
/
SaveMySugar
/
python3-savemysugar.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add tools to plot the symbol distances
[SaveMySugar/python3-savemysugar.git]
/
src
/
savemysugar
/
MorseTranslator.py
diff --git
a/src/savemysugar/MorseTranslator.py
b/src/savemysugar/MorseTranslator.py
index
630aba7
..
068a0b9
100755
(executable)
--- a/
src/savemysugar/MorseTranslator.py
+++ b/
src/savemysugar/MorseTranslator.py
@@
-140,8
+140,6
@@
class MorseTranslator(object):
sanitized = text.lower()
sanitized = re.sub(r"[^a-z0-9.,:?\'-/()\"=\+@ ]", "", sanitized)
sanitized = re.sub(r"\s+", " ", sanitized)
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):
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)
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"\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):
return sanitized
def signal_to_character(self, signal):