Class VignaScorer
- java.lang.Object
-
- it.unimi.di.big.mg4j.search.score.AbstractScorer
-
- it.unimi.di.big.mg4j.search.score.AbstractWeightedScorer
-
- it.unimi.di.big.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.big.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.big.mg4j.search.score.AbstractWeightedScorer
index2Weight
-
Fields inherited from class it.unimi.di.big.mg4j.search.score.AbstractScorer
documentIterator, indexIterator
-
-
Constructor Summary
Constructors Constructor Description VignaScorer()
-
Method Summary
Modifier and Type Method Description VignaScorer
copy()
double
score(Index index)
Returns a score for the current document of the last document iterator given toScorer.wrap(DocumentIterator)
, but considering only a given index (optional operation).String
toString()
boolean
usesIntervals()
Returns true.-
Methods inherited from class it.unimi.di.big.mg4j.search.score.AbstractWeightedScorer
getWeights, score, setWeights, wrap
-
Methods inherited from class it.unimi.di.big.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.big.mg4j.search.score.Scorer
getWeights, nextDocument, score, setWeights, wrap
-
-
-
-
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 toScorer.wrap(DocumentIterator)
, but considering only a given index (optional operation).- Specified by:
score
in interfaceScorer
- Parameters:
index
- the only index to be considered.- Returns:
- the score.
- Throws:
IOException
-
copy
public VignaScorer copy()
- Specified by:
copy
in interfaceFlyweightPrototype<Scorer>
- Specified by:
copy
in interfaceScorer
-
usesIntervals
public boolean usesIntervals()
Returns true.- Specified by:
usesIntervals
in interfaceScorer
- Returns:
- true.
-
-