tests/testthat/test-nsyllable.R

test_that("nsyllable.tokens works", {
  toks <- quanteda::tokens("one ten twenty")
  expect_equal(
    nsyllable::nsyllable(toks),
    list(text1 = c(1, 1, 2))
  )
  expect_equal(
    nsyllable::nsyllable(quanteda::tokens_remove(toks, "ten", padding = TRUE)),
    list(text1 = c(1, NA, 2))
  )
})

Try the quanteda.textstats package in your browser

Any scripts or data that you put into this service are public.

quanteda.textstats documentation built on Nov. 2, 2023, 5:07 p.m.