Package opennlp.tools.ml.model
Class RealValueFileEventStream
java.lang.Object
opennlp.tools.ml.model.FileEventStream
opennlp.tools.ml.model.RealValueFileEventStream
- All Implemented Interfaces:
- AutoCloseable,- ObjectStream<Event>
Class for using a file of real-valued 
events as an
 event stream.
 The format of the file is one event per line with
 each line consisting of outcome followed by contexts (space delimited).- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionRealValueFileEventStream(File file) Instantiates aRealValueFileEventStreamvia aFile.RealValueFileEventStream(Reader reader) Instantiates aRealValueFileEventStreamvia aReader.RealValueFileEventStream(String fileName) Instantiates aRealValueFileEventStreamfrom the specified file name.RealValueFileEventStream(String fileName, String encoding) Instantiates aRealValueFileEventStreamfrom the specified file name.
- 
Method SummaryModifier and TypeMethodDescriptionstatic float[]parseContexts(String[] contexts) Parses the specifiedcontextsand re-populates context array with features and returns the values for these features.read()Returns the nextEventobject.Methods inherited from class opennlp.tools.ml.model.FileEventStreamclose, reset, toLine
- 
Constructor Details- 
RealValueFileEventStreamInstantiates aRealValueFileEventStreamfrom the specified file name.- Parameters:
- fileName- The name fo the file containing the events.
- Throws:
- IOException- Thrown if the specified file can not be read.
 
- 
RealValueFileEventStreamInstantiates aRealValueFileEventStreamfrom the specified file name.- Parameters:
- fileName- The name fo the file containing the events.
- encoding- The name of the- character encoding.
- Throws:
- IOException- Thrown if the specified file can not be read.
 
- 
RealValueFileEventStreamInstantiates aRealValueFileEventStreamvia aFile.- Parameters:
- file- The- Filethat holds events.
- Throws:
- IOException- Thrown if the specified file can not be read.
 
- 
RealValueFileEventStreamInstantiates aRealValueFileEventStreamvia aReader.- Parameters:
- reader- The- Readerthat holds events.
- Throws:
- IOException- Thrown if the specified file can not be read.
 
 
- 
- 
Method Details- 
parseContextsParses the specifiedcontextsand re-populates context array with features and returns the values for these features. If all values are unspecified, thennullis returned.- Parameters:
- contexts- The contexts with real values specified.
- Returns:
- The value for each context or nullif all values are unspecified.
- Throws:
- RuntimeException- Thrown if negative real values are detected in the input data.
 
- 
readReturns the nextEventobject. Calling this method repeatedly until it returnsnullwill return each object from the underlying source exactly once.- Specified by:
- readin interface- ObjectStream<Event>
- Overrides:
- readin class- FileEventStream
- Returns:
- The next object or nullto signal that the stream is exhausted.
- Throws:
- IOException- Thrown if there is an error during reading.
- RuntimeException- Thrown if negative real values are detected in the input data.
 
 
-