Class ParserFactory

java.lang.Object
opennlp.tools.parser.ParserFactory

public class ParserFactory extends Object
  • Constructor Details

    • ParserFactory

      private ParserFactory()
  • Method Details

    • create

      public static Parser create(ParserModel model, int beamSize, double advancePercentage)
      Instantiates a Parser via a given model and other configuration parameters.
      Parameters:
      model - The ParserModel to use. 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.
      Returns:
      A valid Parser instance.
      Throws:
      IllegalArgumentException - Thrown if model is null or a parameter is out of range.
      IllegalStateException - Thrown if the ParserType is not supported.
      See Also:
    • create

      public static Parser create(ParserModel model, POSTagger tagger, Chunker chunker, int beamSize, double advancePercentage)
      Instantiates a Parser for the ParserType of a given model that tags and chunks with a caller-supplied POSTagger and Chunker. The build, attach 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.
      Returns:
      A valid Parser instance.
      Throws:
      IllegalArgumentException - Thrown if a parameter is null or out of range.
      IllegalStateException - Thrown if the ParserType is not supported.
      Since:
      3.0.0
      See Also:
    • create

      public static Parser create(ParserModel model)
      Instantiates a Parser via a given model and default configuration parameters (see: AbstractBottomUpParser).
      Parameters:
      model - The ParserModel to use.
      Returns:
      A valid Parser instance.
      Throws:
      IllegalArgumentException - Thrown if model is null.
      IllegalStateException - Thrown if the ParserType is not supported.
      See Also: