Package opennlp.tools.tokenize
Class TokenSampleStream
- All Implemented Interfaces:
- AutoCloseable,- ObjectStream<TokenSample>
This class is a 
stream filter which reads in string encoded
 samples and creates samples out of them.
 The input string sample is tokenized if a whitespace or the special separator chars occur.
 
 Sample:
 "token1 token2 token3<SPLIT>token4"
 The tokens token1 and token2 are separated by a whitespace,
 token3 and token4 are separated by the special character sequence.
 In this case, the default split sequence applies.
 
Note: The sequence must be unique in the input string and is not escaped.
- 
Constructor SummaryConstructorsConstructorDescriptionTokenSampleStream(ObjectStream<String> sentences) Initializes ainstance.TokenSampleStream(ObjectStream<String> samples, String separatorChars) Initializes ainstance.
- 
Method SummaryMethods inherited from class opennlp.tools.util.FilterObjectStreamclose, reset
- 
Constructor Details- 
TokenSampleStreamInitializes ainstance.- Parameters:
- samples- A plain text- line stream. Must not be- null.
- separatorChars- The characters to be considered separators. See- TokenSample.DEFAULT_SEPARATOR_CHARS. Must not be- null.
 
- 
TokenSampleStreamInitializes ainstance.- Parameters:
- sentences- A plain text- line stream. Must not be- null.
 
 
- 
- 
Method Details- 
readDescription copied from interface:ObjectStreamReturns the nextObjectStreamobject. Calling this method repeatedly until it returnsnullwill return each object from the underlying source exactly once.- Returns:
- The next object or nullto signal that the stream is exhausted.
- Throws:
- IOException- Thrown if there is an error during reading.
 
 
-