Class StopwordFilterStream

java.lang.Object
opennlp.tools.util.FilterObjectStream<String[],String[]>
opennlp.tools.stopword.StopwordFilterStream
All Implemented Interfaces:
AutoCloseable, ObjectStream<String[]>

public final class StopwordFilterStream extends FilterObjectStream<String[],String[]>
A FilterObjectStream which removes stopwords from each String[] sample produced by an underlying ObjectStream<String[]>.

Stopword membership is decided by the supplied StopwordFilter; filtering is delegated to StopwordFilter.filter(String[]) so the relative order of surviving tokens within a sample is preserved.

FilterObjectStream.reset() and FilterObjectStream.close() are inherited from FilterObjectStream and simply forward to the wrapped stream.

  • Field Details

  • Constructor Details

  • Method Details

    • read

      public String[] read() throws IOException
      Reads the next sample from the wrapped stream and returns it with stopwords removed. Returns null once the underlying stream is exhausted.
      Returns:
      The filtered sample or null at the end of the stream.
      Throws:
      IOException - If the underlying stream throws an I/O error.