Defines functions count_tokens

Documented in count_tokens

#' counts the frequency of unique tokens
#' @description Call word tokenizer, then count the frequency of each unique word.
#' @usage count_tokens(x)
#' @param x length 1 character vector
#' @return A table of word frequencies
#' @seealso \code{\link{str_split}} \code{\link{boundary}} \code{\link{tokenize}}
#' @examples
#' count_tokens("If this function is working right, it is going to return a count of three for the word, 'is.'")
#' @export count_tokens

  if (length(x)>1){
    stop("count_tokens only accepts length 1 character vectors")
  if (!is.character(x)){
    stop("count_tokens only accepts character vectors")
  tks <- tokenize(x)
markallenthornton/affectr documentation built on Aug. 13, 2018, 12:54 a.m.