tests/testthat/test-stopwords.R

test_that("old stopwords are the same as the new", {
    load("../data/data_char_stopwords.rda")
    stopwords_old <- function(kind = "english", swdata) {
        if (!(kind %in% names(swdata)))
            stop(paste0("\"", kind, "\" is not a recognized stopword list name."))
        swdata[[kind]]
    }

    expect_equal(
        stopwords_old("english", data_char_stopwords),
        stopwords("english", source = "snowball")
    )
    expect_equal(
        stopwords_old("SMART", data_char_stopwords),
        stopwords("english", source = "smart")
    )
})

Try the quanteda package in your browser

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

quanteda documentation built on May 31, 2023, 8:28 p.m.