public class Word2Vec
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
smile.data.DataFrame |
vectors
The vector space.
|
java.lang.String[] |
words
The vocabulary.
|
| Constructor and Description |
|---|
Word2Vec(java.lang.String[] words,
float[][] vectors)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
float[] |
apply(java.lang.String word)
Returns the vector embedding of a word.
|
int |
dimension()
Returns the dimension of vector space.
|
float[] |
get(java.lang.String word)
Returns the vector embedding of a word.
|
static Word2Vec |
of(java.nio.file.Path file)
Loads a word2vec model from binary file of ByteOrder.LITTLE_ENDIAN.
|
static Word2Vec |
of(java.nio.file.Path file,
java.nio.ByteOrder order)
Loads a word2vec model from binary file.
|
static Word2Vec |
text(java.nio.file.Path file)
Loads a GloVe model from text file.
|
public final java.lang.String[] words
public final smile.data.DataFrame vectors
public Word2Vec(java.lang.String[] words,
float[][] vectors)
words - the vocabulary.vectors - the vectors of d x n, where d is the dimension
and n is the size of vocabulary.public int dimension()
public float[] get(java.lang.String word)
public float[] apply(java.lang.String word)
public static Word2Vec of(java.nio.file.Path file) throws java.io.IOException
java.io.IOExceptionpublic static Word2Vec of(java.nio.file.Path file, java.nio.ByteOrder order) throws java.io.IOException
java.io.IOExceptionpublic static Word2Vec text(java.nio.file.Path file) throws java.io.IOException
java.io.IOException