opennlp.tools.parser.chunking
Class ParserEventStream

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

public class ParserEventStream
extends AbstractParserEventStream

Wrapper class for one of four parser event streams. The particular event stream is specified at construction.

Author:
Tom Morton

Field Summary
protected  BuildContextGenerator bcg
           
protected  CheckContextGenerator kcg
           
 
Fields inherited from class opennlp.tools.parser.AbstractParserEventStream
dict, etype, fixPossesives, punctSet, rules
 
Constructor Summary
ParserEventStream(ObjectStream<Parse> d, HeadRules rules, ParserEventTypeEnum etype)
           
ParserEventStream(ObjectStream<Parse> d, HeadRules rules, ParserEventTypeEnum etype, Dictionary dict)
          Create an event stream based on the specified data stream of the specified type using the specified head rules.
 
Method Summary
protected  void addParseEvents(List<opennlp.model.Event> parseEvents, Parse[] chunks)
          Adds events for parsing (post tagging and chunking to the specified list of events for the specified parse chunks.
protected  boolean firstChild(Parse child, Parse parent)
          Returns true if the specified child is the first child of the specified parent.
protected  void init()
           
static void main(String[] args)
           
static Parse[] reduceChunks(Parse[] chunks, int ci, Parse parent)
           
 
Methods inherited from class opennlp.tools.parser.AbstractParserEventStream
createEvents, getInitialChunks, lastChild
 
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

bcg

protected BuildContextGenerator bcg

kcg

protected CheckContextGenerator kcg
Constructor Detail

ParserEventStream

public ParserEventStream(ObjectStream<Parse> d,
                         HeadRules rules,
                         ParserEventTypeEnum etype,
                         Dictionary dict)
Create an event stream based on the specified data stream of the specified type using the specified head rules.

Parameters:
d - A 1-parse-per-line Penn Treebank Style parse.
rules - The head rules.
etype - The type of events desired (tag, chunk, build, or check).
dict - A tri-gram dictionary to reduce feature generation.

ParserEventStream

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

init

protected void init()
Overrides:
init in class AbstractParserEventStream

firstChild

protected boolean firstChild(Parse child,
                             Parse parent)
Returns true if the specified child is the first child of the specified parent.

Parameters:
child - The child parse.
parent - The parent parse.
Returns:
true if the specified child is the first child of the specified parent; false otherwise.

reduceChunks

public static Parse[] reduceChunks(Parse[] chunks,
                                   int ci,
                                   Parse parent)

addParseEvents

protected void addParseEvents(List<opennlp.model.Event> parseEvents,
                              Parse[] chunks)
Adds events for parsing (post tagging and chunking to the specified list of events for the specified parse chunks.

Specified by:
addParseEvents in class AbstractParserEventStream
Parameters:
parseEvents - The events for the specified chunks.
chunks - The incomplete parses to be parsed.

main

public static void main(String[] args)
                 throws IOException,
                        InvalidFormatException
Throws:
IOException
InvalidFormatException


Copyright © 2010. All Rights Reserved.