Tokenises text (splitting on whitespace, lower-casing, and stripping
punctuation), removes stop words, and counts term frequency. Ships a
small built-in English stop-word list so this works with zero optional
packages. Pass stop_words = character(0) to disable filtering, or a
custom vector to override it.
Arguments
- text
Character vector of responses (raw or already cleaned by
sframe_clean_text()).- stop_words
Character vector of words to exclude, or
NULLto use the built-in English list, orcharacter(0)for no filtering.- top_n
Integer. Maximum number of terms to return, most frequent first. Default
30.
See also
Other Text analysis functions:
sframe_clean_text(),
sframe_extract_quotes(),
sframe_ngram_frequency(),
sframe_term_context()
Examples
demo <- sframe_demo("tourism_services")
cleaned <- sframe_clean_text(demo$responses, "comments")
head(sframe_term_frequency(cleaned, top_n = 10))