Vector_Puller: Function for extacting word vectors from embeddings.

Description Usage Arguments Details Value Author(s) Examples

View source: R/Personal_Functions.R

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

1
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

1
2
3
4
5
# 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)

LilRhino documentation built on Oct. 31, 2019, 4:59 p.m.