Learn R Programming

wordvector (version 0.6.1)

probability: Compute probability of words

Description

Compute the probability of words given other words.

Usage

probability(
  x,
  targets,
  layer = c("words", "documents"),
  mode = c("character", "numeric"),
  ...
)

Value

a matrix of words or documents sorted in descending order by the probability scores when mode = "character"; a matrix of the probability scores when mode = "numeric". When targets is a named numeric vector, probability scores are weighted by the values.

Arguments

x

a trained textmodel_wordvector object.

targets

words for which probabilities are computed.

layer

the layer based on which probabilities are computed.

mode

specify the type of resulting object.

...

passed to as.matrix().

See Also

similarity()