Class WordTagSampleStream
java.lang.Object
opennlp.tools.util.FilterObjectStream<String, opennlp.tools.postag.POSSample>
opennlp.tools.postag.WordTagSampleStream
- All Implemented Interfaces:
AutoCloseable, opennlp.tools.util.ObjectStream<opennlp.tools.postag.POSSample>
A
stream filter which reads a sentence per line that contains
words and tags in word_tag format and outputs a POSSample objects.-
Constructor Summary
ConstructorsConstructorDescriptionWordTagSampleStream(opennlp.tools.util.ObjectStream<String> sentences) Initializes aPOSSampleinstance. -
Method Summary
Modifier and TypeMethodDescriptionopennlp.tools.postag.POSSampleread()Reads the next tokens and parses it into the nextPOSSampleobject.Methods inherited from class FilterObjectStream
close, reset
-
Constructor Details
-
WordTagSampleStream
Initializes aPOSSampleinstance.- Parameters:
sentences- Thesentencesto wrap.
-
-
Method Details
-
read
Reads the next tokens and parses it into the nextPOSSampleobject.If an error occurs an empty
POSSampleobject is returned and a warning message is logged. Usually it does not matter if one or many sentences are ignored.- Returns:
- A valid
POSSampleornullif thestreamis exhausted. - Throws:
IOException- Thrown if IO errors occurred during read.
-