replace_emoticon: Replace Emoticons With Words

Description Usage Arguments Value Examples

View source: R/replace_emoticon.R

Description

Replaces emoticons with word equivalents.

Usage

1
replace_emoticon(x, emoticon_dt = lexicon::hash_emoticons, ...)

Arguments

x

The text variable.

emoticon_dt

A data.table of emoticons (graphical representations) and corresponding word meanings.

...

Other arguments passed to .mgsub (see textclean:::.mgsub for details).

Value

Returns a vector of strings with emoticons replaced with word equivalents.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
x <- c(
    paste(
        "text from:", 
        "http://www.webopedia.com/quick_ref/textmessageabbreviations_02.asp"
    ),
    "... understanding what different characters used in smiley faces mean:",
    "The close bracket represents a sideways smile  )",
    "Add in the colon and you have sideways eyes   :",
    "Put them together to make a smiley face  :)",
    "Use the dash -  to add a nose   :-)",
    paste(
        "Change the colon to a semi-colon ;", 
        "and you have a winking face ;)  with a nose  ;-)"
    ),
    paste(
        "Put a zero 0 (halo) on top and now you have a winking,", 
        "smiling angel 0;) with a nose 0;-)"
    ),
    "Use the letter 8 in place of the colon for sunglasses 8-)",
    "Use the open bracket ( to turn the smile into a frown  :-("
)

replace_emoticon(x)

Example output

 [1] "text from: http://www.webopedia.com/quick_ref/textmessageabbreviations_02.asp"                
 [2] "... understanding what different characters used in smiley faces mean:"                       
 [3] "The close bracket represents a sideways smile )"                                              
 [4] "Add in the colon and you have sideways eyes :"                                                
 [5] "Put them together to make a smiley face happy "                                               
 [6] "Use the dash - to add a nose happy "                                                          
 [7] "Change the colon to a semi-colon ; and you have a winking face winking with a nose winking "  
 [8] "Put a zero 0 (halo) on top and now you have a winking, smiling angel angel with a nose angel "
 [9] "Use the letter 8 in place of the colon for sunglasses glasses "                               
[10] "Use the open bracket ( to turn the smile into a frown sad "                                   

textclean documentation built on May 2, 2019, 7:22 a.m.