|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectit.unimi.dsi.fastutil.ints.AbstractIntIterator
it.unimi.dsi.mg4j.search.score.AbstractScorer
it.unimi.dsi.mg4j.search.score.AbstractIndexScorer
it.unimi.dsi.mg4j.search.score.AbstractWeightedScorer
public abstract class AbstractWeightedScorer
An abstract subsclass of AbstractIndexScorer
providing internal storage and copy of the weight map, faster array-based
access to the latter, and a default implementation of score()
.
Warning: implementing subclasses must implement
Scorer.copy()
so that the state of the
weight map is replicated, too.
Field Summary | |
---|---|
protected double[] |
currWeight
An array parallel to AbstractIndexScorer.currIndex containing the current corresponding values in index2Weight ;
it is set up by wrap(DocumentIterator) . |
protected Reference2DoubleOpenHashMap<Index> |
index2Weight
A map associating a weight with each index. |
Fields inherited from class it.unimi.dsi.mg4j.search.score.AbstractIndexScorer |
---|
currIndex, n |
Fields inherited from class it.unimi.dsi.mg4j.search.score.AbstractScorer |
---|
documentIterator |
Constructor Summary | |
---|---|
AbstractWeightedScorer()
|
Method Summary | |
---|---|
Reference2DoubleMap<Index> |
getWeights()
Returns an empty map. |
double |
score()
Computes a score by calling Scorer.score(Index) for
each index in the current index map, and summing the weighted results. |
boolean |
setWeights(Reference2DoubleMap<Index> index2Weight)
Copies the argument internally, rescaling weights so they sum up to one. |
void |
wrap(DocumentIterator documentIterator)
Wraps the given document iterator. |
Methods inherited from class it.unimi.dsi.mg4j.search.score.AbstractScorer |
---|
hasNext, nextDocument, nextInt, skip |
Methods inherited from class it.unimi.dsi.fastutil.ints.AbstractIntIterator |
---|
next, remove |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface it.unimi.dsi.mg4j.search.score.Scorer |
---|
copy, score, usesIntervals |
Methods inherited from interface java.util.Iterator |
---|
next, remove |
Field Detail |
---|
protected Reference2DoubleOpenHashMap<Index> index2Weight
protected double[] currWeight
AbstractIndexScorer.currIndex
containing the current corresponding values in index2Weight
;
it is set up by wrap(DocumentIterator)
.
Constructor Detail |
---|
public AbstractWeightedScorer()
Method Detail |
---|
public boolean setWeights(Reference2DoubleMap<Index> index2Weight)
setWeights
in interface Scorer
setWeights
in class AbstractScorer
index2Weight
- the new map from indices to weights.
public final Reference2DoubleMap<Index> getWeights()
AbstractScorer
getWeights
in interface Scorer
getWeights
in class AbstractScorer
public double score() throws IOException
Scorer.score(Index)
for
each index in the current index map, and summing the weighted results.
IOException
public void wrap(DocumentIterator documentIterator) throws IOException
Besides the services provided by AbstractIndexScorer.wrap(DocumentIterator)
,
this method sets up currWeight
.
wrap
in interface Scorer
wrap
in class AbstractIndexScorer
documentIterator
- the document iterator that will be used in subsequent calls to
score()
and Scorer.score(Index)
.
IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |