Terrier IR Platform
2.2.1

uk.ac.gla.terrier.matching.dsms
Class PhraseScoreModifier

java.lang.Object
  extended by uk.ac.gla.terrier.matching.dsms.PhraseScoreModifier
All Implemented Interfaces:
java.lang.Cloneable, DocumentScoreModifier

public class PhraseScoreModifier
extends java.lang.Object
implements DocumentScoreModifier

Modifies the scores of the documents which contain, or do not contain a given phrase.

Version:
$Revision: 1.22 $
Author:
Vassilis Plachouras, Craig Macdonald

Constructor Summary
PhraseScoreModifier(java.util.ArrayList pTerms)
          Constructs a phrase score modifier for a given set of query terms.
PhraseScoreModifier(java.util.ArrayList pTerms, boolean r)
          Constructs a phrase score modifier for a given set of query terms.
PhraseScoreModifier(java.util.ArrayList pTerms, boolean r, int bDist)
          Constructs a phrase score modifier for a given set of query terms, whether they are required to appear in a document, and the allowed distance between the phrase terms.
PhraseScoreModifier(java.util.ArrayList pTerms, int bDist)
          Constructs a phrase score modifier for a given set of query terms and the allowed distance between them.
 
Method Summary
 java.lang.Object clone()
          Clones this DSM.
 java.lang.String getName()
          Returns the name of the modifier.
 boolean modifyScores(Index index, MatchingQueryTerms terms, ResultSet set)
          Modifies the scores of documents, in which there exist, or there does not exist a given phrase.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PhraseScoreModifier

public PhraseScoreModifier(java.util.ArrayList pTerms)
Constructs a phrase score modifier for a given set of query terms.

Parameters:
pTerms - ArrayList the terms that make up the query.

PhraseScoreModifier

public PhraseScoreModifier(java.util.ArrayList pTerms,
                           int bDist)
Constructs a phrase score modifier for a given set of query terms and the allowed distance between them.

Parameters:
pTerms - ArrayList the terms that make up the query.
bDist - int the allowed distance between phrase terms.

PhraseScoreModifier

public PhraseScoreModifier(java.util.ArrayList pTerms,
                           boolean r)
Constructs a phrase score modifier for a given set of query terms.

Parameters:
pTerms - ArrayList the terms that make up the query.
r - boolean indicates whether the phrase is required.

PhraseScoreModifier

public PhraseScoreModifier(java.util.ArrayList pTerms,
                           boolean r,
                           int bDist)
Constructs a phrase score modifier for a given set of query terms, whether they are required to appear in a document, and the allowed distance between the phrase terms.

Parameters:
pTerms - ArrayList the terms that make up the query.
r - boolean indicates whether the phrase is required.
bDist - int the allowed distance between the phrase terms.
Method Detail

getName

public java.lang.String getName()
Returns the name of the modifier.

Specified by:
getName in interface DocumentScoreModifier
Returns:
String the name of the modifier.

clone

public java.lang.Object clone()
Clones this DSM. Note that phraseTerms is shallow copied, because Strings are immutable

Specified by:
clone in interface DocumentScoreModifier
Overrides:
clone in class java.lang.Object

modifyScores

public boolean modifyScores(Index index,
                            MatchingQueryTerms terms,
                            ResultSet set)
Modifies the scores of documents, in which there exist, or there does not exist a given phrase.

Specified by:
modifyScores in interface DocumentScoreModifier
Parameters:
index - Index the data structures to use.
terms - MatchingQueryTerms the terms to be matched for the query. This does not correspond to the phrase terms necessarily, but to all the terms of the query.
set - ResultSet the result set for the query.
Returns:
true if any scores have been altered

Terrier IR Platform
2.2.1

Terrier Information Retrieval Platform 2.2.1. Copyright 2004-2008 University of Glasgow