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 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()
-
-
-
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 classjava.lang.Object
-
toStringWithFeatureNames
public java.lang.String toStringWithFeatureNames()
-
toFeatureVector
public FeatureVector toFeatureVector(Alphabet dict, boolean binary)
- Specified by:
toFeatureVector
in interfacePropertyHolder
-
setProperty
public void setProperty(java.lang.String key, java.lang.Object value)
- Specified by:
setProperty
in interfacePropertyHolder
-
setNumericProperty
public void setNumericProperty(java.lang.String key, double value)
- Specified by:
setNumericProperty
in interfacePropertyHolder
-
getProperties
public PropertyList getProperties()
- Specified by:
getProperties
in interfacePropertyHolder
-
setProperties
public void setProperties(PropertyList newProperties)
- Specified by:
setProperties
in interfacePropertyHolder
-
getProperty
public java.lang.Object getProperty(java.lang.String key)
- Specified by:
getProperty
in interfacePropertyHolder
-
getNumericProperty
public double getNumericProperty(java.lang.String key)
- Specified by:
getNumericProperty
in interfacePropertyHolder
-
hasProperty
public boolean hasProperty(java.lang.String key)
- Specified by:
hasProperty
in interfacePropertyHolder
-
setFeatureValue
public void setFeatureValue(java.lang.String key, double value)
- Specified by:
setFeatureValue
in interfacePropertyHolder
-
getFeatureValue
public double getFeatureValue(java.lang.String key)
- Specified by:
getFeatureValue
in interfacePropertyHolder
-
getFeatures
public PropertyList getFeatures()
- Specified by:
getFeatures
in interfacePropertyHolder
-
setFeatures
public void setFeatures(PropertyList pl)
- Specified by:
setFeatures
in interfacePropertyHolder
-
-