edu.stanford.nlp.ling
Class RVFDatum

java.lang.Object
  extended by edu.stanford.nlp.ling.RVFDatum
All Implemented Interfaces:
Datum, Featurizable, Labeled, Serializable

public class RVFDatum
extends Object
implements Datum

Basic implementation of Datum interface that can be constructed with a Collection of features and one more more labels. The features must be specified at construction, but the labels can be set and/or changed later.

Author:
Jenny Finkel jrfinkel@stanford.edu
See Also:
Serialized Form

Constructor Summary
RVFDatum()
          Constructs a new RVFDatum with no features or labels.
RVFDatum(Counter features)
          Constructs a new RVFDatum with the given features and no labels.
RVFDatum(Counter features, Object label)
          Constructs a new RVFDatum with the given features and label.
RVFDatum(Datum m)
          Constructs a new RVFDatum taking the data from a Datum
 
Method Summary
 Collection asFeatures()
          Returns the list of features without values
 Counter asFeaturesCounter()
          Returns the Counter of features and values
 boolean equals(Object o)
          Returns whether the given Datum contains the same features as this Datum.
 Object label()
          Returns the primary label for this Object, or null if none have been set.
 Collection labels()
          Returns the complete list of labels for this Object, which may be empty.
 void setLabel(Object 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, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RVFDatum

public RVFDatum(Counter features,
                Object label)
Constructs a new RVFDatum with the given features and label.


RVFDatum

public RVFDatum(Datum m)
Constructs a new RVFDatum taking the data from a Datum

Parameters:
m -

RVFDatum

public RVFDatum(Counter features)
Constructs a new RVFDatum with the given features and no labels.


RVFDatum

public RVFDatum()
Constructs a new RVFDatum with no features or labels.

Method Detail

asFeaturesCounter

public Counter asFeaturesCounter()
Returns the Counter of features and values


asFeatures

public Collection asFeatures()
Returns the list of features without values

Specified by:
asFeatures in interface Featurizable

setLabel

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


toString

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

Overrides:
toString in class Object

label

public Object label()
Description copied from interface: Labeled
Returns the primary label for this Object, or null if none have been set.

Specified by:
label in interface Labeled

labels

public Collection labels()
Description copied from interface: Labeled
Returns the complete list of labels for this Object, which may be empty.

Specified by:
labels in interface Labeled

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


Stanford NLP Group