org.apache.lucene.classification.utils

## Class DocToDoubleVectorUtils

- java.lang.Object
- - org.apache.lucene.classification.utils.DocToDoubleVectorUtils

-     public class DocToDoubleVectorUtils
      extends Object

  utility class for converting Lucene `Document`s to `Double` vectors.

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static Double[]` | `toDenseLocalFreqDoubleArray(Terms docTerms)` create a dense `Double` vector given doc and field term vectors using local frequency of the terms in the doc
    `static Double[]` | `toSparseLocalFreqDoubleArray(Terms docTerms, Terms fieldTerms)` create a sparse `Double` vector given doc and field term vectors using local frequency of the terms in the doc

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

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

- - ### Method Detail

    - #### toSparseLocalFreqDoubleArray

          public static Double[] toSparseLocalFreqDoubleArray(Terms docTerms,
                                                              Terms fieldTerms)
                                                       throws IOException

      create a sparse `Double` vector given doc and field term vectors using local frequency of the terms in the doc
      Parameters:
        `docTerms` - term vectors for a given document
        `fieldTerms` - field term vectors
      Returns:
        a sparse vector of `Double`s as an array
      Throws:
        `IOException` - in case accessing the underlying index fails

    - #### toDenseLocalFreqDoubleArray

          public static Double[] toDenseLocalFreqDoubleArray(Terms docTerms)
                                                      throws IOException

      create a dense `Double` vector given doc and field term vectors using local frequency of the terms in the doc
      Parameters:
        `docTerms` - term vectors for a given document
      Returns:
        a dense vector of `Double`s as an array
      Throws:
        `IOException` - in case accessing the underlying index fails

Copyright © 2000-2020 Apache Software Foundation. All Rights Reserved.