tests/testthat/test-extract_sentiment_terms.R

context("Checking extract_sentiment_terms")

test_that("extract_sentiment_terms extracts the terms",{

    suppressWarnings(RNGversion("3.5.0"))
    set.seed(10)
    x <- get_sentences(sample(hu_liu_cannon_reviews[[2]], 3000, TRUE))
    pol_words <- extract_sentiment_terms(x)
    expect_equal(pol_words$negative[1:3], list(character(0), c("wait", "restless", "fire"), character(0)))
})

Try the sentimentr package in your browser

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

sentimentr documentation built on Oct. 12, 2021, 9:06 a.m.