Open LucyMcGowan opened 7 years ago
Cool thanks for logging it here. I've had a quick look and I only found how to match the codes with pictures, but I need to :bowtie: this to their actual character representations, e.g.
> slice( emo::jis , 1:5 )
# A tibble: 5 x 17
id emoji name category subcategory keywords skin_tone runes
<dbl> <chr> <chr> <chr> <chr> <list> <chr> <list>
1 1 "\U0001f600" grinning face Smileys & People face-positive <chr [2]> <NA> <chr [1]>
2 2 "\U0001f601" beaming face with smiling eyes Smileys & People face-positive <chr [4]> <NA> <chr [1]>
3 3 "\U0001f602" face with tears of joy Smileys & People face-positive <chr [4]> <NA> <chr [1]>
4 4 "\U0001f923" rolling on the floor laughing Smileys & People face-positive <chr [4]> <NA> <chr [1]>
5 5 "\U0001f603" grinning face with big eyes Smileys & People face-positive <chr [4]> <NA> <chr [1]>
# ... with 9 more variables: nrunes <int>, apple <lgl>, google <lgl>, twitter <lgl>, one <lgl>, facebook <lgl>,
# messenger <lgl>, samsung <lgl>, windows <lgl>
I think there are a couple of places that have mapped them (for example, here is python's and here is C's), so maybe we can use that?
Perfect. Should be easy to use one of those. Not sure if this goes in a list column in jis or in a separate simple named chr vector.
The hesitation is bc some have multiple names, eg iirc :poop:
I like the tibble but it might be more practical
Good news from looking at the python link above, they use this to transform some of the names from the unicode names (which we already have in pull( emo::jis, name )
> sample( dplyr::pull( emo::jis, name ), 10 )
[1] "tear-off calendar" "woman juggling: medium-light skin tone" "purse"
[4] "information" "woman climbing: medium skin tone" "baby angel"
[7] "man cartwheeling: medium skin tone" "poultry leg" "South Georgia & South Sandwich Islands"
[10] "input numbers"
so I guess to get started this will be a str_replace_all
exercise in data-raw/jis.R
Then, they use the aliases, defined here
EMOJI_ALIAS_UNICODE = dict(EMOJI_UNICODE.items(), **{
u':admission_tickets:': u'\U0001F39F',
u':aerial_tramway:': u'\U0001F6A1',
u':airplane:': u'\U00002708',
u':airplane_arriving:': u'\U0001F6EC',
u':airplane_departure:': u'\U0001F6EB',
I guess we can parse this somehow, but this also looks generated automatically ...
ah, it looks like it all goes down to this repo: https://github.com/github/gemoji and particularly this file which as a bonus also has information about the version of unicode when the emoji was introduced:
...
{
"emoji": "😀"
, "description": "grinning face"
, "category": "People"
, "aliases": [
"grinning"
]
, "tags": [
"smile"
, "happy"
]
, "unicode_version": "6.1"
, "ios_version": "6.0"
}
...
We now have emo::ji_alias
vector (which might replace emo:::emoji_name
) so :
> cat( emo::ji_alias["grin"] )
😁
I'll simplify ji_glue
to use this
@LucyMcGowan For now I've put this in ji_replace
but not 💍 with the name.
> ji_replace( ":ant: != :santa: " )
🐜 != 🎅
it probably should hint (did you mean ...) when it does not match
Could it just be emo::ji_glue()
? The other thing I was 🤔 is whether it is odd that ordinarily glue uses {parameter}
but we use :parameter:
, the latter I think makes sense because that's how all other places do (i.e.: Slack, GitHub, etc), but worth a thought.
Makes sense for this to be ji_glue, btw it can't actually use glue i think as the begin and end are the same.
I kind of want to keem what i have now as i can do either :cat,face: or :face,cat: ... but i guess for most people, esp who know slack github ... it makes more sense to stick to exact matches.
To be truly great, we need rstudio to show emoji completion. @kevinushey shared some hints about where completion is implemented in rstudio, this might be my excuse to be curious about rstudio internals ...
I think my plan is:
I think it'd be lovely if we could incorporate these emoji codes - used by Slack, GitHub, etc 🎉 👯
@romainfrancois: Here is their GitHub - I haven't poked around much, but can if you think this is worthwhile.