Package cc.mallet.types
Class Token
- java.lang.Object
-
- 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
Constructors Constructor Description Token(java.lang.String s)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PropertyListgetFeatures()doublegetFeatureValue(java.lang.String key)doublegetNumericProperty(java.lang.String key)PropertyListgetProperties()java.lang.ObjectgetProperty(java.lang.String key)java.lang.StringgetText()booleanhasProperty(java.lang.String key)voidsetFeatures(PropertyList pl)voidsetFeatureValue(java.lang.String key, double value)voidsetNumericProperty(java.lang.String key, double value)voidsetProperties(PropertyList newProperties)voidsetProperty(java.lang.String key, java.lang.Object value)voidsetText(java.lang.String t)FeatureVectortoFeatureVector(Alphabet dict, boolean binary)java.lang.StringtoString()java.lang.StringtoStringWithFeatureNames()
-
-
-
Method Detail
-
getText
public java.lang.String getText()
-
setText
public void setText(java.lang.String t)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
toStringWithFeatureNames
public java.lang.String toStringWithFeatureNames()
-
toFeatureVector
public FeatureVector toFeatureVector(Alphabet dict, boolean binary)
- Specified by:
toFeatureVectorin interfacePropertyHolder
-
setProperty
public void setProperty(java.lang.String key, java.lang.Object value)- Specified by:
setPropertyin interfacePropertyHolder
-
setNumericProperty
public void setNumericProperty(java.lang.String key, double value)- Specified by:
setNumericPropertyin interfacePropertyHolder
-
getProperties
public PropertyList getProperties()
- Specified by:
getPropertiesin interfacePropertyHolder
-
setProperties
public void setProperties(PropertyList newProperties)
- Specified by:
setPropertiesin interfacePropertyHolder
-
getProperty
public java.lang.Object getProperty(java.lang.String key)
- Specified by:
getPropertyin interfacePropertyHolder
-
getNumericProperty
public double getNumericProperty(java.lang.String key)
- Specified by:
getNumericPropertyin interfacePropertyHolder
-
hasProperty
public boolean hasProperty(java.lang.String key)
- Specified by:
hasPropertyin interfacePropertyHolder
-
setFeatureValue
public void setFeatureValue(java.lang.String key, double value)- Specified by:
setFeatureValuein interfacePropertyHolder
-
getFeatureValue
public double getFeatureValue(java.lang.String key)
- Specified by:
getFeatureValuein interfacePropertyHolder
-
getFeatures
public PropertyList getFeatures()
- Specified by:
getFeaturesin interfacePropertyHolder
-
setFeatures
public void setFeatures(PropertyList pl)
- Specified by:
setFeaturesin interfacePropertyHolder
-
-