inst/tinytest/test_mine_text.R

# setup tinytest for checkmate functionality
library("tinytest")
library("checkmate")
using("checkmate")

# test that 3-grams result in 3 word tokens, requires JAVA system dependency
if (test_directory_exists(Sys.getenv("JAVA_HOME"), access = "r")) {
  d <- mine_text(docs = pubs$title, ngmin = 3L)
  nwords <- as.character(d$term) |>
    strsplit(" ") |>
    vapply(FUN = length, FUN.VALUE = integer(1))
  all(nwords == 3L) |> expect_true()
}

Try the inlpubs package in your browser

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

inlpubs documentation built on April 4, 2025, 1:06 a.m.