Class RealBasicEventStream

java.lang.Object
opennlp.tools.ml.maxent.RealBasicEventStream
All Implemented Interfaces:
AutoCloseable, opennlp.tools.util.ObjectStream<opennlp.tools.ml.model.Event>

public class RealBasicEventStream extends Object implements opennlp.tools.util.ObjectStream<opennlp.tools.ml.model.Event>
Class for real-valued events as an event stream.
See Also:
  • Event
  • ObjectStream
  • Constructor Details

    • RealBasicEventStream

      public RealBasicEventStream(opennlp.tools.util.ObjectStream<String> ds)
      Instantiates a RealBasicEventStream over a stream of event lines.
      Parameters:
      ds - The ObjectStream of lines, one event per line. Must not be null.
      Throws:
      IllegalArgumentException - Thrown if ds is null.
  • Method Details

    • read

      public opennlp.tools.ml.model.Event read() throws IOException

      Each line is parsed by RealValueFileEventStream.parseEvent(String). A line with only an outcome yields an event without contexts.

      Specified by:
      read in interface opennlp.tools.util.ObjectStream<opennlp.tools.ml.model.Event>
      Throws:
      IOException - Thrown if there is an error during reading.
      opennlp.tools.util.InvalidFormatException - Thrown if a line is blank.
      IllegalArgumentException - Thrown if a value is negative, NaN or infinite.
    • reset

      public void reset() throws IOException, UnsupportedOperationException
      Specified by:
      reset in interface opennlp.tools.util.ObjectStream<opennlp.tools.ml.model.Event>
      Throws:
      IOException
      UnsupportedOperationException
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface opennlp.tools.util.ObjectStream<opennlp.tools.ml.model.Event>
      Throws:
      IOException