Word count.

speech_word_count(
  string,
  rm.name = FALSE,
  exclude = NULL,
  min.char = 0L,
  rm.long = Inf,
  rm.num = FALSE,
  replace.punct = ""
)

Arguments

string

character of length equal to or greater than one.

rm.name

by default is FALSE. Remove word 'SENOR' and name of legislator.

exclude

words that are to be excluded from counting.

min.char

integer that determines the words that have less than a certain number of characters.

rm.long

integer that determines the number of characters from which words have to be deleted from the count.

rm.num

logical. Indicates whether the numbers in the count will be eliminated.

replace.punct

by default is "".

Value

integer.

Examples

vec <- "Hello world!"
speech_word_count(vec)
#> [1] NA

vec2 <- "Hello.world!"
speech_word_count(vec2)
#> [1] NA
speech_word_count(vec2, replace.punct = " ")
#> [1] NA

vec3 <- "Hello.world!, HelloHelloHelloHelloHelloHello"
speech_word_count(vec3, replace.punct = " ", rm.long = 20)
#> [1] NA

speech_word_count("R version", min.char = 1)
#> [1] NA

r <- "R version 3.5.2 (2018-12-20) -- 'Eggshell Igloo'"
speech_word_count(r, rm.num = TRUE)
#> [1] NA

speech_word_count(NA)
#> [1] NA

# \donttest{
# url <- "http://bit.ly/35AUVF4"
# out <- speech_build(file = url, compiler = TRUE)
# out$word <- speech_word_count(out$speech, rm.name = TRUE)
# out$word2 <- speech_word_count(out$speech)
# }