anl.aida.core
Interface ScoredTermsCollection

All Superinterfaces:
java.lang.Iterable<MIFSDocument>
All Known Implementing Classes:
STCBuilder.STCollection

public interface ScoredTermsCollection
extends java.lang.Iterable<MIFSDocument>

Interface for a collection of scored terms.


Method Summary
 java.lang.Iterable<MIFSDocument> documents()
          Gets an iterable over all the documents in this collection.
 MIFSDocument getDocument(int index)
          Gets the document at the specified index.
 int getDocumentCount()
          Gets the number of documents in the collection.
 IntIterator getDocumentsFor(int termIndex)
          Gets an iterator of document indices of docs that contain a Term with the specified index.
 int getFrequency(int docIndex, int termIndex)
          Gets the frequency of the specified term in the specified document.
 DateRange getRange()
          Gets the date range (inclusive) covered by this ScoredTermsCollection.
 float getScore(int docIndex, int termIndex)
          Gets the score of the specified term in the specified document.
 MIFSTerm getTerm(int index)
          Gets the term at the specified index.
 int getTermCount()
          Gets the number of terms in the collection.
 int getTermIndex(java.lang.String term)
          Gets the index for the specified term.
 void iterateByDocument(ScoredDocumentCallback callback)
          Iterates through the collection in document order calling the relevant methods in the callback.
 void iterateByTerm(ScoredTermCallback callback)
          Iterates through the collection in term order calling the relevant methods in the callback.
 java.lang.Iterable<MIFSTerm> terms()
          Gets an iterable over all the terms in this collection.
 
Methods inherited from interface java.lang.Iterable
iterator
 

Method Detail

terms

java.lang.Iterable<MIFSTerm> terms()
Gets an iterable over all the terms in this collection.

Returns:
an iterable over all the terms in this collection.

documents

java.lang.Iterable<MIFSDocument> documents()
Gets an iterable over all the documents in this collection.

Returns:
an iterable over all the documents in this collection.

iterateByDocument

void iterateByDocument(ScoredDocumentCallback callback)
Iterates through the collection in document order calling the relevant methods in the callback. In document order, each document is processed in order such that all the term scores for that document are passed to the callback before proceeding to the next document.

Parameters:
callback - methods are called on this obj during iteration

iterateByTerm

void iterateByTerm(ScoredTermCallback callback)
                   throws AIDAException
Iterates through the collection in term order calling the relevant methods in the callback. In term order, all the scores for all the documents for a specific term are passed to the callback before starting the next term.

Parameters:
callback - methods are called on this obj during iteration
Throws:
AIDAException - if there is during the callback.

getTermCount

int getTermCount()
Gets the number of terms in the collection.

Returns:
the number of terms in the collection.

getDocumentCount

int getDocumentCount()
Gets the number of documents in the collection.

Returns:
the number of documents in the collection.

getDocument

MIFSDocument getDocument(int index)
Gets the document at the specified index.

Parameters:
index - the index of the document
Returns:
Gets the document at the specified index.

getTerm

MIFSTerm getTerm(int index)
Gets the term at the specified index.

Parameters:
index - the index of the term
Returns:
the term at the specified index.

getTermIndex

int getTermIndex(java.lang.String term)
Gets the index for the specified term. This can be slow.

Parameters:
term - the term to get the index for
Returns:
the index for the specified term, or -1 if the term is not found.

getFrequency

int getFrequency(int docIndex,
                 int termIndex)
Gets the frequency of the specified term in the specified document.

Parameters:
docIndex - the index of the document
termIndex - the index of the term
Returns:
the frequency of the specified term in the specified document.

getScore

float getScore(int docIndex,
               int termIndex)
Gets the score of the specified term in the specified document.

Parameters:
docIndex - the index of the document
termIndex - the index of the term
Returns:
the score of the specified term in the specified document.

getDocumentsFor

IntIterator getDocumentsFor(int termIndex)
Gets an iterator of document indices of docs that contain a Term with the specified index.

Parameters:
termIndex - the term index
Returns:
n iterator of document indices of docs that contain a Term with the specified index.

getRange

DateRange getRange()
Gets the date range (inclusive) covered by this ScoredTermsCollection.

Returns:
the date range (inclusive) covered by this ScoredTermsCollection.