calhoun.analysis.crf.io
Class IntInput

java.lang.Object
  extended by calhoun.analysis.crf.io.InterleavedInputComponentBase
      extended by calhoun.analysis.crf.io.IntInput
All Implemented Interfaces:
InputComponentIO, InterleavedInputComponent, TrainingSequenceIO, java.io.Serializable
Direct Known Subclasses:
Interval21HiddenSequenceTranslator, IntInputInterval29

public class IntInput
extends InterleavedInputComponentBase
implements TrainingSequenceIO

reads in an input consisting of a list of ints that correspond to binary values. Can be used as a standalone input component or part of an interleaved input.

See Also:
Serialized Form

Constructor Summary
IntInput()
           
 
Method Summary
static java.util.List<? extends TrainingSequence<?>> prepareData(java.lang.String str)
          Convenience function for creating training sequences in test data.
 boolean read(java.io.BufferedReader r, java.util.Map<java.lang.String,InputSequence<?>> output)
          Read the contents of the sequence in from a reader.
 int[] readSequence(java.io.BufferedReader r)
           
 void readTrainingSequences(java.lang.Object location, java.util.List<TrainingSequence<java.util.Map<java.lang.String,java.lang.Object>>> seqs)
          reads training sequences from the specified location.
 void write(java.io.Writer w, java.util.Map<java.lang.String,? extends InputSequence<?>> data)
          Output this sequence to the given writer.
 void writeSequence(java.io.Writer w, int[] data)
           
 void writeTrainingSequences(java.lang.Object location, java.util.Iterator<int[]> data)
          writes training sequences to the specified location.
 
Methods inherited from class calhoun.analysis.crf.io.InterleavedInputComponentBase
getComponentNames, getName, readInputSequences, setName, writeInputSequences
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IntInput

public IntInput()
Method Detail

read

public boolean read(java.io.BufferedReader r,
                    java.util.Map<java.lang.String,InputSequence<?>> output)
             throws java.io.IOException
Description copied from interface: InterleavedInputComponent
Read the contents of the sequence in from a reader. Return false if the end of file was reached.

Specified by:
read in interface InterleavedInputComponent
Parameters:
r - the buffered reader from which the next sequence should be read.
output - a map to which new components for this input sequence should be added.
Returns:
true if a sequence was read in and the map was populated. false if the end of the sequence was reached.
Throws:
java.io.IOException

readSequence

public int[] readSequence(java.io.BufferedReader r)
                   throws java.io.IOException
Throws:
java.io.IOException

write

public void write(java.io.Writer w,
                  java.util.Map<java.lang.String,? extends InputSequence<?>> data)
           throws java.io.IOException
Description copied from interface: InterleavedInputComponent
Output this sequence to the given writer.

Specified by:
write in interface InterleavedInputComponent
Parameters:
w - a writer to which this sequence should be written
data - a map containing the data for the sequence to be written
Throws:
java.io.IOException

writeSequence

public void writeSequence(java.io.Writer w,
                          int[] data)
                   throws java.io.IOException
Throws:
java.io.IOException

readTrainingSequences

public void readTrainingSequences(java.lang.Object location,
                                  java.util.List<TrainingSequence<java.util.Map<java.lang.String,java.lang.Object>>> seqs)
                           throws java.io.IOException
Description copied from interface: TrainingSequenceIO
reads training sequences from the specified location.

Specified by:
readTrainingSequences in interface TrainingSequenceIO
Parameters:
location - location of the training sequences. Meaning is implementation dependent.
seqs - a list of the input sequences to which hidden sequences should be added. Each hidden sequence is an array of integers containing hidden state indices.
Throws:
java.io.IOException

writeTrainingSequences

public void writeTrainingSequences(java.lang.Object location,
                                   java.util.Iterator<int[]> data)
                            throws java.io.IOException
Description copied from interface: TrainingSequenceIO
writes training sequences to the specified location.

Specified by:
writeTrainingSequences in interface TrainingSequenceIO
Parameters:
location - location of the training sequences. Meaning is implementation dependent.
data - iterator over the hidden states to write.
Throws:
java.io.IOException

prepareData

public static java.util.List<? extends TrainingSequence<?>> prepareData(java.lang.String str)
                                                                 throws java.lang.Exception
Convenience function for creating training sequences in test data.

Throws:
java.lang.Exception