public class BinaryWordVectorUtils extends Object
The core of this code has been written in the context of dl4j, but provides a generic solution to efficiently storing and reading word embeddings with a memory-mapped file.
Constructor and Description |
---|
BinaryWordVectorUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
convertWordVectorsToBinary(Map<String,float[]> vectors,
boolean aCaseless,
Locale aLocale,
File binaryTarget)
Write a map of token embeddings into binary format.
|
static void |
convertWordVectorsToBinary(Map<String,float[]> vectors,
File binaryTarget)
Write a map of token embeddings into binary format.
|
public static void convertWordVectorsToBinary(Map<String,float[]> vectors, File binaryTarget) throws IOException
Locale.US
and assume case-sensitivity iff there is any token containing an uppercase letter.vectors
- a Map<String, float[]>
holding all tokens with embeddingsbinaryTarget
- the target file File
IOException
- if an I/O error occursconvertWordVectorsToBinary(Map, boolean, Locale, File)
public static void convertWordVectorsToBinary(Map<String,float[]> vectors, boolean aCaseless, Locale aLocale, File binaryTarget) throws IOException
vectors
- a Map<String, float[]>
holding all tokens with embeddingsaCaseless
- if true, tokens are expected to be caselessaLocale
- the Locale
binaryTarget
- the target file File
IOException
- if an I/O error occursCopyright © 2007–2018 Ubiquitous Knowledge Processing (UKP) Lab, Technische Universität Darmstadt. All rights reserved.