Package opennlp.tools.parser

# Class AbstractBottomUpParser

java.lang.Object
opennlp.tools.parser.AbstractBottomUpParser

All Implemented Interfaces:
  `opennlp.tools.parser.Parser`

Direct Known Subclasses:
  `Parser`, `Parser`

public abstract class AbstractBottomUpParser extends Object implements opennlp.tools.parser.Parser
Abstract class which contains code to tag and chunk parses for bottom up parsing and leaves implementation of advancing parses and completing parses to extend class.

Note:
The nodes within the returned parses are shared with other parses and therefore their parent node references will not be consistent with their child node reference. `setParents` can be used to make the parents consistent with a particular parse, but subsequent calls to `setParents` can invalidate the results of earlier calls.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `COMPLETE`
  Outcome used when a constituent is complete.
  `static final String`
  `CONT`
  Prefix for outcomes continuing a constituent.
  `static final double`
  `defaultAdvancePercentage`
  The default amount of probability mass required of advanced outcomes.
  `static final int`
  `defaultBeamSize`
  The default beam size used if no beam size is given.
  `static final String`
  `INCOMPLETE`
  Outcome used when a constituent is incomplete.
  `static final String`
  `OTHER`
  Outcome for token which is not contained in a basal constituent.
  `static final String`
  `START`
  Prefix for outcomes starting a constituent.

  ### Fields inherited from interface opennlp.tools.parser.Parser

  `INC_NODE, TOK_NODE, TOP_NODE`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AbstractBottomUpParser(opennlp.tools.postag.POSTagger tagger, opennlp.tools.chunker.Chunker chunker, opennlp.tools.parser.HeadRules headRules, int beamSize, double advancePercentage)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static Dictionary`
  `buildDictionary(opennlp.tools.util.ObjectStream<opennlp.tools.parser.Parse> data, opennlp.tools.parser.HeadRules rules, int cutoff)`
  Creates a n-gram `Dictionary` from the specified data stream using `HeadRules` and specified cut-off.
  `static Dictionary`
  `buildDictionary(opennlp.tools.util.ObjectStream<opennlp.tools.parser.Parse> data, opennlp.tools.parser.HeadRules rules, opennlp.tools.util.TrainingParameters params)`
  Creates a n-gram `Dictionary` from the specified data stream using the specified head rule and specified cut-off.
  `static opennlp.tools.parser.Parse[]`
  `collapsePunctuation(opennlp.tools.parser.Parse[] chunks, Set<String> punctSet)`
  Removes the punctuation from the specified set of `chunks`, adds it to the parses adjacent to the punctuation is specified, and returns a new array of parses with the punctuation removed.
  `opennlp.tools.parser.Parse`
  `parse(opennlp.tools.parser.Parse tokens)`
  `opennlp.tools.parser.Parse[]`
  `parse(opennlp.tools.parser.Parse tokens, int numParses)`
  `void`
  `setErrorReporting(boolean errorReporting)`
  Specifies whether the parser should report when it was unable to find a parse for a particular sentence.
  `static void`
  `setParents(opennlp.tools.parser.Parse p)`
  Assigns parent references for the specified parse so that they are consistent with the children references.

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### defaultBeamSize

    public static final int defaultBeamSize
    The default beam size used if no beam size is given.
    See Also:
      - Constant Field Values

  - ### defaultAdvancePercentage

    public static final double defaultAdvancePercentage
    The default amount of probability mass required of advanced outcomes.
    See Also:
      - Constant Field Values

  - ### START

    public static final String START
    Prefix for outcomes starting a constituent.
    See Also:
      - Constant Field Values

  - ### CONT

    public static final String CONT
    Prefix for outcomes continuing a constituent.
    See Also:
      - Constant Field Values

  - ### OTHER

    public static final String OTHER
    Outcome for token which is not contained in a basal constituent.
    See Also:
      - Constant Field Values

  - ### COMPLETE

    public static final String COMPLETE
    Outcome used when a constituent is complete.
    See Also:
      - Constant Field Values

  - ### INCOMPLETE

    public static final String INCOMPLETE
    Outcome used when a constituent is incomplete.
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### AbstractBottomUpParser

    public AbstractBottomUpParser(opennlp.tools.postag.POSTagger tagger, opennlp.tools.chunker.Chunker chunker, opennlp.tools.parser.HeadRules headRules, int beamSize, double advancePercentage)

- ## Method Details

  - ### setErrorReporting

    public void setErrorReporting(boolean errorReporting)
    Specifies whether the parser should report when it was unable to find a parse for a particular sentence.
    Parameters:
      `errorReporting` - `true` if un-parsed sentences should be reported, `false` otherwise.

  - ### setParents

    public static void setParents(opennlp.tools.parser.Parse p)
    Assigns parent references for the specified parse so that they are consistent with the children references.
    Parameters:
      `p` - The `Parse` whose parent references need to be assigned.

  - ### collapsePunctuation

    public static opennlp.tools.parser.Parse[] collapsePunctuation(opennlp.tools.parser.Parse[] chunks, Set<String> punctSet)
    Removes the punctuation from the specified set of `chunks`, adds it to the parses adjacent to the punctuation is specified, and returns a new array of parses with the punctuation removed.
    Parameters:
      `chunks` - A set of `parses`.
      `punctSet` - The set of punctuation to be removed.
    Returns:
      Array of `parses` which is a subset of chunks with punctuation removed.

  - ### parse

    public opennlp.tools.parser.Parse[] parse(opennlp.tools.parser.Parse tokens, int numParses)
    Specified by:
      `parse` in interface `opennlp.tools.parser.Parser`

  - ### parse

    public opennlp.tools.parser.Parse parse(opennlp.tools.parser.Parse tokens)
    Specified by:
      `parse` in interface `opennlp.tools.parser.Parser`

  - ### buildDictionary

    public static Dictionary buildDictionary(opennlp.tools.util.ObjectStream<opennlp.tools.parser.Parse> data, opennlp.tools.parser.HeadRules rules, opennlp.tools.util.TrainingParameters params) throws IOException
    Creates a n-gram `Dictionary` from the specified data stream using the specified head rule and specified cut-off.
    Parameters:
      `data` - The data stream of `parses`.
      `rules` - The `HeadRules` for the parses.
      `params` - The `TrainingParameters` which can contain a `cutoff`, the minimum number of entries required for the n-gram to be saved as part of the `Dictionary`.
    Returns:
      A `Dictionary` instance.
    Throws:
      `IOException`

  - ### buildDictionary

    public static Dictionary buildDictionary(opennlp.tools.util.ObjectStream<opennlp.tools.parser.Parse> data, opennlp.tools.parser.HeadRules rules, int cutoff) throws IOException
    Creates a n-gram `Dictionary` from the specified data stream using `HeadRules` and specified cut-off.
    Parameters:
      `data` - The data stream of `parses`.
      `rules` - The `HeadRules` for the `parses`.
      `cutoff` - The minimum number of entries required for the n-gram to be saved as part of the dictionary.
    Returns:
      A `Dictionary` instance.
    Throws:
      `IOException`