remove_stopwords: Remove stop-words and patterns from character vector

View source: R/text_mining.R

remove_stopwordsR Documentation

Remove stop-words and patterns from character vector

Description

Remove all stop-words and specific patterns from a character vector

Usage

remove_stopwords(text, stop_words, exclude = NULL, sep = " ")

Arguments

text

Character vector

stop_words

Character vector. Words to exclude from text. Example: if you want to exclude "a", whenever that word appears it will be excluded, but when the letter "a" appears in a word, it will remain.

exclude

Character. Pattern to exclude using regex.

sep

Character. String that separate the terms.

Value

Character vector with removed texts.

See Also

Other Text Mining: cleanText(), ngrams(), replaceall(), sentimentBreakdown(), textCloud(), textFeats(), textTokenizer(), topics_rake()

Examples

x <- c("A brown fox jumps over a dog.", "Another brown dog.")
remove_stopwords(x, stop_words = c("dog", "brown", "a"), exclude = "\\.")

laresbernardo/lares documentation built on Oct. 23, 2024, 12:05 p.m.