edu.washington.cs.knowitall.extractor.conf
Class BooleanFeatureSet<T>

java.lang.Object
  extended by edu.washington.cs.knowitall.extractor.conf.BooleanFeatureSet<T>
Type Parameters:
T -

public class BooleanFeatureSet<T>
extends java.lang.Object

Represents a set of boolean feature functions that can be applied to objects of type T. Each feature is represented as a Predicate object, and has a String name.

Author:
afader

Constructor Summary
BooleanFeatureSet(java.util.Map<java.lang.String,com.google.common.base.Predicate<T>> givenFeatures)
          Constructs a new feature set from the given features.
 
Method Summary
 java.util.SortedMap<java.lang.String,java.lang.Boolean> featurize(T object)
          Returns a feature representation of the given object.
 boolean[] featurizeToBool(T object)
          Returns the feature representation of object as an array of booleans.
 double[] featurizeToDouble(T object)
          Returns the feature representation of object as an array of doubles.
 java.util.List<java.lang.String> getFeatureNames()
          Returns the feature names as an ImmutableList, sorted using the default String comparator.
 java.util.List<com.google.common.base.Predicate<T>> getFeatures()
          Returns the features as an ImmutableList, sorted using the default String comparator on the features' names.
 int getNumFeatures()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BooleanFeatureSet

public BooleanFeatureSet(java.util.Map<java.lang.String,com.google.common.base.Predicate<T>> givenFeatures)
Constructs a new feature set from the given features.

Parameters:
givenFeatures -
Method Detail

featurize

public java.util.SortedMap<java.lang.String,java.lang.Boolean> featurize(T object)
Returns a feature representation of the given object.

Parameters:
object -
Returns:
a sorted map, mapping feature names to boolean values

featurizeToDouble

public double[] featurizeToDouble(T object)
Returns the feature representation of object as an array of doubles. Each value in the array corresponds to a feature (where 1.0 is true and 0.0 is false). The ith value corresponds to the ith feature.

Parameters:
object -
Returns:

featurizeToBool

public boolean[] featurizeToBool(T object)
Returns the feature representation of object as an array of booleans. The ith value corresponds to the ith feature.

Parameters:
object -
Returns:

getFeatureNames

public java.util.List<java.lang.String> getFeatureNames()
Returns the feature names as an ImmutableList, sorted using the default String comparator.

Returns:

getFeatures

public java.util.List<com.google.common.base.Predicate<T>> getFeatures()
Returns the features as an ImmutableList, sorted using the default String comparator on the features' names.

Returns:

getNumFeatures

public int getNumFeatures()
Returns:
the number of features in this feature set