tests/testthat/test_cpos2struc.R

library(RcppCWB)
use_tmp_registry()
testthat::context("cpos2struc")

test_that(
  "cpos2struc",
  {
    N <- cl_cpos2struc(
      corpus = "REUTERS",
      s_attribute = "places",
      cpos = 100L,
      registry = get_tmp_registry()
    )
    expect_equal(N, 1L)
  }
)

test_that(
  "cpos2struc - new like old",
  {
    strucs_old <- cl_cpos2struc(
      corpus = "REUTERS",
      s_attribute = "places",
      cpos = 1:100L,
      registry = get_tmp_registry()
    )
    
    s <- s_attr(corpus = "REUTERS", s_attribute = "places", registry = get_tmp_registry())
    strucs_new <- cpos_to_struc(1:100L, s_attr = s)
  }
)

Try the RcppCWB package in your browser

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

RcppCWB documentation built on Sept. 24, 2024, 1:08 a.m.