|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.stanford.nlp.ling.BasicDatum<LabelType,FeatureType>
LabelType - The type of the labels in the DatasetFeatureType - The type of the features in the Datasetpublic class BasicDatum<LabelType,FeatureType>
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.
| Constructor Summary | |
|---|---|
BasicDatum()
Constructs a new BasicDatum with no features or labels. |
|
BasicDatum(java.util.Collection<FeatureType> features)
Constructs a new BasicDatum with the given features and no labels. |
|
BasicDatum(java.util.Collection<FeatureType> features,
java.util.Collection<LabelType> labels)
Constructs a new BasicDatum with the given features and labels. |
|
BasicDatum(java.util.Collection<FeatureType> features,
LabelType label)
Constructs a new BasicDatum with the given features and label. |
|
| Method Summary | |
|---|---|
void |
addLabel(LabelType label)
Adds the given Label to the List of labels for this Datum if it is not null. |
java.util.Collection<FeatureType> |
asFeatures()
Returns the collection that this BasicDatum was constructed with. |
boolean |
equals(java.lang.Object o)
Returns whether the given Datum contains the same features as this Datum. |
int |
hashCode()
|
LabelType |
label()
Returns the first label for this Datum, or null if none have been set. |
java.util.Collection<LabelType> |
labels()
Returns the complete List of labels for this Datum, which may be empty. |
void |
setLabel(LabelType label)
Removes all currently assigned Labels for this Datum then adds the given Label. |
void |
setLabels(java.util.Collection<LabelType> labels)
Removes all currently assigned labels for this Datum then adds all of the given Labels. |
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 |
|---|
public BasicDatum(java.util.Collection<FeatureType> features,
java.util.Collection<LabelType> labels)
public BasicDatum(java.util.Collection<FeatureType> features,
LabelType label)
public BasicDatum(java.util.Collection<FeatureType> features)
public BasicDatum()
| Method Detail |
|---|
public java.util.Collection<FeatureType> asFeatures()
asFeatures in interface Featurizable<FeatureType>public LabelType label()
label in interface Labeled<LabelType>public java.util.Collection<LabelType> labels()
labels in interface Labeled<LabelType>public void setLabel(LabelType label)
public void setLabels(java.util.Collection<LabelType> labels)
public void addLabel(LabelType label)
public java.lang.String toString()
toString in class java.lang.Objectpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||