|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcalhoun.analysis.crf.io.InputHandlerInterleaved
public class InputHandlerInterleaved
an InputHandler for handling input files that consist of multiple different sequences
interleaved together in a file. This input handler has a list of InterleavedInputComponents.
When reading in a file, this InputHandler opens a reader on the file and passes the reader to each
InterleavedInputComponent in turn for each sequence. Training data is assumed to be the first
line of each sequence, using an IntInput to encode the hidden states.
This input handler is useful for test data that contains multiple inputs in a file along with the training data. It is included to support backwards compatibility with the old input format.
This input handler can also work with "literal" input, where the location string that is passed in is not a file name, but the actual input data. This is used frequently to pass small volumes of data in unit tests.
| Constructor Summary | |
|---|---|
InputHandlerInterleaved()
creates a new input handler, usually to be configured from an XML file |
|
InputHandlerInterleaved(InterleavedInputComponent base)
creates a new input handler, containing a single InterleavedInputComponent |
|
InputHandlerInterleaved(InterleavedInputComponent base,
boolean locationIsLiteral)
creates a new input handler, containing a single InterleavedInputComponent |
|
| Method Summary | |
|---|---|
java.util.List<InterleavedInputComponent> |
getComponents()
gets the current set of input components configured for this input handler. |
IntInput |
getHiddenStateReader()
gets the reader used to read in results for training data. |
boolean |
isLocationIsLiteral()
gets the meaning of the input location string. |
java.util.Iterator<? extends InputSequence<?>> |
readInputData(java.lang.String location)
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 location,
boolean predict)
returns the training data read from the specified location. |
void |
setComponents(java.util.List<InterleavedInputComponent> components)
sets the current set of input components configured for this input handler. |
void |
setHiddenStateReader(IntInput hiddenStateReader)
sets the reader used to get hidden sequences. |
void |
setLocationIsLiteral(boolean literal)
sets the meaning of the input location string. |
void |
writeInputData(java.lang.String location,
java.util.Iterator<? extends InputSequence<?>> data)
writes input data to the specified location. |
void |
writeTrainingData(java.lang.String location,
java.util.List<? extends TrainingSequence<?>> 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 |
|---|
public InputHandlerInterleaved()
public InputHandlerInterleaved(InterleavedInputComponent base)
InterleavedInputComponent
base - the single input component which is contained in the input file
public InputHandlerInterleaved(InterleavedInputComponent base,
boolean locationIsLiteral)
InterleavedInputComponent
base - the single input component which is contained in the input filelocationIsLiteral - if true then the location string passed in to the read commands
is the actual input data. Otherwise, it is the location of a file from which to read the data.| Method Detail |
|---|
public java.util.Iterator<? extends InputSequence<?>> readInputData(java.lang.String location)
throws java.io.IOException
InputHandlerIterator
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.
readInputData in interface InputHandlerlocation - string location of the data. Meaning is implementation dependent.
java.io.IOException - if there is a problem reading the data
public java.util.List<? extends TrainingSequence<?>> readTrainingData(java.lang.String location)
throws java.io.IOException
readTrainingData in interface InputHandlerjava.io.IOException
public java.util.List<? extends TrainingSequence<?>> readTrainingData(java.lang.String location,
boolean predict)
throws java.io.IOException
InputHandlerIterator 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.
readTrainingData in interface InputHandlerlocation - string location of the data. Meaning is implementation dependent.
java.io.IOException - if there is a problem reading the data
public void writeInputData(java.lang.String location,
java.util.Iterator<? extends InputSequence<?>> data)
throws java.io.IOException
InputHandlerInputHandler implementation used.
writeInputData in interface InputHandlerlocation - string location of the data. Meaning is implementation dependent.data - an iterator over input sequences
java.io.IOException - if there is a problem reading the data
public void writeTrainingData(java.lang.String location,
java.util.List<? extends TrainingSequence<?>> data)
throws java.io.IOException
InputHandlerInputHandler implementation used.
writeTrainingData in interface InputHandlerlocation - string location of the data. Meaning is implementation dependent.data - a list of training sequences to write out.
java.io.IOException - if there is a problem reading the datapublic java.util.List<InterleavedInputComponent> getComponents()
public void setComponents(java.util.List<InterleavedInputComponent> components)
components - sets the interleaved input components that make up the file.public boolean isLocationIsLiteral()
public void setLocationIsLiteral(boolean literal)
literal - set locationIsLiteral to indicate whether the input data will come in as a file
or through the location string.public IntInput getHiddenStateReader()
TrainingSequenceIO used to read in the hidden sequences for trainingpublic void setHiddenStateReader(IntInput hiddenStateReader)
hiddenStateReader - the reader that will be used to access hidden states
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||