edu.stanford.nlp.ie.crf
Class CRFDatum<FEAT,LAB>

java.lang.Object
  extended by edu.stanford.nlp.ie.crf.CRFDatum<FEAT,LAB>
All Implemented Interfaces:
java.io.Serializable

public class CRFDatum<FEAT,LAB>
extends java.lang.Object
implements java.io.Serializable

The representation of Datums used internally in CRFClassifier.

Author:
Jenny Finkel
See Also:
Serialized Form

Constructor Summary
CRFDatum(java.util.List<FEAT> features, LAB label, java.util.List<double[]> featureVals)
          Constructs a new BasicDatum with the given features and label.
 
Method Summary
 java.util.List<FEAT> asFeatures()
          Returns the collection that this BasicDatum was constructed with.
 java.util.List<double[]> asFeatureVals()
          Returns the double array containing the feature values
 boolean equals(java.lang.Object o)
          Returns whether the given Datum contains the same features as this Datum.
 int hashCode()
           
 LAB label()
          Returns the label for this Datum, or null if none have been set.
 java.lang.String toString()
          Returns a String representation of this BasicDatum (lists features and labels).
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CRFDatum

public CRFDatum(java.util.List<FEAT> features,
                LAB label,
                java.util.List<double[]> featureVals)
Constructs a new BasicDatum with the given features and label.

Parameters:
features - The features of the CRFDatum
label - The label of the CRFDatum
Method Detail

asFeatures

public java.util.List<FEAT> asFeatures()
Returns the collection that this BasicDatum was constructed with.

Returns:
the collection that this BasicDatum was constructed with.

asFeatureVals

public java.util.List<double[]> asFeatureVals()
Returns the double array containing the feature values

Returns:
the double array that contains the feature values matching each feature as returned by asFeatures()

label

public LAB label()
Returns the label for this Datum, or null if none have been set.

Returns:
The label for this Datum, or null if none have been set.

toString

public java.lang.String toString()
Returns a String representation of this BasicDatum (lists features and labels).

Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Returns whether the given Datum contains the same features as this Datum. Doesn't check the labels, should we change this? (CDM Feb 2012: Also doesn't correctly respect the contract for equals, since it gives one way equality with other Datum's.)

Overrides:
equals in class java.lang.Object
Parameters:
o - The object to test equality with
Returns:
Whether it is equal to this CRFDatum in terms of features

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object


Stanford NLP Group