Create a new textmodel_lss object from an existing or foreign objects.
as.textmodel_lss(x, ...)# S3 method for matrix
as.textmodel_lss(
x,
seeds,
terms = NULL,
slice = NULL,
simil_method = "cosine",
auto_weight = FALSE,
verbose = FALSE,
...
)
# S3 method for numeric
as.textmodel_lss(x, ...)
# S3 method for textmodel_lss
as.textmodel_lss(x, ...)
# S3 method for textmodel_wordvector
as.textmodel_lss(x, seeds, terms = NULL, verbose = FALSE, spatial = TRUE, ...)
a dummy textmodel_lss object
an object from which a new textmodel_lss object is created. See details.
arguments used to create a new object. seeds must be given
when x is a dense matrix or a fitted textmodel_lss.
a character vector or named numeric vector that contains seed words. If seed words contain "*", they are interpreted as glob patterns. See quanteda::valuetype.
a character vector or named numeric vector that specify words
for which polarity scores will be computed; if a numeric vector, words' polarity
scores will be weighted accordingly; if NULL, all the features in x except
those less frequent than min_count will be used.
a number or indices of the components of word vectors used to
compute similarity; slice < k to further truncate word vectors; useful
for diagnosys and simulation.
specifies method to compute similarity between features.
The value is passed to quanteda.textstats::textstat_simil(), "cosine" is
used otherwise.
automatically determine weights to approximate the polarity of terms to seed words. Deprecated.
show messages if TRUE.
if TRUE, return a spatial model. Otherwise, a probabilistic model.
If x is a textmodel_lss, original word vectors are reused to compute polarity
scores with new seed words. It is also possible to subset word vectors via slice
if it was trained originally using SVD.
If x is a dense matrix, it is treated as a column-oriented word vectors with which
polarity of words are computed. If x is a named numeric vector, the values are treated
as polarity scores of the words in the names.