Class WordTagSampleStream

  • All Implemented Interfaces:
    java.lang.AutoCloseable, ObjectStream<POSSample>

    public class WordTagSampleStream
    extends FilterObjectStream<java.lang.String,​POSSample>
    A stream filter which reads a sentence per line which contains words and tags in word_tag format and outputs a POSSample objects.
    • Constructor Detail

      • WordTagSampleStream

        public WordTagSampleStream​(ObjectStream<java.lang.String> sentences)
        Initializes the current instance.
        Parameters:
        sentences - the sentences
    • Method Detail

      • read

        public POSSample read()
                       throws java.io.IOException
        Parses the next sentence and return the next POSSample object. If an error occurs an empty POSSample object is returned and an warning message is logged. Usually it does not matter if one of many sentences is ignored. TODO: An exception in error case should be thrown.
        Returns:
        the next object or null to signal that the stream is exhausted
        Throws:
        java.io.IOException - if there is an error during reading