opennlp.tools.parser.treeinsert
Class Parser

java.lang.Object
  extended by opennlp.tools.parser.AbstractBottomUpParser
      extended by opennlp.tools.parser.treeinsert.Parser
All Implemented Interfaces:
Parser

public class Parser
extends AbstractBottomUpParser

Built/attach parser. Nodes are built when their left-most child is encountered. Subsequent children are attached as daughters. Attachment is based on node in the right-frontier of the tree. After each attachment or building, nodes are assesed as either complete or incomplete. Complete nodes are no longer elligable for daughter attachment. Complex modifiers which produce additional node levels of the same type are attached with sister-adjunction. Attachment can not take place higher in the right-frontier than an incomplete node.


Field Summary
static String ATTACH_DAUGHTER
          Outcome used when a node should be attached as a daughter to another node.
static String ATTACH_SISTER
          Outcome used when a node should be attached as a sister to another node.
static String BUILT
          Label used to distinguish build nodes from non-built nodes.
static String DONE
          Outcome used when a constituent needs an no additional parent node/building.
static String NON_ATTACH
          Outcome used when a node should not be attached to another node.
 
Fields inherited from class opennlp.tools.parser.AbstractBottomUpParser
chunker, COMPLETE, completeParses, CONT, createDerivationString, debugOn, defaultAdvancePercentage, defaultBeamSize, headRules, INC_NODE, INCOMPLETE, K, M, ndh, odh, OTHER, punctSet, Q, reportFailedParse, START, tagger, TOK_NODE, TOP_NODE, ZERO
 
Constructor Summary
Parser(opennlp.model.AbstractModel buildModel, opennlp.model.AbstractModel attachModel, opennlp.model.AbstractModel checkModel, POSTagger tagger, Chunker chunker, HeadRules headRules)
          Deprecated. 
Parser(opennlp.model.AbstractModel buildModel, opennlp.model.AbstractModel attachModel, opennlp.model.AbstractModel checkModel, POSTagger tagger, Chunker chunker, HeadRules headRules, int beamSize, double advancePercentage)
          Deprecated. 
Parser(ParserModel model)
           
Parser(ParserModel model, int beamSize, double advancePercentage)
           
 
Method Summary
protected  Parse[] advanceChunks(Parse p, double minChunkScore)
          Returns the top chunk sequences for the specified parse.
protected  Parse[] advanceParses(Parse p, double probMass)
          Advances the specified parse and returns the an array advanced parses whose probability accounts for more than the specified amount of probability mass.
protected  void advanceTop(Parse p)
          Adds the "TOP" node to the specified parse.
static List<Parse> getRightFrontier(Parse root, Set<String> punctSet)
          Returns the right frontier of the specified parse tree with nodes ordered from deepest to shallowest.
static void main(String[] args)
          Deprecated. 
static opennlp.model.AbstractModel train(opennlp.model.EventStream es, int iterations, int cut)
          Deprecated. 
static ParserModel train(String languageCode, ObjectStream<Parse> parseSamples, HeadRules rules, int iterations, int cut)
           
 
Methods inherited from class opennlp.tools.parser.AbstractBottomUpParser
advanceTags, buildDictionary, collapsePunctuation, mapParseIndex, parse, parse, setErrorReporting, setParents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DONE

public static final String DONE
Outcome used when a constituent needs an no additional parent node/building.

See Also:
Constant Field Values

ATTACH_SISTER

public static final String ATTACH_SISTER
Outcome used when a node should be attached as a sister to another node.

See Also:
Constant Field Values

ATTACH_DAUGHTER

public static final String ATTACH_DAUGHTER
Outcome used when a node should be attached as a daughter to another node.

See Also:
Constant Field Values

NON_ATTACH

public static final String NON_ATTACH
Outcome used when a node should not be attached to another node.

See Also:
Constant Field Values

BUILT

public static final String BUILT
Label used to distinguish build nodes from non-built nodes.

See Also:
Constant Field Values
Constructor Detail

Parser

public Parser(ParserModel model,
              int beamSize,
              double advancePercentage)

Parser

public Parser(ParserModel model)

Parser

@Deprecated
public Parser(opennlp.model.AbstractModel buildModel,
                         opennlp.model.AbstractModel attachModel,
                         opennlp.model.AbstractModel checkModel,
                         POSTagger tagger,
                         Chunker chunker,
                         HeadRules headRules,
                         int beamSize,
                         double advancePercentage)
Deprecated. 


Parser

@Deprecated
public Parser(opennlp.model.AbstractModel buildModel,
                         opennlp.model.AbstractModel attachModel,
                         opennlp.model.AbstractModel checkModel,
                         POSTagger tagger,
                         Chunker chunker,
                         HeadRules headRules)
Deprecated. 

Method Detail

getRightFrontier

public static List<Parse> getRightFrontier(Parse root,
                                           Set<String> punctSet)
Returns the right frontier of the specified parse tree with nodes ordered from deepest to shallowest.

Parameters:
root - The root of the parse tree.
Returns:
The right frontier of the specified parse tree.

advanceChunks

protected Parse[] advanceChunks(Parse p,
                                double minChunkScore)
Description copied from class: AbstractBottomUpParser
Returns the top chunk sequences for the specified parse.

Overrides:
advanceChunks in class AbstractBottomUpParser
Parameters:
p - A pos-tag assigned parse.
minChunkScore - A minimum score below which chunks should not be advanced.
Returns:
The top chunk assignments to the specified parse.

advanceParses

protected Parse[] advanceParses(Parse p,
                                double probMass)
Description copied from class: AbstractBottomUpParser
Advances the specified parse and returns the an array advanced parses whose probability accounts for more than the specified amount of probability mass.

Specified by:
advanceParses in class AbstractBottomUpParser
Parameters:
p - The parse to advance.
probMass - The amount of probability mass that should be accounted for by the advanced parses.

advanceTop

protected void advanceTop(Parse p)
Description copied from class: AbstractBottomUpParser
Adds the "TOP" node to the specified parse.

Specified by:
advanceTop in class AbstractBottomUpParser
Parameters:
p - The complete parse.

train

public static ParserModel train(String languageCode,
                                ObjectStream<Parse> parseSamples,
                                HeadRules rules,
                                int iterations,
                                int cut)
                         throws IOException
Throws:
IOException

train

@Deprecated
public static opennlp.model.AbstractModel train(opennlp.model.EventStream es,
                                                           int iterations,
                                                           int cut)
                                         throws IOException
Deprecated. 

Throws:
IOException

main

@Deprecated
public static void main(String[] args)
                 throws IOException
Deprecated. 

Throws:
IOException


Copyright © 2010. All Rights Reserved.