hadley / emo

Easily insert emoji into R and RMarkdown

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

๐Ÿ™ƒ Add a function that will replace each letter with an emoji

LucyMcGowan opened this issue ยท comments

An ode to my favorite princess.
Carrie Fisher often wrote in emojis by replacing each letter with an emoji that resembled it. For example,

emo::ji_fisher("without you I would just be a weird chick in a hat")
#> ใ€ฐโ„นโœ๏ธโ™“๏ธ๐Ÿ…พ๏ธโ›Žโœ๏ธ โœŒ๐Ÿป๏ธ๐Ÿ…พ๏ธโ›Ž โ„น ใ€ฐ๐Ÿ…พ๏ธโ›Ž๐Ÿ•’d ๐ŸŒถโ›Ž๐Ÿ’ฒโœ๏ธ ๐Ÿ…ฑ๏ธ๐Ÿ“ง๐Ÿ…ฐ๏ธ ใ€ฐโ„น๐Ÿ“งยฎd ยฉโ™“๏ธโ„นยฉ๐ŸŽ‹ โ„น๏ธโ™‘๏ธ ๐Ÿ…ฐ๏ธ โ™“๏ธ๐Ÿ…ฐ๏ธโœ๏ธ

ref: tweet

emo::ji_fisher("Im supposed to tell you to buy my book, but Im not really like that!")
#> โ„นโ™๏ธ ๐Ÿ’ฒโ›Ž๐Ÿ…ฟ๏ธ๐Ÿ…ฟ๏ธ๐Ÿ…พ๏ธ๐Ÿ’ฒ๐Ÿ“งd โœ๏ธ๐Ÿ…พ๏ธ โœ๏ธ๐Ÿ“ง๐Ÿ•’๐Ÿ•’ โœŒ๐Ÿป๏ธ๐Ÿ…พ๏ธโ›Ž โœ๏ธ๐Ÿ…พ๏ธ ๐Ÿ…ฑ๏ธโ›ŽโœŒ๐Ÿป๏ธ โ™๏ธโœŒ๐Ÿป๏ธ ๐Ÿ…ฑ๏ธ๐Ÿ…พ๏ธ๐Ÿ…พ๏ธ๐ŸŽ‹, ๐Ÿ…ฑ๏ธโ›Žโœ๏ธ โ„นโ™๏ธ โ™‘๏ธ๐Ÿ…พ๏ธโœ๏ธ ยฎ๐Ÿ“ง๐Ÿ…ฐ๏ธ๐Ÿ•’๐Ÿ•’โœŒ๐Ÿป๏ธ ๐Ÿ•’โ„น๐ŸŽ‹๐Ÿ“ง โœ๏ธโ™“๏ธ๐Ÿ…ฐ๏ธโœ๏ธโ•

ref: tweet

emo::ji_fisher("I love the new rstudio")
#> โ„น๏ธ   ๐Ÿ‘โค๏ธโœŒ๏ธ๐Ÿ“ง  ๐ŸŒดโ™“๏ธ๐Ÿ“ง  ๐Ÿ†•   ยฎ๏ธโšก๏ธ๐ŸŒดโ›Žโ†ฉ๏ธโ„น๏ธโญ•๏ธ

A bit similar to #5, but different in that rather than replace full words, it would just replace letters.

That'd be cool.
This would allow me to participate to slack://ropensci#allemoji

Are all those emojis ? or do we need to also poke into other unicode planes, e.g.

> filter( uni::code, str_detect(description, "registered") )
# A tibble: 1 x 7
     id   rune                                   description              block countries languages  type
  <int>  <chr>                                         <chr>              <chr>     <chr>     <chr> <chr>
1   174 U+00AE  Registered Sign : registered trade mark sign latin-1-supplement      <NA>      <NA>  <NA>

Some of Carrie's weren't emojis, but I think as a first pass we can just use emojis? I have at least a 1:1 alphabet to emoji mapping I generally use I can write up.

cool. It does not necessarily need to be 1:1 some letters (o) might have many proxy emojis .. ji_fisher could randomly select one

Here is a start of the mapping ๐Ÿ‘ธ (I ended up sticking it in a ๐Ÿ“ฆ so it's easier to play with, but it is only a small dataset + function)

Would you prepare a PR for emo ?

Cple of things though:

  • please use purrr instead of sapply
  • return a string w class "emoji" instead of directly cat it, print.emoji will cat it. It makes the function

Yep! How would you like the data saved? Right now I create a tibble, turn it into a list, and then export that.

That sounds fine