public class WordVectorSerializer extends Object
Constructor and Description |
---|
WordVectorSerializer() |
Modifier and Type | Method and Description |
---|---|
static WordVectors |
fromPair(Pair<WeightLookupTable,VocabCache> pair)
Load word vectors from the given pair
|
static WordVectors |
fromTableAndVocab(WeightLookupTable table,
VocabCache vocab)
Load word vectors for the given
vocab and table
|
static Word2Vec |
loadGoogleModel(String path,
boolean binary)
Loads the google model
|
static Pair<WeightLookupTable,VocabCache> |
loadTxt(File path)
Loads an in memory cache from the given path (sets syn0 and the vocab)
|
static WordVectors |
loadTxtVectors(File path)
Loads an in memory cache from the given path (sets syn0 and the vocab)
|
static void |
writeTsneFormat(Glove vec,
org.nd4j.linalg.api.ndarray.INDArray tsne,
File csv)
Write the tsne format
|
static void |
writeTsneFormat(Word2Vec vec,
org.nd4j.linalg.api.ndarray.INDArray tsne,
File csv)
Write the tsne format
|
static void |
writeWordVectors(InMemoryLookupTable l,
InMemoryLookupCache cache,
String path)
Writes the word vectors to the given path.
|
static void |
writeWordVectors(Word2Vec vec,
String path)
Writes the word vectors to the given path.
|
public static Word2Vec loadGoogleModel(String path, boolean binary) throws IOException
path
- the path to the google modelIOException
public static void writeWordVectors(InMemoryLookupTable l, InMemoryLookupCache cache, String path) throws IOException
path
- the path to writeIOException
public static void writeWordVectors(Word2Vec vec, String path) throws IOException
vec
- the word2vec to writepath
- the path to writeIOException
public static WordVectors fromTableAndVocab(WeightLookupTable table, VocabCache vocab)
table
- the weights to usevocab
- the vocab to usepublic static WordVectors fromPair(Pair<WeightLookupTable,VocabCache> pair)
pair
- the given pairpublic static WordVectors loadTxtVectors(File path) throws FileNotFoundException
path
- the path of the file to load\FileNotFoundException
public static Pair<WeightLookupTable,VocabCache> loadTxt(File path) throws FileNotFoundException
path
- the path of the file to loadFileNotFoundException
public static void writeTsneFormat(Glove vec, org.nd4j.linalg.api.ndarray.INDArray tsne, File csv) throws Exception
vec
- the word vectors to use for labelingtsne
- the tsne array to writecsv
- the file to useException
Copyright © 2015. All Rights Reserved.