public class Word2VecLoader extends Object
Constructor and Description |
---|
Word2VecLoader() |
Modifier and Type | Method and Description |
---|---|
static float |
getFloat(byte[] b)
Read float from byte array, credit to:
Credit to: https://github.com/NLPchina/Word2VEC_java/blob/master/src/com/ansj/vec/Word2VEC.java
|
static Word2Vec |
loadGoogleBinary(String path)
Loads the google model
|
static InMemoryLookupCache |
loadTxt(File path)
Loads an in memory cache from the given path (sets syn0 and the vocab)
|
static float |
readFloat(InputStream is)
Credit to: https://github.com/NLPchina/Word2VEC_java/blob/master/src/com/ansj/vec/Word2VEC.java
|
static void |
writeTsneFormat(Word2Vec vec,
org.nd4j.linalg.api.ndarray.INDArray tsne,
File csv)
Write the tsne format
|
static void |
writeWordVectors(InMemoryLookupCache l,
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 loadGoogleBinary(String path) throws IOException
path
- the path to the google modelIOException
public static float readFloat(InputStream is) throws IOException
is
- IOException
public static float getFloat(byte[] b)
b
- public static void writeWordVectors(InMemoryLookupCache l, 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 InMemoryLookupCache loadTxt(File path) throws FileNotFoundException
path
- the path of the file to loadFileNotFoundException
Copyright © 2014. All rights reserved.