replace_internet_slang: Replace Internet Slang

Description Usage Arguments Value Examples

View source: R/replace_internet_slang.R

Description

Replaces Internet slang.

Usage

1
2
3
replace_internet_slang(x, slang = paste0("\\b",
  lexicon::hash_internet_slang[[1]], "\\b"),
  replacement = lexicon::hash_internet_slang[[2]], ignore.case = TRUE, ...)

Arguments

x

The text variable.

slang

A vector of slang strings to replace.

replacement

A vector of string to replace slang with.

ignore.case

logical. If TRUE the case of slang will be ignored (replacement regardless of case).

...

Other arguments passed to replace_tokens.

Value

Returns a vector with names replaced.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
x <- c(
    "Marc the n00b needs to RTFM otherwise ymmv.",
    "TGIF and a big w00t!  The weekend is GR8!",
    "Will will do it",
    'w8...this PITA needs me to say LMGTFY...lmao.',
    NA
)

replace_internet_slang(x)
replace_internet_slang(x, ignore.case = FALSE)
replace_internet_slang(x, replacement = '<<SLANG>>')
replace_internet_slang(
    x, 
    replacement = paste0('{{ ', lexicon::hash_internet_slang[[2]], ' }}')
)

Example output

[1] "Marc the newbie needs to read the fucking manual otherwise your mileage may vary."            
[2] "thank god, it's friday and a big hooray!  The weekend is great!"                              
[3] "Will will do it"                                                                              
[4] "wait...this pain in the ass needs me to say let me google that for you...laughing my ass off."
[5] NA                                                                                             
[1] "Marc the newbie needs to read the fucking manual otherwise ymmv."            
[2] "thank god, it's friday and a big hooray!  The weekend is great!"             
[3] "Will will do it"                                                             
[4] "w8...this pain in the ass needs me to say let me google that for you...lmao."
[5] NA                                                                            
[1] "Marc the <<SLANG>> needs to <<SLANG>> otherwise <<SLANG>>."       
[2] "<<SLANG>> and a big <<SLANG>>!  The weekend is <<SLANG>>!"        
[3] "Will will do it"                                                  
[4] "<<SLANG>>...this <<SLANG>> needs me to say <<SLANG>>...<<SLANG>>."
[5] NA                                                                 
[1] "Marc the {{ newbie }} needs to {{ read the fucking manual }} otherwise {{ your mileage may vary }}."                  
[2] "{{ thank god, it's friday }} and a big {{ hooray }}!  The weekend is {{ great }}!"                                    
[3] "Will will do it"                                                                                                      
[4] "{{ wait }}...this {{ pain in the ass }} needs me to say {{ let me google that for you }}...{{ laughing my ass off }}."
[5] NA                                                                                                                     

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