tests/testthat/test-tokenize.R

test_that("tokenize works", {
  skip_if_offline()
  skip_on_os(os = "windows", arch = "i386")

  res <- tokenize("Test text.")
  expect_true(tibble::is_tibble(res))
  expect_equal(nrow(res), 2)
  expect_equal(ncol(res), 5)
  expect_true("sent" %in% names(res))
  expect_true("form" %in% names(res))
  expect_true("tag" %in% names(res))
  expect_true("start" %in% names(res))
  expect_true("len" %in% names(res))

  res <- tokenize("Test text.", stopwords = FALSE)
  expect_true(tibble::is_tibble(res))
  expect_equal(nrow(res), 3)
  expect_equal(ncol(res), 5)
  expect_true("sent" %in% names(res))
  expect_true("form" %in% names(res))
  expect_true("tag" %in% names(res))
  expect_true("start" %in% names(res))
  expect_true("len" %in% names(res))
})

Try the elbird package in your browser

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

elbird documentation built on Aug. 12, 2022, 5:08 p.m.