com.bigdata.search
Class TermFrequencyData<V extends Comparable<V>>

java.lang.Object
  extended by com.bigdata.search.TermFrequencyData<V>
Type Parameters:
V - The generic type of the document identifier.

public class TermFrequencyData<V extends Comparable<V>>
extends Object

Models the term-frequency data associated with a single field of some document.

Version:
$Id: TermFrequencyData.java 6234 2012-03-31 09:33:43Z mrpersonick $
Author:
Bryan Thompson

Field Summary
 V docId
          The document identifier.
 int fieldId
          The field identifier.
 LinkedHashMap<String,ITermMetadata> terms
          The set of distinct tokens and their ITermMetadata.
 
Constructor Summary
TermFrequencyData(V docId, int fieldId, String token)
           
 
Method Summary
 boolean add(String token)
          Add a Token.
 int distinctTermCount()
          The #of distinct terms.
 Map.Entry<String,ITermMetadata> getSingletonEntry()
           
 double normalize()
          Computes the normalized term-frequency vector.
 int totalTermCount()
          The total #of terms, including duplicates.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

docId

public final V extends Comparable<V> docId
The document identifier.


fieldId

public final int fieldId
The field identifier.


terms

public final LinkedHashMap<String,ITermMetadata> terms
The set of distinct tokens and their ITermMetadata.

Constructor Detail

TermFrequencyData

public TermFrequencyData(V docId,
                         int fieldId,
                         String token)
Method Detail

add

public boolean add(String token)
Add a Token.

Parameters:
token - The token.
Returns:
true iff the termText did not previously exist for this TermFrequencyData.

distinctTermCount

public int distinctTermCount()
The #of distinct terms.


totalTermCount

public int totalTermCount()
The total #of terms, including duplicates.


normalize

public double normalize()
Computes the normalized term-frequency vector. This is a unit vector whose magnitude is 1.0. The magnitude of the term frequency vector is computed using the integer term frequency values reported by TermMetadata.termFreq(). The normalized values are then set on TermMetadata.localTermWeight.

Returns:
The magnitude of the un-normalized TermMetadata.termFreq() vector.

getSingletonEntry

public Map.Entry<String,ITermMetadata> getSingletonEntry()


Copyright © 2006-2011 SYSTAP, LLC. All Rights Reserved.