de.fu_berlin.ties.classify.feature
Class FeatureSet

java.lang.Object
  extended by de.fu_berlin.ties.classify.feature.FeatureVector
      extended by de.fu_berlin.ties.classify.feature.FeatureSet

public class FeatureSet
extends FeatureVector

This feature vector implementation stores a multi-set of features. The order of features is not preserved. Internally it uses a HashBag as storage.

Instances of this class are not thread-safe and must be synchronized externally, if required.

Version:
$Revision: 1.11 $, $Date: 2004/09/06 17:22:10 $, $Author: siefkes $
Author:
Christian Siefkes

Field Summary
static String STRENGTH_CONSTANT
          Constants specifying that feature frequencies are not considered when calculating strength values.
static String STRENGTH_LINEAR
          Constants specifying that feature frequencies are considered linear (as is) when calculating strength values (a feature occurring twice as frequently will be twice as strong).
static String STRENGTH_LOG
          Constants specifying that the logarithm of feature frequencies is considered when calculating strength values (1.0 is added to log(f) to avoid the result becoming 0).
static String STRENGTH_SQUARE_ROOT
          Constants specifying that the square root of feature frequencies is considered when calculating strength values.
 
Constructor Summary
FeatureSet(String strengthMethod)
          Creates a new instance.
 
Method Summary
 String getStrengthType()
          Returns the type of method used to consider feature frequencies when determining strength values.
 Iterator iterator()
          Returns an iterator over the Features stored in this vector.
protected  void preAddHook(Feature feature)
          Implementation of the hook provided by the superclass to ensure that the summed strength is updated correctly.
 int size()
          Returns the number of features stored in this vector.
protected  Collection<Feature> store()
          Returns the collection used for storing the features.
 double strength(Feature feature)
          Returns a strength value for a feature contained in this vector.
 
Methods inherited from class de.fu_berlin.ties.classify.feature.FeatureVector
add, addAll, addAll, addAllTokens, flatten, flatten, getSummedStrength, setSummedStrength, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

STRENGTH_CONSTANT

public static final String STRENGTH_CONSTANT
Constants specifying that feature frequencies are not considered when calculating strength values.

See Also:
Constant Field Values

STRENGTH_LOG

public static final String STRENGTH_LOG
Constants specifying that the logarithm of feature frequencies is considered when calculating strength values (1.0 is added to log(f) to avoid the result becoming 0).

See Also:
Constant Field Values

STRENGTH_SQUARE_ROOT

public static final String STRENGTH_SQUARE_ROOT
Constants specifying that the square root of feature frequencies is considered when calculating strength values.

See Also:
Constant Field Values

STRENGTH_LINEAR

public static final String STRENGTH_LINEAR
Constants specifying that feature frequencies are considered linear (as is) when calculating strength values (a feature occurring twice as frequently will be twice as strong).

See Also:
Constant Field Values
Constructor Detail

FeatureSet

public FeatureSet(String strengthMethod)
Creates a new instance.

Parameters:
strengthMethod - The type of method used to consider feature frequencies when determining strength values -- should be one of the STRENGTH constants defined in this class
Method Detail

iterator

public Iterator iterator()
Returns an iterator over the Features stored in this vector.

Overrides:
iterator in class FeatureVector
Returns:
an iterator over the stored features

getStrengthType

public String getStrengthType()
Returns the type of method used to consider feature frequencies when determining strength values.

Returns:
the value of the attribute -- should be one of the STRENGTH constants defined in this class

preAddHook

protected void preAddHook(Feature feature)
Implementation of the hook provided by the superclass to ensure that the summed strength is updated correctly.

Overrides:
preAddHook in class FeatureVector
Parameters:
feature - the feature to add

size

public int size()
Returns the number of features stored in this vector.

Overrides:
size in class FeatureVector
Returns:
the number of features

store

protected Collection<Feature> store()
Returns the collection used for storing the features. The properties of a feature vector depend on the kind of collection that is used.

Specified by:
store in class FeatureVector
Returns:
the collection used for storing the features.

strength

public double strength(Feature feature)
Returns a strength value for a feature contained in this vector. This implementation simply delegates to Feature.getStrength().

Overrides:
strength in class FeatureVector
Parameters:
feature - the feature to consider
Returns:
a strength value for the specified feature


Copyright © 2003-2004 Christian Siefkes. All Rights Reserved.