Class SimpleEventStreamBuilder
java.lang.Object
opennlp.tools.ml.model.SimpleEventStreamBuilder
Builds an in-memory
ObjectStream of events from text lines,
mainly for tests. See add(String) for the format.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds one event.opennlp.tools.util.ObjectStream<opennlp.tools.ml.model.Event> build()Returns astreamover the events added so far.
-
Constructor Details
-
SimpleEventStreamBuilder
public SimpleEventStreamBuilder()
-
-
Method Details
-
add
Adds one event. The outcome runs up to the first/; the contexts follow it, separated by runs of space, tab, carriage return, line feed and form feed, as inFileEventStream. Other characters remain in the context names. Each context can have a value after a;:other/w=he n1w=belongs n2w=to po=other pow=other,He powf=other,ic other/w=he;0.5 n1w=belongs;0.4 n2w=to;0.3 po=other;0.5 pow=other,He;0.25 powf=other,ic;0.5
- Parameters:
event- The event text. Must not benull.- Returns:
- This builder.
- Throws:
IllegalArgumentException- Thrown ifeventisnull, if the outcome or the contexts are missing, if the first context has a value and another one is not written asname;valuewith both parts present and no further;, or if a value is not a number, is negative, NaN or infinite.
-
build
public opennlp.tools.util.ObjectStream<opennlp.tools.ml.model.Event> build()Returns astreamover the events added so far. Each call returns a new stream that starts at the first event, and events added later do not appear in it.- Returns:
- An
ObjectStreamover the added events, in insertion order. The stream does not supportObjectStream.reset().
-