Class AbstractParserEventStream

java.lang.Object
opennlp.tools.util.AbstractEventStream<Parse>
opennlp.tools.parser.AbstractParserEventStream
All Implemented Interfaces:
AutoCloseable, ObjectStream<Event>
Direct Known Subclasses:
ParserEventStream, ParserEventStream

public abstract class AbstractParserEventStream extends AbstractEventStream<Parse>
Abstract class extended by parser event streams which perform tagging and chunking.
  • Field Details

  • Constructor Details

  • Method Details

    • createEvents

      protected Iterator<Event> createEvents(Parse sample)
      Description copied from class: AbstractEventStream
      Creates events for the provided sample.
      Specified by:
      createEvents in class AbstractEventStream<Parse>
      Parameters:
      sample - The sample for which training events are created.
      Returns:
      An Iterator of training events or an empty Iterator.
    • init

      protected void init()
    • getInitialChunks

      public static Parse[] getInitialChunks(Parse p)
    • getInitialChunks

      private static void getInitialChunks(Parse p, List<Parse> ichunks)
    • addParseEvents

      protected abstract void addParseEvents(List<Event> newEvents, Parse[] chunks)
      Produces all events for the specified sentence chunks and adds them to the specified newEvents list.
      Parameters:
      newEvents - A list of events to be added to.
      chunks - Pre-chunked constituents of a sentence.
    • addChunkEvents

      private void addChunkEvents(List<Event> chunkEvents, Parse[] chunks)
    • addTagEvents

      private void addTagEvents(List<Event> tagEvents, Parse[] chunks)
    • lastChild

      protected boolean lastChild(Parse child, Parse parent)
      Returns true if the child is the last child of the specified parent.
      Parameters:
      child - The child Parse.
      parent - The parent Parse.
      Returns:
      true if the specified child is the last child of the specified parent, false otherwise.