Word2VecModel (Lucene 10.5.1 common API)
Description: declaration: package: org.apache.lucene.analysis.synonym.word2vec, class: Word2VecModel

Package org.apache.lucene.analysis.synonym.word2vec

# Class Word2VecModel

java.lang.Object
org.apache.lucene.index.KnnVectorValues
org.apache.lucene.index.FloatVectorValues
org.apache.lucene.analysis.synonym.word2vec.Word2VecModel

public class Word2VecModel extends FloatVectorValues
Word2VecModel is a class representing the parsed Word2Vec model containing the vectors for each word in dictionary

WARNING: This API is experimental and might change in incompatible ways in the next release.

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from class org.apache.lucene.index.KnnVectorValues

  `KnnVectorValues.DocIndexIterator`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Word2VecModel(int dictionarySize, int vectorDimension)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addTermAndVector(TermAndVector modelEntry)`
  `Word2VecModel`
  `copy()`
  `int`
  `dimension()`
  `int`
  `size()`
  `BytesRef`
  `termValue(int targetOrd)`
  `float[]`
  `vectorValue(int targetOrd)`
  `float[]`
  `vectorValue(BytesRef term)`

  ### Methods inherited from class org.apache.lucene.index.FloatVectorValues

  `checkField, fromFloats, getEncoding, rescorer, scorer`

  ### Methods inherited from class org.apache.lucene.index.KnnVectorValues

  `createDenseIterator, createSparseIterator, fromDISI, getAcceptOrds, getVectorByteLength, iterator, ordToDoc, prefetch`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### Word2VecModel

    public Word2VecModel(int dictionarySize, int vectorDimension)

- ## Method Details

  - ### addTermAndVector

    public void addTermAndVector(TermAndVector modelEntry)

  - ### vectorValue

    public float[] vectorValue(int targetOrd)
    Specified by:
      `vectorValue` in class `FloatVectorValues`

  - ### vectorValue

    public float[] vectorValue(BytesRef term)

  - ### termValue

    public BytesRef termValue(int targetOrd)

  - ### dimension

    public int dimension()
    Specified by:
      `dimension` in class `KnnVectorValues`

  - ### size

    public int size()
    Specified by:
      `size` in class `KnnVectorValues`

  - ### copy

    public Word2VecModel copy() throws IOException
    Specified by:
      `copy` in class `FloatVectorValues`
    Throws:
      `IOException`