tests/testthat/test_p_attributes.R

library(polmineR)

use("polmineR")
use(pkg = "RcppCWB", corpus = "REUTERS")

testthat::context("p_attributes")

test_that(
  "p_attributes,character",
  {
    expect_identical(
      p_attributes("GERMAPARLMINI"),
      c("word", "pos")
    )
  }
)


test_that(
  "p_attributes,corpus",
  {
    expect_identical(
      p_attributes(corpus("GERMAPARLMINI")),
      c("word", "pos")
    )
    expect_identical(
      length(p_attributes(corpus("REUTERS"), p_attribute = "word")),
      RcppCWB::cl_lexicon_size("REUTERS", p_attribute = "word", registry = registry())
    )
  }
)

Try the polmineR package in your browser

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

polmineR documentation built on Nov. 2, 2023, 5:52 p.m.