read.vectors: Read VectorSpaceModel

View source: R/matrixFunctions.R

read.vectorsR Documentation

Read VectorSpaceModel

Description

Read a VectorSpaceModel from a file exported from word2vec or a similar output format.

Usage

read.vectors(filename, vectors = guess_n_cols(), binary = NULL, ...)

Arguments

filename

The file to read in.

vectors

The number of dimensions word2vec calculated. Imputed automatically if not specified.

binary

Read in the binary word2vec form. (Wraps 'read.binary.vectors') By default, function guesses based on file suffix.

...

Further arguments passed to read.table or read.binary.vectors. Note that both accept 'nrows' as an argument. Word2vec produces by default frequency sorted output. Therefore 'read.vectors("file.bin", nrows=500)', for example, will return the vectors for the top 500 words. This can be useful on machines with limited memory.

Value

An matrixlike object of class 'VectorSpaceModel'


bmschmidt/wordVectors documentation built on June 2, 2022, 3:53 p.m.