Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

as.matrix.word2vec

Get the word vectors of a word2vec model


Description

Get the word vectors of a word2vec model as a dense matrix.

Usage

## S3 method for class 'word2vec'
as.matrix(x, encoding = "UTF-8", ...)

Arguments

x

a word2vec model as returned by word2vec or read.word2vec

encoding

set the encoding of the row names to the specified encoding. Defaults to 'UTF-8'.

...

not used

Value

a matrix with the word vectors where the rownames are the words from the model vocabulary

See Also

Examples

path  <- system.file(package = "word2vec", "models", "example.bin")
model <- read.word2vec(path)

embedding <- as.matrix(model)

word2vec

Distributed Representations of Words

v0.3.3
Apache License (>= 2.0)
Authors
Jan Wijffels [aut, cre, cph] (R wrapper), BNOSAC [cph] (R wrapper), Max Fomichev [ctb, cph] (Code in src/word2vec)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.