get_word_distance: Distance between two words

Description Usage Arguments Value Examples

View source: R/API.R

Description

Distance is equal to 1 - cosine

Usage

1
get_word_distance(model, w1, w2)

Arguments

model

trained fastText model. Null if train a new model.

w1

first word to compare

w2

second word to compare

Value

a scalar with the distance

Examples

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_word_distance(model, "time", "timing")

fastrtext documentation built on Dec. 10, 2017, 1:03 a.m.