uk.ac.gla.dcs.renaissance.mg4j.scorers
Class HiemstraLMScorer

java.lang.Object
  extended by it.unimi.dsi.fastutil.ints.AbstractIntIterator
      extended by it.unimi.dsi.mg4j.search.score.AbstractScorer
          extended by it.unimi.dsi.mg4j.search.score.AbstractIndexScorer
              extended by it.unimi.dsi.mg4j.search.score.AbstractWeightedScorer
                  extended by uk.ac.gla.dcs.renaissance.mg4j.scorers.HiemstraLMScorer
All Implemented Interfaces:
it.unimi.dsi.fastutil.ints.IntIterator, it.unimi.dsi.lang.FlyweightPrototype<it.unimi.dsi.mg4j.search.score.Scorer>, it.unimi.dsi.mg4j.search.score.DelegatingScorer, it.unimi.dsi.mg4j.search.score.Scorer, Iterator<Integer>

public class HiemstraLMScorer
extends it.unimi.dsi.mg4j.search.score.AbstractWeightedScorer
implements it.unimi.dsi.mg4j.search.score.DelegatingScorer

A scorer implementing the Hiemstra Language Modelling Approach. See Hiemstra, Djord. Using Language Models for Information Retrieval. PhD Thesis, 2001, chapters 4+5.

Currently it only supports the variant with document frequencies and document length normalisation.

Author:
Ingo Frommholz

Field Summary
 
Fields inherited from class it.unimi.dsi.mg4j.search.score.AbstractWeightedScorer
currWeight, index2Weight
 
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
HiemstraLMScorer()
          Constructor.
HiemstraLMScorer(double lambda, boolean collFreqBackgroundModel, IndexConfiguration[] indexConfs)
          Constructor.
HiemstraLMScorer(IndexConfiguration[] indexConfs)
          Constructor.
 
Method Summary
 it.unimi.dsi.mg4j.search.score.Scorer copy()
           
 double score()
           
 double score(it.unimi.dsi.mg4j.index.Index index)
           
 void setIndexConfiguration(IndexConfiguration[] indexConfs)
          This may be our only chance to set the index configurations
 boolean usesIntervals()
           
 void wrap(it.unimi.dsi.mg4j.search.DocumentIterator d)
           
 
Methods inherited from class it.unimi.dsi.mg4j.search.score.AbstractWeightedScorer
getWeights, setWeights
 
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
getWeights, nextDocument, nextInt, setWeights
 
Methods inherited from interface it.unimi.dsi.fastutil.ints.IntIterator
skip
 
Methods inherited from interface java.util.Iterator
hasNext, next, remove
 

Constructor Detail

HiemstraLMScorer

public HiemstraLMScorer(double lambda,
                        boolean collFreqBackgroundModel,
                        IndexConfiguration[] indexConfs)
Constructor. Besides setting the lambda parameter, there is also the choice if the background model P(t_i|M_c) should be based on the collection frequency (number of times a term appears in the collection) or document frequency (number of documents a term appears in). NOTE: Collection frequency is not supported yet!

Parameters:
lambda - the lambda value to use
collFreqBackgroundModel - true if the collection frequency should be used to calculate the background model P(t_i|M_d), false if the document frequency should be used for this model.
indexConfs - the index configurations. This must go along with the indexes we get from the term iterator!

HiemstraLMScorer

public HiemstraLMScorer(IndexConfiguration[] indexConfs)
Constructor. Uses default lambda value and the document frequency for the background model P(t_i|M_d)

Parameters:
indexConfs - the index configurations. This must go along with the indexes we get from the term iterator!

HiemstraLMScorer

public HiemstraLMScorer()
Constructor. Uses default lambda value and the document frequency for the background model P(t_i|M_d). You MUST add an indexConfiguration later with setIndexConfiguration(uk.ac.gla.dcs.renaissance.iqir.config.IndexConfiguration[])!

Method Detail

setIndexConfiguration

public void setIndexConfiguration(IndexConfiguration[] indexConfs)
This may be our only chance to set the index configurations

Parameters:
indexConfs - the index configurations. This must go along with the indexes we get from the term iterator!

score

public double score()
             throws IOException
Specified by:
score in interface it.unimi.dsi.mg4j.search.score.Scorer
Overrides:
score in class it.unimi.dsi.mg4j.search.score.AbstractWeightedScorer
Throws:
IOException

score

public double score(it.unimi.dsi.mg4j.index.Index index)
             throws IOException
Specified by:
score in interface it.unimi.dsi.mg4j.search.score.Scorer
Throws:
IOException

usesIntervals

public boolean usesIntervals()
Specified by:
usesIntervals in interface it.unimi.dsi.mg4j.search.score.Scorer

copy

public it.unimi.dsi.mg4j.search.score.Scorer copy()
Specified by:
copy in interface it.unimi.dsi.lang.FlyweightPrototype<it.unimi.dsi.mg4j.search.score.Scorer>
Specified by:
copy in interface it.unimi.dsi.mg4j.search.score.Scorer

wrap

public void wrap(it.unimi.dsi.mg4j.search.DocumentIterator d)
          throws IOException
Specified by:
wrap in interface it.unimi.dsi.mg4j.search.score.Scorer
Overrides:
wrap in class it.unimi.dsi.mg4j.search.score.AbstractWeightedScorer
Throws:
IOException


Copyright © 2011. All Rights Reserved.