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

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

public class CRFDatum<FEAT extends Serializable,LAB extends Serializable>
extends Object
implements Serializable

The representation of Datums used internally in CRFClassifier.

Author:
Jenny Finkel
See Also:
Serialized Form

Constructor Summary
CRFDatum(List<FEAT> features)
          Constructs a new BasicDatum with the given features and no labels.
CRFDatum(List<FEAT> features, LAB label)
          Constructs a new BasicDatum with the given features and label.
 
Method Summary
 List<FEAT> asFeatures()
          Returns the collection that this BasicDatum was constructed with.
 boolean equals(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.
 void setLabel(LAB label)
          Removes all currently assigned Labels for this Datum then adds the given Label.
 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(List<FEAT> features,
                LAB label)
Constructs a new BasicDatum with the given features and label.

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

CRFDatum

public CRFDatum(List<FEAT> features)
Constructs a new BasicDatum with the given features and no labels.

Parameters:
features - The features of the CRFDatum
Method Detail

asFeatures

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

Returns:
the collection that this BasicDatum was constructed with.

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.

setLabel

public void setLabel(LAB label)
Removes all currently assigned Labels for this Datum then adds the given Label. Calling setLabel(null) effectively clears all labels.

Parameters:
label - New label for CRFDatum

toString

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

Overrides:
toString in class Object

equals

public boolean equals(Object o)
Returns whether the given Datum contains the same features as this Datum. Doesn't check the labels, should we change this?

Overrides:
equals in class 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 Object


Stanford NLP Group