Parser (Apache OpenNLP :: Core :: Runtime 3.0.0-M4 API)
Description: declaration: package: opennlp.tools.parser.chunking, class: Parser

Package opennlp.tools.parser.chunking

# Class Parser

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

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

public class Parser extends AbstractBottomUpParser
A shift reduce style `Parser` implementation based on Adwait Ratnaparkhi's 1998 thesis.

See Also:
  - `AbstractBottomUpParser`
  - `Parser`

- ## Field Summary

  ### Fields inherited from class opennlp.tools.parser.AbstractBottomUpParser

  `COMPLETE, CONT, defaultAdvancePercentage, defaultBeamSize, INCOMPLETE, OTHER, START`

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

  `INC_NODE, TOK_NODE, TOP_NODE`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Parser(ParserModel model)`
  Instantiates a `Parser` via a given `model`.
  `Parser(ParserModel model, int beamSize, double advancePercentage)`
  Instantiates a `Parser` via a given `model` and other configuration parameters.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static void`
  `mergeReportIntoManifest(Map<String,String> manifest, Map<String,String> report, String namespace)`
  `static ParserModel`
  `train(String languageCode, opennlp.tools.util.ObjectStream<opennlp.tools.parser.Parse> parseSamples, opennlp.tools.parser.HeadRules rules, opennlp.tools.util.TrainingParameters mlParams)`
  Starts a training of a `ParserModel`.

  ### Methods inherited from class opennlp.tools.parser.AbstractBottomUpParser

  `buildDictionary, buildDictionary, collapsePunctuation, parse, parse, setErrorReporting, setParents`

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

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

- ## Constructor Details

  - ### Parser

    public Parser(ParserModel model, int beamSize, double advancePercentage)
    Instantiates a `Parser` via a given `model` and other configuration parameters. Uses the default implementations of `POSTaggerME` and `ChunkerME`.
    Parameters:
      `model` - The `ParserModel` to use.
      `beamSize` - The number of different parses kept during parsing.
      `advancePercentage` - The minimal amount of probability mass which advanced outcomes must represent. Only outcomes which contribute to the top `advancePercentage` will be explored.
    Throws:
      `IllegalStateException` - Thrown if the `ParserType` is not supported.
    See Also:
      - `ParserModel`
      - `POSTaggerME`
      - `ChunkerME`

  - ### Parser

    public Parser(ParserModel model)
    Instantiates a `Parser` via a given `model`. Uses the default implementations of `POSTaggerME` and `ChunkerME` and default values for `beamSize` and `advancePercentage`.
    Parameters:
      `model` - The `ParserModel` to use.
    Throws:
      `IllegalStateException` - Thrown if the `ParserType` is not supported.
    See Also:
      - `ParserModel`
      - `POSTaggerME`
      - `ChunkerME`

- ## Method Details

  - ### mergeReportIntoManifest

    public static void mergeReportIntoManifest(Map<String,String> manifest, Map<String,String> report, String namespace)

  - ### train

    public static ParserModel train(String languageCode, opennlp.tools.util.ObjectStream<opennlp.tools.parser.Parse> parseSamples, opennlp.tools.parser.HeadRules rules, opennlp.tools.util.TrainingParameters mlParams) throws IOException
    Starts a training of a `ParserModel`.
    Parameters:
      `languageCode` - An ISO conform language code.
      `parseSamples` - The `samples` as input.
      `rules` - The `HeadRules` to use.
      `mlParams` - The `parameters` for training.
    Returns:
      A valid `ParserModel`.
    Throws:
      `IOException` - Thrown if IO errors occurred during training.