Terrier IR Platform
2.2.1

uk.ac.gla.terrier.utility
Class FieldScore

java.lang.Object
  extended by uk.ac.gla.terrier.utility.FieldScore

public class FieldScore
extends java.lang.Object

A class for modifying the retrieval scores of documents, according to whether the query terms appear to any of the fields, or tags specified by the property FieldTags.process. These tags can be either HTML tags or tags such as DOCHDR, from the documents.
If a query term appears in any of the specified tags, then the document score can be altered according to the values specified in the property field.modifiers. For example, if FieldTags.process=TITLE,H1,B and field.modifiers=0.10,0.00,0.00, then if a query term appears in the title of a document, the document's score will be increased by a factor of 0.10.

Version:
$Revision: 1.25 $
Author:
Douglas Johnson, Vassilis Plachouras

Field Summary
static java.lang.String[] FIELD_NAMES
          The names of the fields to be processed.
static int FIELDS_COUNT
          The total number of tags to check for.
static boolean USE_FIELD_INFORMATION
          Indicates whether field information is used.
 
Constructor Summary
FieldScore()
          The default constructor of the class.
 
Method Summary
static double applyFieldScoreModifier(int fieldScore, double score)
          Computes the modified score for a document with a given fieldScore (a bitset where each bit represents a tag) and its original score.
 int getFieldScore()
          Computes an field score associated with a page.
static double[] getModifiers()
          Returns the modifiers scores.
static void init()
           
 void insertField(java.lang.String tag)
          Add a tag in the corresponding score set, unless the number of tags to process is zero.
 void insertFields(java.util.Set<java.lang.String> tags)
          Adds tags in the corresponding score set, unless the number of tags to process is zero.
 void insertFields(java.lang.String[] tags)
          Add tags in the corresponding score set, unless the number of tags to process is zero.
static void updateModifiers(double[] modifiers)
          Updates the values of the tag modifiers.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FIELDS_COUNT

public static int FIELDS_COUNT
The total number of tags to check for.


USE_FIELD_INFORMATION

public static boolean USE_FIELD_INFORMATION
Indicates whether field information is used.


FIELD_NAMES

public static java.lang.String[] FIELD_NAMES
The names of the fields to be processed. The values are read from the property FieldTags.process.

Constructor Detail

FieldScore

public FieldScore()
The default constructor of the class.

Method Detail

init

public static void init()

getFieldScore

public int getFieldScore()
Computes an field score associated with a page. If we check for n different tags, we use n bits. Each tag is associated with a specific bit. The method returns the binary number corresponding to the bits which are set to 1.

Returns:
int a number representing the tags which are in the set

insertField

public void insertField(java.lang.String tag)
Add a tag in the corresponding score set, unless the number of tags to process is zero.

Parameters:
tag - String the name of the tag to be added.

insertFields

public void insertFields(java.lang.String[] tags)
Add tags in the corresponding score set, unless the number of tags to process is zero.

Parameters:
tags - String[] the names of the tags to be added.

insertFields

public void insertFields(java.util.Set<java.lang.String> tags)
Adds tags in the corresponding score set, unless the number of tags to process is zero.

Parameters:
tags - HashSet a hashset with the tags to add.

applyFieldScoreModifier

public static double applyFieldScoreModifier(int fieldScore,
                                             double score)
Computes the modified score for a document with a given fieldScore (a bitset where each bit represents a tag) and its original score. If the number of tags is equal to zero then we return zero.

Parameters:
fieldScore - int the bitset where each bit represents whether a specific tag exists.
score - the original score.
Returns:
the modified score, according to the found field tags.

updateModifiers

public static void updateModifiers(double[] modifiers)
Updates the values of the tag modifiers. If the length of the modifiers is different than the length of the already used modifiers, then the original modifiers are not replaced.

Parameters:
modifiers - double[] the new values of the modifiers.

getModifiers

public static double[] getModifiers()
Returns the modifiers scores.

Returns:
the array of the modifiers.

Terrier IR Platform
2.2.1

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