analogy

public final List<Pair<String, Float>> analogy(    String w1,     String w2,     String w3,     Integer N)

Find the N closest terms in the vocab to the analogy:

The algorithm operates as follow:

  • Find a vector approximation of the missing word = vec(w2) - vec(w1) + vec(w3).

  • Return words closest to the approximated vector.

Return

The N closest terms in the vocab to the analogy and their associated cosine similarity scores.

Parameters

w1

First word in the analogy w1 is to w2 as w3 is to ???.

w2

Second word in the analogy w1 is to w2 as w3 is to ???

w3

Third word in the analogy w1 is to w2 as w3 is to ???.

N

The maximum number of terms to return (default to 40).