it.unimi.di.mg4j.search.score
Class VignaScorer

java.lang.Object
  extended by it.unimi.di.mg4j.search.score.AbstractScorer
      extended by it.unimi.di.mg4j.search.score.AbstractWeightedScorer
          extended by it.unimi.di.mg4j.search.score.VignaScorer
All Implemented Interfaces:
DelegatingScorer, Scorer, FlyweightPrototype<Scorer>

public class VignaScorer
extends AbstractWeightedScorer
implements DelegatingScorer

Computes the Vigna score of all interval iterators of a document.

This scorer progressively moves score from a residual (initialised to 1) to the current score (initialised to 0). For each interval, we move a fraction of the residual equal to the ratio of the extent over the interval length, minimised with 1 and divided by 2. For instance, on a two-term query meeting intervals of length 2 will increase the score from 0 to 1/2, 3/4 and so on. On the other hand, larger intervals take away less from the residual.

When the score exceeds .99, the computation is interrupted. In this way, we exploit the laziness of the algorithms for minimal-interval semantics implemented in it.unimi.di.mg4j.search, greatly improving performance for extremely frequent terms, with no perceivable effect on the score itself.


Field Summary
 
Fields inherited from class it.unimi.di.mg4j.search.score.AbstractWeightedScorer
index2Weight
 
Fields inherited from class it.unimi.di.mg4j.search.score.AbstractScorer
documentIterator, indexIterator
 
Constructor Summary
VignaScorer()
           
 
Method Summary
 VignaScorer copy()
           
 double score(Index index)
          Returns a score for the current document of the last document iterator given to Scorer.wrap(DocumentIterator), but considering only a given index (optional operation).
 String toString()
           
 boolean usesIntervals()
          Returns true.
 
Methods inherited from class it.unimi.di.mg4j.search.score.AbstractWeightedScorer
getWeights, score, setWeights, wrap
 
Methods inherited from class it.unimi.di.mg4j.search.score.AbstractScorer
nextDocument
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface it.unimi.di.mg4j.search.score.Scorer
getWeights, nextDocument, score, setWeights, wrap
 

Constructor Detail

VignaScorer

public VignaScorer()
Method Detail

score

public double score(Index index)
             throws IOException
Description copied from interface: Scorer
Returns a score for the current document of the last document iterator given to Scorer.wrap(DocumentIterator), but considering only a given index (optional operation).

Specified by:
score in interface Scorer
Parameters:
index - the only index to be considered.
Returns:
the score.
Throws:
IOException

toString

public String toString()
Overrides:
toString in class Object

copy

public VignaScorer copy()
Specified by:
copy in interface DelegatingScorer
Specified by:
copy in interface Scorer
Specified by:
copy in interface FlyweightPrototype<Scorer>

usesIntervals

public boolean usesIntervals()
Returns true.

Specified by:
usesIntervals in interface Scorer
Returns:
true.