Clean Text
Usage
tm_clean_text(
x,
lowercase = TRUE,
numbers = TRUE,
punctuation = TRUE,
spaces = TRUE,
ascii = TRUE,
remove_stopwords = FALSE,
remove_custom = NULL,
lemmatize = FALSE,
match_dictionary = FALSE
)Arguments
- x
A character string
- lowercase
Makes text lower case
- numbers
Removes numbers
- punctuation
Removes punctuation
- spaces
Removes spaces
- ascii
Removes non-ascii strings
- remove_stopwords
Removes stopwords
- remove_custom
Remove a custom input of words
- lemmatize
Brings all word back to it's original form
- match_dictionary
Keeps only words that are inside the [qdapDictionaries::GradyAugmented] dictionary dataset
Examples
some_text <- "Hi!, This is just 1 stupid EXAMPLE to show clean.text :) [123-456-789]"
# default application
tm_clean_text(some_text)
#> [1] "hi this is just stupid example to show clean text"
tm_clean_text(some_text, remove_stopwords = TRUE)
#> [1] "stupid show clean text"
tm_clean_text(some_text, remove_stopwords = FALSE, lemmatize = TRUE)
#> [1] "hello this be just stupid example to show clean text"