get_vector_from_text: Retrieve vector representation of an indexed text

Description Usage Arguments Examples

Description

Retrieve from RcppAnnoy the vector related to an indexed text.

Usage

1
get_vector_from_text(text, annoy_model)

Arguments

text

character containing the text

annoy_model

RcppAnnoy model

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
if (interactive()){
library(projector)
library(fastrtext)

model_test_path <- system.file("extdata",
                               "model_unsupervised_test.bin",
                               package = "fastrtext")
model <- load_model(model_test_path)
word_embeddings <- get_word_vectors(model,
                                    words = head(get_dictionary(model), 2e5))

annoy_model <- get_annoy_model(word_embeddings, 5)

print(get_vector_from_text("the", annoy_model))
}

pommedeterresautee/projector documentation built on May 5, 2019, 1:38 p.m.