Description Usage Arguments Value Examples
View source: R/extract_profanity_terms.R
Extract the profanity words from a text.
1 2 3 4 5 | extract_profanity_terms(
text.var,
profanity_list = unique(tolower(lexicon::profanity_alvarez)),
...
)
|
text.var |
The text variable. Can be a |
profanity_list |
A atomic character vector of profane words. The lexicon package has lists that can be used, including:
|
... |
Ignored. |
Returns a data.table with a columns of profane terms.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | ## Not run:
bw <- sample(lexicon::profanity_alvarez, 4)
mytext <- c(
sprintf('do you %s like this %s? It is %s. But I hate really bad dogs', bw[1], bw[2], bw[3]),
'I am the best friend.',
NA,
sprintf('I %s hate this %s', bw[3], bw[4]),
"Do you really like it? I'm not happy"
)
x <- get_sentences(mytext)
profanity(x)
prof_words <- extract_profanity_terms(x)
prof_words
prof_words$sentence
prof_words$neutral
prof_words$profanity
data.table::as.data.table(prof_words)
attributes(extract_profanity_terms(x))$counts
attributes(extract_profanity_terms(x))$elements
brady <- get_sentences(crowdflower_deflategate)
brady_swears <- extract_profanity_terms(brady)
attributes(extract_profanity_terms(brady))$counts
attributes(extract_profanity_terms(brady))$elements
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.