Class DocToDoubleVectorUtils
java.lang.Object
org.apache.lucene.classification.utils.DocToDoubleVectorUtils
utility class for converting Lucene
Documents to Double
vectors.-
Method Summary
Modifier and TypeMethodDescriptionstatic Double[]toDenseLocalFreqDoubleArray(org.apache.lucene.index.Terms docTerms) create a denseDoublevector given doc and field term vectors using local frequency of the terms in the docstatic Double[]toSparseLocalFreqDoubleArray(org.apache.lucene.index.Terms docTerms, org.apache.lucene.index.Terms fieldTerms) create a sparseDoublevector given doc and field term vectors using local frequency of the terms in the doc
-
Method Details
-
toSparseLocalFreqDoubleArray
public static Double[] toSparseLocalFreqDoubleArray(org.apache.lucene.index.Terms docTerms, org.apache.lucene.index.Terms fieldTerms) throws IOException create a sparseDoublevector given doc and field term vectors using local frequency of the terms in the doc- Parameters:
docTerms- term vectors for a given documentfieldTerms- field term vectors- Returns:
- a sparse vector of
Doubles as an array - Throws:
IOException- in case accessing the underlying index fails
-
toDenseLocalFreqDoubleArray
public static Double[] toDenseLocalFreqDoubleArray(org.apache.lucene.index.Terms docTerms) throws IOException create a denseDoublevector 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
Doubles as an array - Throws:
IOException- in case accessing the underlying index fails
-