textmodel_* crash when a DFM has no features. We should add a check and raise error like "dfm must have at least one non-zero feature" instead.
(emptydfm <- dfm_trim(data_dfm_lbgexample, 1000))
# Document-feature matrix of: 6 documents, 0 features.
# 6 x 0 sparse Matrix of class "dfm"
# features
# docs
# R1
# R2
# R3
# R4
# R5
# V1
textmodel_wordscores(emptydfm, c(seq(-1.5, 1.5, .75), NA))
# Error in as(e1, "dgCMatrix")/e2 : <Matrix> / numeric(0) is undefined
textmodel_wordfish(emptydfm)
# Error in qatd_cpp_wordfish_dense(as.matrix(x), as.integer(dir), 1/(priors^2), : mean(): object has no elements
textmodel_*crash when a DFM has no features. We should add a check and raise error like "dfm must have at least one non-zero feature" instead.