dragon.ml.seqmodel.data
Class BasicDataSequence

java.lang.Object
  |
  +--dragon.ml.seqmodel.data.BasicDataSequence
All Implemented Interfaces:
DataSequence

public class BasicDataSequence
extends java.lang.Object
implements DataSequence

Basic data structure for sequence data

Copyright: Copyright (c) 2005

Company: IST, Drexel University

Version:
1.0
Author:
Davis Zhou

Constructor Summary
BasicDataSequence()
           
BasicDataSequence(int length)
           
 
Method Summary
 void add(BasicToken token)
           
 DataSequence copy()
          Makes a copy of the current data sequence
 int getLabel(int pos)
          Gets the label of the token in the given position
 int getOriginalLabel(int pos)
          Gets the original label of the token in the given position.
 Dataset getParent()
          Gets the dataset object which the current data sequence belongs to
 int getSegmentEnd(int segmentStart)
          Gets the ending position of the segment beginning at the given position
 BasicToken getToken(int pos)
          Gets the token in the given position of the sequence
 int length()
           
 void setLabel(int pos, int label)
          Sets the label to the token in the given position.
 void setParent(Dataset parent)
          Sets the dataset object which the current data sequence belongs to
 void setSegment(int segmentStart, int segmentEnd, int label)
          Marks the bondary of the segment and sets the given label to all tokens of the segment.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicDataSequence

public BasicDataSequence()

BasicDataSequence

public BasicDataSequence(int length)
Method Detail

copy

public DataSequence copy()
Description copied from interface: DataSequence
Makes a copy of the current data sequence

Specified by:
copy in interface DataSequence
Returns:
a copy of the current data sequence

getParent

public Dataset getParent()
Description copied from interface: DataSequence
Gets the dataset object which the current data sequence belongs to

Specified by:
getParent in interface DataSequence
Returns:
he dataset object which the current data sequence belongs to

setParent

public void setParent(Dataset parent)
Description copied from interface: DataSequence
Sets the dataset object which the current data sequence belongs to

Specified by:
setParent in interface DataSequence
Parameters:
parent - the parsent dataset

length

public int length()
Specified by:
length in interface DataSequence
Returns:
the length of the sequence

getLabel

public int getLabel(int pos)
Description copied from interface: DataSequence
Gets the label of the token in the given position

Specified by:
getLabel in interface DataSequence
Parameters:
pos - the position in the sequence
Returns:
the label of the token in the given position

getOriginalLabel

public int getOriginalLabel(int pos)
Description copied from interface: DataSequence
Gets the original label of the token in the given position. For high order markov models, the getLabel method returns a label which combines the current label and the lables of previous positions. However, this method still returns the original label of the given position.

Specified by:
getOriginalLabel in interface DataSequence
Parameters:
pos - the position in the sequence
Returns:
the label of the token in the given position

getToken

public BasicToken getToken(int pos)
Description copied from interface: DataSequence
Gets the token in the given position of the sequence

Specified by:
getToken in interface DataSequence
Parameters:
pos - the position of the token
Returns:
a token object in the given position

setLabel

public void setLabel(int pos,
                     int label)
Description copied from interface: DataSequence
Sets the label to the token in the given position. Same as the getLabel method, for high order markov models, the input label is actually a combined label. This method will convert the combined label to original lable (i.e. the label in the first order)

Specified by:
setLabel in interface DataSequence
Parameters:
pos - the position of the token
label - the label for the position

add

public void add(BasicToken token)

getSegmentEnd

public int getSegmentEnd(int segmentStart)
Description copied from interface: DataSequence
Gets the ending position of the segment beginning at the given position

Specified by:
getSegmentEnd in interface DataSequence
Parameters:
segmentStart - the starting position of the segment
Returns:
the ending position of the segment beginning at the given position

setSegment

public void setSegment(int segmentStart,
                       int segmentEnd,
                       int label)
Description copied from interface: DataSequence
Marks the bondary of the segment and sets the given label to all tokens of the segment.

Specified by:
setSegment in interface DataSequence
Parameters:
segmentStart - the starting position of the segment
segmentEnd - the ending position of the segment
label - the lable for the segment