Package cc.mallet.types
Class TokenSequence
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- java.util.ArrayList<Token>
-
- cc.mallet.types.TokenSequence
-
- All Implemented Interfaces:
Sequence
,java.io.Serializable
,java.lang.Cloneable
,java.lang.Iterable<Token>
,java.util.Collection<Token>
,java.util.List<Token>
,java.util.RandomAccess
- Direct Known Subclasses:
StringTokenization
public class TokenSequence extends java.util.ArrayList<Token> implements Sequence, java.io.Serializable
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 TokenSequence()
TokenSequence(int capacity)
TokenSequence(Token[] tokens)
TokenSequence(java.lang.Object[] tokens)
TokenSequence(java.util.Collection<Token> tokens)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(java.lang.String string)
void
addAll(java.lang.Object[] objects)
double
getNumericProperty(java.lang.String key)
PropertyList
getProperties()
java.lang.Object
getProperty(java.lang.String key)
boolean
hasProperty(java.lang.String key)
java.lang.Object
removeLast()
void
setNumericProperty(java.lang.String key, double value)
void
setProperty(java.lang.String key, java.lang.Object value)
FeatureSequence
toFeatureSequence(Alphabet dict)
FeatureVector
toFeatureVector(Alphabet dict)
java.lang.String
toString()
java.lang.String
toStringShort()
-
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, equals, forEach, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize
-
-
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.util.AbstractCollection<Token>
-
toStringShort
public java.lang.String toStringShort()
-
add
public void add(java.lang.String string)
-
removeLast
public java.lang.Object removeLast()
-
addAll
public void addAll(java.lang.Object[] objects)
-
toFeatureSequence
public FeatureSequence toFeatureSequence(Alphabet dict)
-
toFeatureVector
public FeatureVector toFeatureVector(Alphabet dict)
-
setNumericProperty
public void setNumericProperty(java.lang.String key, double value)
-
setProperty
public void setProperty(java.lang.String key, java.lang.Object value)
-
getNumericProperty
public double getNumericProperty(java.lang.String key)
-
getProperty
public java.lang.Object getProperty(java.lang.String key)
-
hasProperty
public boolean hasProperty(java.lang.String key)
-
getProperties
public PropertyList getProperties()
-
-