Example usage for org.deeplearning4j.models.embeddings.wordvectors WordVectors vocab

List of usage examples for org.deeplearning4j.models.embeddings.wordvectors WordVectors vocab

Introduction

In this page you can find the example usage for org.deeplearning4j.models.embeddings.wordvectors WordVectors vocab.

Prototype

VocabCache vocab();

Source Link

Document

Vocab for the vectors

Usage

From source file:org.knime.ext.textprocessing.dl4j.util.WordVectorPortObjectUtils.java

License:Open Source License

/**
 * Converts wordVectors to {@link Word2Vec}. Sets {@link WeightLookupTable} and {@link VocabCache}. Depending on
 * specified word vector type this may lead to information loss. E.g. labels for {@link ParagraphVectors}.
 *
 * @param wordVectors//w  w w . j a v a 2s .co m
 * @return Word2Vec containing vocab and lookup table
 */
public static Word2Vec wordVectorsToWord2Vec(final WordVectors wordVectors) {
    final Word2Vec w2v = new Word2Vec();
    w2v.setLookupTable(wordVectors.lookupTable());
    w2v.setVocab(wordVectors.vocab());
    return w2v;
}