Perl 5, 195 bytes
194 bytes code + 1 for -p
.
%h=map{$_,(A..Z,0..9)[$i++]}unpack"S26I2S7I","\xd5]u]\xddUw\xd7uww\xdd\xd7]WWwWwuwwwwwWwWUU\xd5uw\xdd\xdd";s/0{7}/ /g;s/(\d+?)(000|\b)/$h{oct"0b$1"}/ge
TIO seems to think this only has 141 bytes, but that isn't right, not sure if that's a bug or what! I couldn't get this working with just a standard packed binary string, I had to escape the higher-byte chars otherwise I'd be on 171, if anyone knows what I've missed, or why it's breaking that'd be great!
Explanation
The binary string is a pack
ed list of the numbers that relate to the morse characters (101011101
- 349
for F
etc) and this is zipped with the ranges A..Z,0..9
and used as a lookup. The s///
expressions replace all runs of seven 0
s with space and then all runs of digits, separated with three 0
s or word boundaries \b
, with their corresponding key from the %h
hash.