anl.aida.core
Class STCWriter

java.lang.Object
  extended by anl.aida.core.STCWriter
All Implemented Interfaces:
ScoredTermCallback

public class STCWriter
extends java.lang.Object
implements ScoredTermCallback

Writes a ScoredTermsCollection out to a binary file.


Field Summary
private  org.apache.lucene.store.IndexOutput out
           
private  int termIndex
           
 
Constructor Summary
STCWriter()
           
 
Method Summary
 void apply(int docIndex, MIFSDocument doc, int frequency, float score)
          Notifies the implementor of a document score for the term specified in the last call to newTerm.
 void newTerm(int termIndex, MIFSTerm term)
          Called when a new term is encountered during iteration.
 void writeCollection(java.lang.String file, ScoredTermsCollection terms)
          Writes the specified collection to the specified file with the specified timestamp.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

out

private org.apache.lucene.store.IndexOutput out

termIndex

private int termIndex
Constructor Detail

STCWriter

public STCWriter()
Method Detail

newTerm

public void newTerm(int termIndex,
                    MIFSTerm term)
Called when a new term is encountered during iteration.

Specified by:
newTerm in interface ScoredTermCallback
Parameters:
termIndex - the index of the term in the collection
term - the term itself

apply

public void apply(int docIndex,
                  MIFSDocument doc,
                  int frequency,
                  float score)
           throws AIDAException
Notifies the implementor of a document score for the term specified in the last call to newTerm.

Specified by:
apply in interface ScoredTermCallback
Parameters:
docIndex - the index of the document for which this is the term score
doc - the document itself
frequency - the frequency count of the term in the document
score - the term score for the document
Throws:
AIDAException - if there is an error during the callback.

writeCollection

public void writeCollection(java.lang.String file,
                            ScoredTermsCollection terms)
                     throws java.io.IOException
Writes the specified collection to the specified file with the specified timestamp.

Parameters:
file - the path of the file to write to
terms - the scored terms collection to write
Throws:
java.io.IOException - if there is an error writing the file.