edu.umass.cs.mallet.base.types
Class TokenSequence

java.lang.Object
  extended byedu.umass.cs.mallet.base.types.TokenSequence
All Implemented Interfaces:
PipeOutputAccumulator, Sequence, java.io.Serializable
Direct Known Subclasses:
StringTokenization

public class TokenSequence
extends java.lang.Object
implements PipeOutputAccumulator, 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
TokenSequence()
           
TokenSequence(java.util.Collection tokens)
           
TokenSequence(int capacity)
           
TokenSequence(java.lang.Object[] tokens)
           
TokenSequence(Token[] tokens)
           
 
Method Summary
 void add(java.lang.Object o)
           
 void add(Token t)
           
 void addAll(java.lang.Object[] tokens)
           
 void addAll(Token[] tokens)
           
 void addAll(TokenSequence ts)
           
 PipeOutputAccumulator clonePipeOutputAccumulator()
           
 java.lang.Object get(int i)
           
 double getNumericProperty(java.lang.String key)
           
 java.lang.Object getProperty(java.lang.String key)
           
 Token getToken(int i)
           
 boolean hasProperty(java.lang.String key)
           
 java.util.Iterator iterator()
           
 void pipeOutputAccumulate(Instance carrier, Pipe iteratedPipe)
           
 java.lang.Object remove(int index)
           
 java.lang.Object removeLastToken()
           
 void setNumericProperty(java.lang.String key, double value)
           
 void setProperty(java.lang.String key, java.lang.Object value)
           
 int size()
           
 FeatureSequence toFeatureSequence(Alphabet dict)
           
 FeatureVector toFeatureVector(Alphabet dict)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TokenSequence

public TokenSequence(java.util.Collection tokens)

TokenSequence

public TokenSequence()

TokenSequence

public TokenSequence(int capacity)

TokenSequence

public TokenSequence(Token[] tokens)

TokenSequence

public TokenSequence(java.lang.Object[] tokens)
Method Detail

size

public int size()
Specified by:
size in interface Sequence

toString

public java.lang.String toString()

getToken

public Token getToken(int i)

get

public java.lang.Object get(int i)
Specified by:
get in interface Sequence

add

public void add(java.lang.Object o)

add

public void add(Token t)

remove

public java.lang.Object remove(int index)

removeLastToken

public java.lang.Object removeLastToken()

addAll

public void addAll(TokenSequence ts)

addAll

public void addAll(Token[] tokens)

addAll

public void addAll(java.lang.Object[] tokens)

iterator

public java.util.Iterator iterator()

pipeOutputAccumulate

public void pipeOutputAccumulate(Instance carrier,
                                 Pipe iteratedPipe)
Specified by:
pipeOutputAccumulate in interface PipeOutputAccumulator

clonePipeOutputAccumulator

public PipeOutputAccumulator clonePipeOutputAccumulator()
Specified by:
clonePipeOutputAccumulator in interface PipeOutputAccumulator

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)