plot_texts: Plot vectors on a 2D plan

Description Usage Arguments Examples

Description

Plot the text on an interactive scatter plot.

Usage

1
plot_texts(coordinates, min_cluster_size = 5)

Arguments

coordinates

data.frame containing 2D coordinates of texts.

min_cluster_size

integer corresponding to the minimum size of a vector (for the colors).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
if(interactive()){
# This example should be run with a higher quality model
# than the one embedded in fastrtext
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)

selected_word <- "out"
df <- retrieve_neighbors(text = selected_word,
                         projection_type = "tsne",
                         annoy_model = annoy_model,
                         n = 1000)
plot_texts(df, 3)
}

projector documentation built on May 2, 2019, 3:42 a.m.