Package opennlp.tools.postag
Class WordTagSampleStream
- java.lang.Object
-
- opennlp.tools.util.FilterObjectStream<String,POSSample>
-
- opennlp.tools.postag.WordTagSampleStream
-
- All Implemented Interfaces:
AutoCloseable,ObjectStream<POSSample>
public class WordTagSampleStream extends FilterObjectStream<String,POSSample>
A stream filter which reads a sentence per line which contains words and tags inword_tagformat and outputs aPOSSampleobjects.
-
-
Constructor Summary
Constructors Constructor Description WordTagSampleStream(ObjectStream<String> sentences)Initializes aPOSSampleinstance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description POSSampleread()Parses the next sentence and return the nextPOSSampleobject.-
Methods inherited from class opennlp.tools.util.FilterObjectStream
close, reset
-
-
-
-
Constructor Detail
-
WordTagSampleStream
public WordTagSampleStream(ObjectStream<String> sentences)
Initializes aPOSSampleinstance.- Parameters:
sentences- Thesentencesto wrap.
-
-
Method Detail
-
read
public POSSample read() throws IOException
Parses the next sentence and return 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 thesentence streamis exhausted. - Throws:
IOException- Thrown if IO errors occurred during read.
-
-