cc.mallet.types
Class Token

java.lang.Object
  extended by cc.mallet.types.Token
All Implemented Interfaces:
PropertyHolder, java.io.Serializable
Direct Known Subclasses:
StringSpan

public class Token
extends java.lang.Object
implements java.io.Serializable, PropertyHolder

A representation of a piece of text, usually a single word, to which we can attach properties.

See Also:
Serialized Form

Constructor Summary
Token(java.lang.String s)
           
 
Method Summary
 PropertyList getFeatures()
           
 double getFeatureValue(java.lang.String key)
           
 double getNumericProperty(java.lang.String key)
           
 PropertyList getProperties()
           
 java.lang.Object getProperty(java.lang.String key)
           
 java.lang.String getText()
           
 boolean hasProperty(java.lang.String key)
           
 void setFeatures(PropertyList pl)
           
 void setFeatureValue(java.lang.String key, double value)
           
 void setNumericProperty(java.lang.String key, double value)
           
 void setProperties(PropertyList newProperties)
           
 void setProperty(java.lang.String key, java.lang.Object value)
           
 void setText(java.lang.String t)
           
 FeatureVector toFeatureVector(Alphabet dict, boolean binary)
           
 java.lang.String toString()
           
 java.lang.String toStringWithFeatureNames()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Token

public Token(java.lang.String s)
Method Detail

getText

public java.lang.String getText()

setText

public void setText(java.lang.String t)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

toStringWithFeatureNames

public java.lang.String toStringWithFeatureNames()

toFeatureVector

public FeatureVector toFeatureVector(Alphabet dict,
                                     boolean binary)
Specified by:
toFeatureVector in interface PropertyHolder

setProperty

public void setProperty(java.lang.String key,
                        java.lang.Object value)
Specified by:
setProperty in interface PropertyHolder

setNumericProperty

public void setNumericProperty(java.lang.String key,
                               double value)
Specified by:
setNumericProperty in interface PropertyHolder

getProperties

public PropertyList getProperties()
Specified by:
getProperties in interface PropertyHolder

setProperties

public void setProperties(PropertyList newProperties)
Specified by:
setProperties in interface PropertyHolder

getProperty

public java.lang.Object getProperty(java.lang.String key)
Specified by:
getProperty in interface PropertyHolder

getNumericProperty

public double getNumericProperty(java.lang.String key)
Specified by:
getNumericProperty in interface PropertyHolder

hasProperty

public boolean hasProperty(java.lang.String key)
Specified by:
hasProperty in interface PropertyHolder

setFeatureValue

public void setFeatureValue(java.lang.String key,
                            double value)
Specified by:
setFeatureValue in interface PropertyHolder

getFeatureValue

public double getFeatureValue(java.lang.String key)
Specified by:
getFeatureValue in interface PropertyHolder

getFeatures

public PropertyList getFeatures()
Specified by:
getFeatures in interface PropertyHolder

setFeatures

public void setFeatures(PropertyList pl)
Specified by:
setFeatures in interface PropertyHolder