tests/testthat/test-tokenize_sents.R

test_that("tokenize_sents works", {

  # skip tests if there is no python installation
  testthat::skip_if(try(suppressMessages(spacyr::spacy_initialize()), silent = TRUE) |>
                      inherits("try-error"),
                    message = "spacyr environment not present")

  toy <- quanteda::corpus("The cat was on the chair. He didn't move\ncat@pets.com;\nhttp://quanteda.io/ test 😻 👍")
  toy.pos <- quanteda::corpus("the N was on the N . he did n't move \n N ; \n N N")

  tokenize_sents(toy) |> expect_snapshot()
  tokenize_sents(toy.pos) |> expect_snapshot()

})

Try the idiolect package in your browser

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

idiolect documentation built on Sept. 11, 2024, 5:34 p.m.