feat_test <- head(char_context(toks_test, "america*", min_count = 1, p = 0.05), 100)
dict <- dictionary(list("keywords" = c("positive", "bad", "xxxx")))
test_that("textplot_* works with SVD", {
lss <- textmodel_lss(dfmt, seed, k = 10)
expect_equal(class(textplot_terms(lss, highlighted = dict$keywords, max_words = 2)),
expect_equal(class(textplot_terms(lss, highlighted = dict$keywords, max_highlighted = 10)),
expect_equal(class(textplot_terms(lss, highlighted = dict$keywords, max_highlighted = 0)),
expect_equal(class(textplot_terms(lss, max_highlighted = 10)), c("gg", "ggplot"))
lss2 <- textmodel_lss(dfmt, seed, terms = feat_test, k = 10)
test_that("textplot_* works even when frequency and beta do not match (#71)", {
lss$frequency <- c(lss$frequency, "xxx" = 1, "yyy" = 1) # replicate #71
test_that("textplot_* works with Glove", {
lss <- textmodel_lss(fcmt, seed, w = 10)
expect_error(textplot_terms(lss, highlighted = dict, max_words = 100:200),
lss2 <- textmodel_lss(fcmt, seed, terms = feat_test, w = 10)
lss_svd <- textmodel_lss(dfmt, seed, k = 10)
lss_glove <- textmodel_lss(fcmt, seed, w = 10)
gg1 <- textplot_components(lss_svd, n = 5)
gg2 <- textplot_components(lss_svd, n = 3)
expect_equal(class(textplot_components(lss_svd, 3, scale = "relative")), c("gg", "ggplot"))
expect_error(textplot_components(lss_svd, n = c(5, 6)), "The length of n must be 1")
expect_error(textplot_components(lss_svd, n = 20), "The value of n must be between 2 and 10")
expect_error(textplot_components(lss_glove), "SVD must be used to generate word vectors")
test_that("textplot_* raise error when attributes are missing", {
"textplot_simil() does not work with dummy models", fixed = TRUE)
test_that("textplot_terms works even when frequency has zeros (#85)", {

"textplot_* works even when frequency and beta do not match (#71)"
"The value of n must be between 2 and 10"
"SVD must be used to generate word vectors"
"textplot_* raise error when attributes are missing"
"textplot_simil() does not work with dummy models"
"textplot_terms works even when frequency has zeros (#85)"

textplot_* works even when frequency and beta do not match (#71)