Distance is equal to 1 - cosine
get_word_distance(model, w1, w2)
| model | trained fastText model. Null if train a new model. |
|---|---|
| w1 | first word to compare |
| w2 | second word to compare |
a scalar with the distance
library(fastrtext) model_test_path <- system.file("extdata", "model_unsupervised_test.bin", package = "fastrtext") model <- load_model(model_test_path) get_word_distance(model, "time", "timing")#> [,1] #> [1,] 0.5868116