Description Usage Arguments Value Examples
Find the k
words with the smallest distance.
First execution can be slow because of precomputation.
Search is done linearly, if your model is big you may want to use an approximate neighbour algorithm from other R packages (like RcppAnnoy).
1 | get_nn(model, word, k)
|
model |
trained |
word |
reference word |
k |
integer defining the number of results to return |
numeric with distances with names as words
1 2 3 4 | library(fastrtext)
model_test_path <- system.file("extdata", "model_unsupervised_test.bin", package = "fastrtext")
model <- load_model(model_test_path)
get_nn(model, "time", 10)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.