Class Parser

All Implemented Interfaces:
Parser

public class Parser extends AbstractBottomUpParser
A shift reduce style Parser implementation based on Adwait Ratnaparkhi's 1998 thesis.
See Also:
  • Field Details

    • logger

      private static final org.slf4j.Logger logger
    • buildModel

      private final MaxentModel buildModel
    • checkModel

      private final MaxentModel checkModel
    • buildContextGenerator

      private final BuildContextGenerator buildContextGenerator
    • checkContextGenerator

      private final CheckContextGenerator checkContextGenerator
    • bprobs

      private final double[] bprobs
    • cprobs

      private final double[] cprobs
    • TOP_START

      private static final String TOP_START
      See Also:
    • topStartIndex

      private final int topStartIndex
    • startTypeMap

      private final Map<String,String> startTypeMap
    • contTypeMap

      private final Map<String,String> contTypeMap
    • completeIndex

      private final int completeIndex
    • incompleteIndex

      private final int incompleteIndex
  • 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. Must be at least 1.
      advancePercentage - The minimal amount of probability mass which advanced outcomes must represent. Only outcomes which contribute to the top advancePercentage will be explored. Must be greater than 0 and at most 1.
      Throws:
      IllegalArgumentException - Thrown if model is null or a parameter is out of range.
      See Also:
    • Parser

      public Parser(ParserModel model, POSTagger tagger, Chunker chunker, int beamSize, double advancePercentage)
      Instantiates a Parser via a given model and a caller-supplied POSTagger and Chunker. The build and check models and the head rules are taken from model; its tagger and chunker models are not used.
      Parameters:
      model - The ParserModel to use. Must not be null.
      tagger - The POSTagger used to tag. Must not be null.
      chunker - The Chunker used to chunk. Must not be null.
      beamSize - The number of different parses kept during parsing. Must be at least 1.
      advancePercentage - The minimal amount of probability mass which advanced outcomes must represent. Only outcomes which contribute to the top advancePercentage will be explored. Must be greater than 0 and at most 1.
      Throws:
      IllegalArgumentException - Thrown if a parameter is null or out of range.
      Since:
      3.0.0
      See Also:
    • 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. Must not be null.
      Throws:
      IllegalArgumentException - Thrown if model is null.
      See Also:
    • Parser

      private Parser(MaxentModel buildModel, MaxentModel checkModel, POSTagger tagger, Chunker chunker, HeadRules headRules, int beamSize, double advancePercentage)
      Instantiates a Parser via a given model and other configuration parameters.
      Parameters:
      buildModel - A valid MaxentModel used to build.
      checkModel - A valid MaxentModel used to check.
      tagger - A valid POSModel used to tag.
      chunker - A valid ChunkerModel used to chunk.
      headRules - The HeadRules for head word percolation.
      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.
      See Also:
  • Method Details