Package opennlp.tools.ml.model
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.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
OUTCOME_SEPARATOR
private static final char OUTCOME_SEPARATOR- See Also:
-
VALUE_SEPARATOR
private static final char VALUE_SEPARATOR- See Also:
-
FORMAT_ERROR
- See Also:
-
NOT_NAME_VALUE
- See Also:
-
NOT_A_NUMBER
- See Also:
-
INVALID_VALUE
- See Also:
-
eventList
-
-
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
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().
-