it.unimi.dsi.mg4j.search.score
Class DocumentRankScorer
java.lang.Object
it.unimi.dsi.fastutil.ints.AbstractIntIterator
it.unimi.dsi.mg4j.search.score.AbstractScorer
it.unimi.dsi.mg4j.search.score.DocumentRankScorer
- All Implemented Interfaces:
- IntIterator, FlyweightPrototype<Scorer>, DelegatingScorer, Scorer, Iterator<Integer>
public class DocumentRankScorer
- extends AbstractScorer
- implements DelegatingScorer
Compute scores that do not depend on intervals, but that
just assign a fixed score to each document; scores are read
from a file whose name is passed to the constructor.
Methods inherited from interface it.unimi.dsi.fastutil.ints.IntIterator |
skip |
DocumentRankScorer
public DocumentRankScorer(String filename)
throws IOException
- Builds a document scorer by first reading the ranks from a file.
Ranks are saved as doubles (the first double is the rank of document 0
and so on).
- Parameters:
filename
- the name of the rank file.
- Throws:
IOException
DocumentRankScorer
public DocumentRankScorer(double[] score)
- Builds a document scorer with given scores.
- Parameters:
score
- the scores (they are not copied, so the caller is supposed
not to change their values).
copy
public DocumentRankScorer copy()
- Specified by:
copy
in interface FlyweightPrototype<Scorer>
- Specified by:
copy
in interface Scorer
score
public double score()
- Description copied from interface:
Scorer
- Returns a score for the current document of the last document iterator
given to
Scorer.wrap(DocumentIterator)
.
- Specified by:
score
in interface Scorer
- Returns:
- the score.
score
public double score(Index index)
- 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.
toString
public String toString()
- Overrides:
toString
in class Object
usesIntervals
public boolean usesIntervals()
- Description copied from interface:
Scorer
- Whether this scorer uses intervals.
This method is essential when aggregating scorers,
because if several scores need intervals, a CachingDocumentIterator
will be necessary.
- Specified by:
usesIntervals
in interface Scorer
- Returns:
- true if this scorer uses intervals.