cc.mallet.pipe.iterator
Class SegmentIterator

java.lang.Object
  extended by cc.mallet.pipe.iterator.SegmentIterator
All Implemented Interfaces:
java.util.Iterator<Instance>

public class SegmentIterator
extends java.lang.Object
implements java.util.Iterator<Instance>

Iterates over Segments extracted by a Transducer for some InstanceList.


Constructor Summary
SegmentIterator(InstanceList ilist, java.lang.Object[] startTags, java.lang.Object[] inTags, java.util.ArrayList predictions)
          Useful when no Transduce is specified.
SegmentIterator(Instance instance, java.lang.Object[] startTags, java.lang.Object[] inTags, Sequence prediction)
          Iterate over segments in one instance.
SegmentIterator(Sequence input, Sequence predicted, Sequence truth, java.lang.Object[] startTags, java.lang.Object[] inTags)
          Iterate over segments in one labeled sequence
SegmentIterator(Transducer model, InstanceList ilist, java.lang.Object[] segmentStartTags, java.lang.Object[] segmentContinueTags)
          NOTE!: Assumes that segmentStartTags[i] corresponds to segmentContinueTags[i].
SegmentIterator(Transducer model, Instance instance, java.lang.Object[] segmentStartTags, java.lang.Object[] segmentContinueTags)
          Iterates over Segments for only one Instance.
 
Method Summary
 boolean hasNext()
           
 Instance next()
           
 Segment nextSegment()
           
 void remove()
           
 java.util.ArrayList toArrayList()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SegmentIterator

public SegmentIterator(Transducer model,
                       InstanceList ilist,
                       java.lang.Object[] segmentStartTags,
                       java.lang.Object[] segmentContinueTags)
NOTE!: Assumes that segmentStartTags[i] corresponds to segmentContinueTags[i].

Parameters:
model - model to segment input sequences
ilist - list of instances to be segmented
segmentStartTags - array of tags indicating the start of a segment
segmentContinueTags - array of tags indicating the continuation of a segment

SegmentIterator

public SegmentIterator(Transducer model,
                       Instance instance,
                       java.lang.Object[] segmentStartTags,
                       java.lang.Object[] segmentContinueTags)
Iterates over Segments for only one Instance.


SegmentIterator

public SegmentIterator(InstanceList ilist,
                       java.lang.Object[] startTags,
                       java.lang.Object[] inTags,
                       java.util.ArrayList predictions)
Useful when no Transduce is specified. A list of sequences specifies the output.

Parameters:
ilist - InstanceList containing sequence.
segmentStartTags - array of tags indicating the start of a segment
segmentContinueTags - array of tags indicating the continuation of a segment
predictions - list of Sequences that are the predicted output of some Transducer

SegmentIterator

public SegmentIterator(Instance instance,
                       java.lang.Object[] startTags,
                       java.lang.Object[] inTags,
                       Sequence prediction)
Iterate over segments in one instance.

Parameters:
ilist - InstanceList containing sequence.
segmentStartTags - array of tags indicating the start of a segment
segmentContinueTags - array of tags indicating the continuation of a segment
predictions - list of Sequences that are the predicted output of some Transducer

SegmentIterator

public SegmentIterator(Sequence input,
                       Sequence predicted,
                       Sequence truth,
                       java.lang.Object[] startTags,
                       java.lang.Object[] inTags)
Iterate over segments in one labeled sequence

Method Detail

next

public Instance next()
Specified by:
next in interface java.util.Iterator<Instance>

nextSegment

public Segment nextSegment()

hasNext

public boolean hasNext()
Specified by:
hasNext in interface java.util.Iterator<Instance>

toArrayList

public java.util.ArrayList toArrayList()

remove

public void remove()
Specified by:
remove in interface java.util.Iterator<Instance>