When working with online text data such as twitter messages, Emoji Unicodes are often included as part of the data. Emoji characters are rich with underlying symbols, meanings, and expressions, but have been neglected in traditional text mining analysis.
The emoji package is capable of the following:
tidytext package.Plot image of the Emoji given its Unicode.
Search Emoji based on keywords.
The data of the current package comes from Emoji List v5.0. The table from the web page is contained in data(emoji_v5.0). The data set consist of the following information:
library(emoji)
data("emoji_v5.0")
emojiemoji_info()The intention of the emoji package is to reflect the information of the Emoji while conducting text analysis. The package minizie the information loss by providing names, keywords, and categories of Emoji. While the previously listed data are basic materials provided by the Unicode Consortium, the package goes a step further by providing sentiment of the given Emoji unicode using the get_sentiment() function from the tidytext package. Also, the categories assigned by the Unicode Consortium is very limited, thus additional categories are implemented by the author. Function, emoji_info(), is the tool to derive the mentioned information.
unicode Unicode of an Emoji character.
lexicon_type type of lexicon to be used for sentiment and score. This feature is based on the tidytext package and the following three types are available: bing, nrc, and afinn. The default lexicon dictionary is bing. Learn more about tidytext package and get_sentiment() function at https://cran.r-project.org/web/packages/tidytext/tidytext.pdf.
name Name of the Emoji assigned by the Unicode Consortium.
sentiment_and _score sentiment and score of the Emoji by the get_sentiment() function from the tidytext package.
categories Categories of the Emoji assigned by the Unicode Consortium.
categories2 Categories of the Emoji assigned by the author of this package.
emoji_info("U+1F600")$name
[1] "grinning face"
$score
[1] "positive"
$categories
[1] "smileys_&_people" "face" "positive"
$categories2
[1] "expression" "positive expression" "face"
[4] "grin"
attr(,"class")
[1] "list" "emoji_info"
emoji_info("U+1F601", "afinn")$name
[1] "beaming face with smiling eyes"
$score
[1] "2"
$categories
[1] "smileys_&_people" "face" "positive"
$categories2
[1] "expression" "positive expression" "eye"
[4] "face" "grin" "smile"
attr(,"class")
[1] "list" "emoji_info"
plot_emoji()When Emoji is collected as text data, it is often saved as a code; mainly in “UTF-8”, but could be in other encoding formats. Considering that Emoji a pictogram, one can cast an image of a Emoji character by using plot_emoji() function.
unicode Unicode of an Emoji character.emoji_plot("U+1F600")emoji_info_table()char_string A single character string that may contain zero or more Emoji character
lexicon_type type of lexicon to be used for sentiment and score. This feature is based on the tidytext package and the following three types are available: bing, nrc, and afinn. The default lexicon dictionary is bing. Learn more about tidytext package and get_sentiment() function at https://cran.r-project.org/web/packages/tidytext/tidytext.pdf.
uni_code Unicode of the Emoji used in the string.
count Number of each Emoji used in the string.
name Name of each Emoji used in the string.
score sentiment or score of each Emoji used in the string.
categories Categories of each Emoji used in the string. The categories are assigned by the Unicode Consortium.
categories2 Similar to categories, but it was assigned by the author of the package.
a_string="Obviously #hateher U+1f495 U+1f60f U+1f469 @ Los Angeles, California https://www.instagram.com/p/BCbPSxxGVua/"
emoji_info_table(a_string)# A tibble: 3 x 6
uni_code count name score categories
<chr> <int> <chr> <chr> <chr>
1 U+1F469 1 woman neutral smileys_&_people, person
2 U+1F495 1 two hearts positive smileys_&_people, emotion
3 U+1F60F 1 smirking face neutral smileys_&_people, face, neutral
# ... with 1 more variables: categories2 <chr>
emoji_info_table(a_string, "afinn")# A tibble: 3 x 6
uni_code count name score categories
<chr> <int> <chr> <chr> <chr>
1 U+1F469 1 woman smileys_&_people, person
2 U+1F495 1 two hearts 3 smileys_&_people, emotion
3 U+1F60F 1 smirking face smileys_&_people, face, neutral
# ... with 1 more variables: categories2 <chr>