Description Usage Arguments Value Examples
View source: R/replace_emoji.R
Replaces emojis with word equivalents or a token identifier for use in the
sentimentr package. Not that this function will coerce the text to
ASCII using
Encoding(x) <- "latin1"; iconv(x, "latin1", "ASCII", "byte")
.
The function replace_emoji
replaces emojis with text representations
while replace_emoji_identifier
replaces with a unique identifier that
corresponds to lexicon::hash_sentiment_emoji
for use in the
sentimentr package.
1 2 3 | replace_emoji(x, emoji_dt = lexicon::hash_emojis, ...)
replace_emoji_identifier(x, emoji_dt = lexicon::hash_emojis_identifier, ...)
|
x |
The text variable. |
emoji_dt |
A data.table of emojis (ASCII byte representations) and corresponding word/identifier meanings. |
... |
Other arguments passed to |
Returns a vector of strings with emojis replaced with word equivalents.
1 2 3 4 | fls <- system.file("docs/emoji_sample.txt", package = "textclean")
x <- readLines(fls)[1]
replace_emoji(x)
replace_emoji_identifier(x)
|
[1] "Proin smiling face with heart-eyes ut maecenas smirking face condimentum pensive face purus eget. Erat, face with tears of joy vitae nunc elit. Condimentum crying face semper iaculis bibendum sed tellus. Ut suscipit interdum expressionless face in. Faucib disappointed face us nunc quis a vitae posuere. face with tongue Eget amet sit condimentum non. Nascetur vitae frowning face et. Auctor ornare smiling face vestibulum primis justo congue grinning face urna ac magna. Quam sad but relieved face pharetra worried face eros unamused face facilisis ac lectus nibh est kissing face with smiling eyes vehicula neutral face ornare! Vitae, malesuada smiling face with sunglasses erat sociosqu urna, smirking face nec sed ad aliquet face with open mouth ."
[1] "Proin lexiconwiutsdotskrupggpgmhm ut maecenas lexiconwizbukzesopzflfinotj condimentum lexiconwlnxqescoesytfatoevi purus eget. Erat, lexiconwcaiviebiytolowkanmb vitae nunc elit. Condimentum lexiconwpujksvgujncexktvyrn semper iaculis bibendum sed tellus. Ut suscipit interdum lexiconwknnasgueiicggptyzbx in. Faucib lexiconwoxfeslcareuqfkbyjgy us nunc quis a vitae posuere. lexiconwobmhqdrrzgygdexhnkk Eget amet sit condimentum non. Nascetur vitae lexiconbfalxvockmnmtmycmwyq et. Auctor ornare lexiconbgmujofaalvxqrklfqgd vestibulum primis justo congue lexiconvygwtlyrpywfarytvfis urna ac magna. Quam lexiconwurhpvewhizayynmfxqo pharetra lexiconwpmuduwgbxxrxeltrueb eros lexiconwkrvakxddtqckcjxeksl facilisis ac lectus nibh est lexiconwmsjgfnelqfeyhgudmfj vehicula lexiconwjfhkpcsgcjtotwlapxa ornare! Vitae, malesuada lexiconwivnupleicqgksianinp erat sociosqu urna, lexiconwizbukzesopzflfinotj nec sed ad aliquet lexiconxbwhfeflxbuupjezgdwl ."
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.