|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object it.unimi.di.mg4j.search.score.AbstractScorer it.unimi.di.mg4j.search.score.DecreasingDocumentRankScorer
public class DecreasingDocumentRankScorer
Compute scores that do not depend on intervals, but that just assign a fixed score to each document starting from 1; scores are read from a file whose name is passed to the constructor.
This scorer assumes that scores are nonnegative and that
documents are ordered in decreasing
score order: that is, that if i < j then
the score of i is greater than or equal to the score of j.
This allows to normalise the score (the document with the highest score has
exactly score 1) without additional costs. This scorer will throw an
IllegalStateException
if this assumption is violated.
Field Summary |
---|
Fields inherited from class it.unimi.di.mg4j.search.score.AbstractScorer |
---|
documentIterator, indexIterator |
Constructor Summary | |
---|---|
DecreasingDocumentRankScorer(double[] score)
Builds a document scorer with given scores. |
|
DecreasingDocumentRankScorer(String filename)
Builds a document scorer by first reading the ranks from a file. |
Method Summary | |
---|---|
DecreasingDocumentRankScorer |
copy()
|
double |
score()
Returns a score for the current document of the last document iterator given to Scorer.wrap(DocumentIterator) . |
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()
Whether this scorer uses intervals. |
void |
wrap(DocumentIterator documentIterator)
Wraps the given document iterator. |
Methods inherited from class it.unimi.di.mg4j.search.score.AbstractScorer |
---|
getWeights, nextDocument, setWeights |
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, setWeights |
Constructor Detail |
---|
public DecreasingDocumentRankScorer(String filename) throws IOException
filename
- the name of the rank file.
IOException
public DecreasingDocumentRankScorer(double[] score)
score
- the scores (they are not copied, so the caller is supposed
not to change their values).Method Detail |
---|
public DecreasingDocumentRankScorer copy()
copy
in interface DelegatingScorer
copy
in interface Scorer
copy
in interface FlyweightPrototype<Scorer>
public double score()
Scorer
Scorer.wrap(DocumentIterator)
.
score
in interface Scorer
public double score(Index index)
Scorer
Scorer.wrap(DocumentIterator)
, but
considering only a given index (optional operation).
score
in interface Scorer
index
- the only index to be considered.
public void wrap(DocumentIterator documentIterator) throws IOException
AbstractScorer
This method records internally the provided iterator.
wrap
in interface Scorer
wrap
in class AbstractScorer
documentIterator
- the document iterator that will be used in subsequent calls to
Scorer.score()
and Scorer.score(Index)
.
IOException
public String toString()
toString
in class Object
public boolean usesIntervals()
Scorer
This method is essential when aggregating scorers,
because if several scores need intervals, a CachingDocumentIterator
will be necessary.
usesIntervals
in interface Scorer
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |