calhoun.analysis.crf.io
Class CompositeInput.LegacyInputHandler

java.lang.Object
  extended by calhoun.analysis.crf.io.CompositeInput.LegacyInputHandler
All Implemented Interfaces:
InputHandler, java.io.Serializable
Enclosing class:
CompositeInput

public static class CompositeInput.LegacyInputHandler
extends java.lang.Object
implements InputHandler

legacy InputHandler that mirrors the original XML config file behavior. There is a small amount of support in Conrad to set this up to be truly backwards compatible.

See Also:
Serialized Form

Constructor Summary
CompositeInput.LegacyInputHandler(java.lang.Object inputComponent)
          special constructor used by Conrad to pass the old style input config to the legacy input handler.
 
Method Summary
 java.util.Iterator<? extends InputSequence<?>> readInputData(java.lang.String inputLocation)
          returns the input data read from the specified location.
 java.util.List<? extends TrainingSequence<?>> readTrainingData(java.lang.String location)
           
 java.util.List<? extends TrainingSequence<?>> readTrainingData(java.lang.String inputLocation, boolean predict)
          returns the training data read from the specified location.
 void writeInputData(java.lang.String location, java.util.Iterator data)
          writes input data to the specified location.
 void writeTrainingData(java.lang.String location, java.util.List data)
          writes training data to the specified location.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompositeInput.LegacyInputHandler

public CompositeInput.LegacyInputHandler(java.lang.Object inputComponent)
special constructor used by Conrad to pass the old style input config to the legacy input handler.

Parameters:
inputComponent - the originally configured inputFormat bean.
Method Detail

readInputData

public java.util.Iterator<? extends InputSequence<?>> readInputData(java.lang.String inputLocation)
                                                             throws java.io.IOException
Description copied from interface: InputHandler
returns the input data read from the specified location. The result is returned as an Iterator because the inference algorithms can predict on the sequences one at a time. The interpretation of the location string is dependent on the particular InputHandler implementation used.

Specified by:
readInputData in interface InputHandler
Parameters:
inputLocation - string location of the data. Meaning is implementation dependent.
Returns:
an iterator over input sequences
Throws:
java.io.IOException - if there is a problem reading the data

readTrainingData

public java.util.List<? extends TrainingSequence<?>> readTrainingData(java.lang.String location)
                                                               throws java.io.IOException
Specified by:
readTrainingData in interface InputHandler
Throws:
java.io.IOException

readTrainingData

public java.util.List<? extends TrainingSequence<?>> readTrainingData(java.lang.String inputLocation,
                                                                      boolean predict)
                                                               throws java.io.IOException
Description copied from interface: InputHandler
returns the training data read from the specified location. Training data includes input data and hidden sequences. The result is returned as a Iterator so algorithms are not forced to hold all of the training data at once (although most will). The interpretation of the location string is dependent on the particular InputHandler implementation used.

Specified by:
readTrainingData in interface InputHandler
Parameters:
inputLocation - string location of the data. Meaning is implementation dependent.
Returns:
a list of training sequences
Throws:
java.io.IOException - if there is a problem reading the data

writeTrainingData

public void writeTrainingData(java.lang.String location,
                              java.util.List data)
                       throws java.io.IOException
Description copied from interface: InputHandler
writes training data to the specified location. Training data includes input data and hidden sequences. The interpretation of the location string is dependent on the particular InputHandler implementation used.

Specified by:
writeTrainingData in interface InputHandler
Parameters:
location - string location of the data. Meaning is implementation dependent.
data - a list of training sequences to write out.
Throws:
java.io.IOException - if there is a problem reading the data

writeInputData

public void writeInputData(java.lang.String location,
                           java.util.Iterator data)
                    throws java.io.IOException
Description copied from interface: InputHandler
writes input data to the specified location. The interpretation of the location string is dependent on the particular InputHandler implementation used.

Specified by:
writeInputData in interface InputHandler
Parameters:
location - string location of the data. Meaning is implementation dependent.
data - an iterator over input sequences
Throws:
java.io.IOException - if there is a problem reading the data