tests/testthat/test_RePair_via_decompression.R

sax_string = paste(
              unlist(sax_via_window(ecg0606, 160, 4, 4, "none", 0.001)),
              collapse = " "
             )

test_that("find discord with HOT SAX", {

  grammar <- str_to_repair_grammar(sax_string)

  uncompressed_R0 = paste(grammar[[1]]$rule_string, " ", sep = "")

  while (grepl("R", uncompressed_R0)) {
    for (i in c(2:length(grammar))) {
      uncompressed_R0 = gsub(
        paste(" R", i - 1, " ", sep = ""),
        paste(" ", grammar[[i]]$expanded_rule_string, " ", sep = ""),
        uncompressed_R0
      )
    }
  }

  expect_equal(sax_string, sub("\\s+$", "", uncompressed_R0))

})

Try the jmotif package in your browser

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

jmotif documentation built on March 26, 2020, 7:23 p.m.