opennlp.tools.parser
Class AbstractParserEventStream

java.lang.Object
  extended by opennlp.model.AbstractEventStream
      extended by opennlp.tools.util.AbstractEventStream<Parse>
          extended by opennlp.tools.parser.AbstractParserEventStream
All Implemented Interfaces:
opennlp.model.EventStream
Direct Known Subclasses:
ParserEventStream, ParserEventStream

public abstract class AbstractParserEventStream
extends AbstractEventStream<Parse>

Abstract class extended by parser event streams which perform tagging and chunking.

Author:
Tom Morton

Field Summary
protected  Dictionary dict
           
protected  ParserEventTypeEnum etype
          The type of events being generated by this event stream.
protected  boolean fixPossesives
           
protected  Set<String> punctSet
           
protected  HeadRules rules
           
 
Constructor Summary
AbstractParserEventStream(ObjectStream<Parse> d, HeadRules rules, ParserEventTypeEnum etype)
           
AbstractParserEventStream(ObjectStream<Parse> d, HeadRules rules, ParserEventTypeEnum etype, Dictionary dict)
           
 
Method Summary
protected abstract  void addParseEvents(List<opennlp.model.Event> newEvents, Parse[] chunks)
          Produces all events for the specified sentence chunks and adds them to the specified list.
protected  Iterator<opennlp.model.Event> createEvents(Parse sample)
          Creates events for the provided sample.
static Parse[] getInitialChunks(Parse p)
           
protected  void init()
           
protected  boolean lastChild(Parse child, Parse parent)
          Returns true if the specified child is the last child of the specified parent.
 
Methods inherited from class opennlp.tools.util.AbstractEventStream
hasNext, next
 
Methods inherited from class opennlp.model.AbstractEventStream
remove
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rules

protected HeadRules rules

punctSet

protected Set<String> punctSet

etype

protected ParserEventTypeEnum etype
The type of events being generated by this event stream.


fixPossesives

protected boolean fixPossesives

dict

protected Dictionary dict
Constructor Detail

AbstractParserEventStream

public AbstractParserEventStream(ObjectStream<Parse> d,
                                 HeadRules rules,
                                 ParserEventTypeEnum etype,
                                 Dictionary dict)

AbstractParserEventStream

public AbstractParserEventStream(ObjectStream<Parse> d,
                                 HeadRules rules,
                                 ParserEventTypeEnum etype)
Method Detail

createEvents

protected Iterator<opennlp.model.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 be created.
Returns:
an Iterator of training events or an empty Iterator.

init

protected void init()

getInitialChunks

public static Parse[] getInitialChunks(Parse p)

addParseEvents

protected abstract void addParseEvents(List<opennlp.model.Event> newEvents,
                                       Parse[] chunks)
Produces all events for the specified sentence chunks and adds them to the specified list.

Parameters:
newEvents - A list of events to be added to.
chunks - Pre-chunked constituents of a sentence.

lastChild

protected boolean lastChild(Parse child,
                            Parse parent)
Returns true if the specified 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.


Copyright © 2010. All Rights Reserved.