Pick up your phone! It's vibrating!
JavaScript, 70 63 bytes
2 bytes saved thanks to Luke
a=>a.replace(/./g,a=>[['Rr','rr','-',' - ']['onp '.search(a)]])
Try it online!
Pyke, 22 20 bytes
cFh.o6.&\R*\-|l4)J" -
Try it here!
c - split(input, " ")
Fh.o6.&\R*\-|l4) - for i in ^:
h - ^[0]
.o - ord(^)
6.& - ^ & 6
\R* - ^
\-| - ^ or "-"
l4 - ^.title()
J" - - " - ".join(^)
The crux of this answer is the transformation of ["long", "short", "pause"]
into [4, 2, 0]
. It gets the code point of the first letter of each word and AND
s it with 6. By lucky coincidence it transforms to the values we're looking for. (I searched through quite a few other longer solutions before finding this one). Once that's done, we can further transform that list of ints into ["RRRR", "RR", ""]
by multiplying our int by "R"
which then turns into ["RRRR", "RR", "-"]
and finally title casing it to get ["Rrrr", "Rr", "-"]
. We then join the resulting list by " - "
Haskell, 71 66 59 bytes
g 'o'="Rr"
g 'n'="rr"
g 'p'="-"
g ' '=" - "
g _=""
f=(g=<<)
Try it online!
Oh right, =<<
is concatMap.
Takes advantage of the fact that "long"
and "short"
both have the letter o
.