it.unimi.di.mg4j.search.score
Class BM25FScorer.Visitor

java.lang.Object
  extended by it.unimi.di.mg4j.search.visitor.AbstractDocumentIteratorVisitor
      extended by it.unimi.di.mg4j.search.score.BM25FScorer.Visitor
All Implemented Interfaces:
DocumentIteratorVisitor<Boolean>
Enclosing class:
BM25FScorer

protected static final class BM25FScorer.Visitor
extends AbstractDocumentIteratorVisitor


Field Summary
protected  boolean expectedIDF
          Whether we are running Boldi's variant.
protected  double[] idfPart
          Precomputed IDF part.
protected  double[] index2B
          For each index, the associated parameter b.
protected  double[] index2BDividedByAvgDocumentSize
          Cached value.
protected  int numberOfIndices
          The length of TermCollectionVisitor.indices() cached.
protected  int numberOfOffsetsSeen
          The number of valid entries in seenOffsetsList.
protected  int numberOfTermsSeen
          The number of terms (irrespective of the index) seen up to now and accumulated in seenTermIdsList.
protected  int[] offset2Index
          An array indexed by offsets mapping each offset to the corresponding index number.
protected  int[] offset2TermId
          For each offset, the corresponding term id in the query.
protected  boolean[] seen
          Whether we have already seen a specific term/index pair.
protected  int[] seenOffsetsList
          An array accumulating the indices in seen that have been set to true, so to accelerate reset(int).
protected  int[] seenTermIdsList
          The list of numberOfTermsSeen term ids that we have seen so far.
protected  IntList[] sizes
          For each index, its list of document sizes.
protected  double[] sizeWeightComponent
          Cached from BM25Scorer.
protected  int[] termId2VirtualCounter
          For each term id, its virtual-counter index (to be used to access virtualCount and virtualIdfCount).
protected  double[] virtualCount
          An array indexed by term ids used by BM25FScorer.score() to compute virtual counts.
protected  double[] virtualIdfCount
          For expected IDF runs, an array indexed by term ids used by BM25FScorer.score() to compute virtual counts combined with IDF scoring.
protected  double[] weight
          For each index, its weight.
 
Constructor Summary
BM25FScorer.Visitor(boolean expectedIDF, double[] idfPart, int[] offset2TermId, int[] offset2Index, double[] weight, double[] index2B, IntList[] sizes, double[] index2BDividedByAvgDocumentSize)
           
 
Method Summary
 void reset(int document)
           
 Boolean visit(IndexIterator indexIterator)
          Visits an IndexIterator leaf.
 
Methods inherited from class it.unimi.di.mg4j.search.visitor.AbstractDocumentIteratorVisitor
newArray, prepare, visit, visit, visit, visitPost, visitPre
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sizeWeightComponent

protected final double[] sizeWeightComponent
Cached from BM25Scorer.


numberOfIndices

protected final int numberOfIndices
The length of TermCollectionVisitor.indices() cached.


seenOffsetsList

protected final int[] seenOffsetsList
An array accumulating the indices in seen that have been set to true, so to accelerate reset(int).


numberOfOffsetsSeen

protected int numberOfOffsetsSeen
The number of valid entries in seenOffsetsList.


seen

protected final boolean[] seen
Whether we have already seen a specific term/index pair.


numberOfTermsSeen

protected int numberOfTermsSeen
The number of terms (irrespective of the index) seen up to now and accumulated in seenTermIdsList.


seenTermIdsList

protected final int[] seenTermIdsList
The list of numberOfTermsSeen term ids that we have seen so far.


termId2VirtualCounter

protected final int[] termId2VirtualCounter
For each term id, its virtual-counter index (to be used to access virtualCount and virtualIdfCount).


sizes

protected final IntList[] sizes
For each index, its list of document sizes.


weight

protected final double[] weight
For each index, its weight.


index2B

protected final double[] index2B
For each index, the associated parameter b.


expectedIDF

protected final boolean expectedIDF
Whether we are running Boldi's variant.


offset2TermId

protected final int[] offset2TermId
For each offset, the corresponding term id in the query.


offset2Index

protected final int[] offset2Index
An array indexed by offsets mapping each offset to the corresponding index number.


virtualCount

protected final double[] virtualCount
An array indexed by term ids used by BM25FScorer.score() to compute virtual counts.


virtualIdfCount

protected final double[] virtualIdfCount
For expected IDF runs, an array indexed by term ids used by BM25FScorer.score() to compute virtual counts combined with IDF scoring.


index2BDividedByAvgDocumentSize

protected final double[] index2BDividedByAvgDocumentSize
Cached value.


idfPart

protected final double[] idfPart
Precomputed IDF part.

Constructor Detail

BM25FScorer.Visitor

public BM25FScorer.Visitor(boolean expectedIDF,
                           double[] idfPart,
                           int[] offset2TermId,
                           int[] offset2Index,
                           double[] weight,
                           double[] index2B,
                           IntList[] sizes,
                           double[] index2BDividedByAvgDocumentSize)
Method Detail

visit

public Boolean visit(IndexIterator indexIterator)
              throws IOException
Description copied from interface: DocumentIteratorVisitor
Visits an IndexIterator leaf.

Parameters:
indexIterator - the leaf to be visited.
Returns:
an appropriate return value if the visit should continue, or null.
Throws:
IOException

reset

public void reset(int document)