textclean (version 0.9.3)

replace_internet_slang: Replace Internet Slang

Description

Replaces Internet slang.

Usage

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

Run this code
# NOT RUN {
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]], ' }}')
)
# }

Run the code above in your browser using DataLab