public class Word2VecModel extends java.lang.Object implements scala.Serializable, Saveable
Constructor and Description |
---|
Word2VecModel(scala.collection.immutable.Map<java.lang.String,float[]> model) |
Modifier and Type | Method and Description |
---|---|
scala.Tuple2<java.lang.String,java.lang.Object>[] |
findSynonyms(java.lang.String word,
int num) |
scala.Tuple2<java.lang.String,java.lang.Object>[] |
findSynonyms(Vector vector,
int num) |
protected java.lang.String |
formatVersion()
Current version of model save/load format.
|
scala.collection.immutable.Map<java.lang.String,float[]> |
getVectors() |
static Word2VecModel |
load(SparkContext sc,
java.lang.String path) |
void |
save(SparkContext sc,
java.lang.String path)
Save this model to the given path.
|
Vector |
transform(java.lang.String word) |
scala.collection.immutable.Map<java.lang.String,java.lang.Object> |
wordIndex() |
float[] |
wordVectors() |
public Word2VecModel(scala.collection.immutable.Map<java.lang.String,float[]> model)
public static Word2VecModel load(SparkContext sc, java.lang.String path)
public scala.collection.immutable.Map<java.lang.String,java.lang.Object> wordIndex()
public float[] wordVectors()
protected java.lang.String formatVersion()
Saveable
formatVersion
in interface Saveable
public void save(SparkContext sc, java.lang.String path)
Saveable
This saves: - human-readable (JSON) model metadata to path/metadata/ - Parquet formatted data to path/data/
The model may be loaded using Loader.load
.
public Vector transform(java.lang.String word)
public scala.Tuple2<java.lang.String,java.lang.Object>[] findSynonyms(java.lang.String word, int num)
public scala.Tuple2<java.lang.String,java.lang.Object>[] findSynonyms(Vector vector, int num)
public scala.collection.immutable.Map<java.lang.String,float[]> getVectors()