Class DecreasingDocumentRankScorer

  • All Implemented Interfaces:
    DelegatingScorer, Scorer, FlyweightPrototype<Scorer>

    public class DecreasingDocumentRankScorer
    extends AbstractScorer
    implements DelegatingScorer
    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.

    Warning: this scorer assumes that there are no more than Integer.MAX_VALUE documents.

    • Constructor Detail

      • DecreasingDocumentRankScorer

        public DecreasingDocumentRankScorer​(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
      • DecreasingDocumentRankScorer

        public DecreasingDocumentRankScorer​(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).