Vector_Puller {LilRhino} | R Documentation |
Function for extacting word vectors from embeddings.
Description
Function for extacting word vectors from embeddings. This function is an internal function for 'Sentence_Puller'. It averages the word vectors and returns the average of these vectors.
Usage
Vector_Puller(words, emb_matrix, dimension)
Arguments
words |
The word to be extracted. |
emb_matrix |
The embeddings matrix. It must be a data frame. |
dimension |
The Dimension of the embeddings to extract. They do not have to match that of the matrix, but they cannot exceed its maximum column count. |
Details
This is a simple and fast internal function.
Value
The vector that corresponds to the average of the word vectors.
Author(s)
Travis Barton
Examples
# This is an example emb_matrix
emb = data.frame(matrix(c(1, 2, 3, 4, 5, 5, 4, 3, 2, 1), nrow = 2), row.names = c('cow', 'moo'))
Vector_Puller(c('cow', 'moo'), emb, 5)
[Package LilRhino version 1.2.2 Index]