Class ParserModel

java.lang.Object
opennlp.tools.util.model.BaseModel
opennlp.tools.parser.ParserModel
All Implemented Interfaces:
Serializable, opennlp.tools.util.model.ArtifactProvider

public class ParserModel extends BaseModel
This is the default ParserModel implementation.
See Also:
  • Constructor Details

    • ParserModel

      public ParserModel(String languageCode, opennlp.tools.ml.model.MaxentModel buildModel, opennlp.tools.ml.model.MaxentModel checkModel, opennlp.tools.ml.model.MaxentModel attachModel, POSModel parserTagger, ChunkerModel chunkerTagger, opennlp.tools.parser.HeadRules headRules, opennlp.tools.parser.ParserType modelType, Map<String,String> manifestInfoEntries)
      Initializes a ParserModel instance via given parameters.
      Parameters:
      languageCode - An ISO conform language code.
      buildModel - A valid MaxentModel used to build.
      checkModel - A valid MaxentModel used to check.
      attachModel - A valid MaxentModel used to attach.
      parserTagger - A valid POSModel to parse.
      chunkerTagger - A valid ChunkerModel to chunk.
      headRules - The HeadRules to to use for parsing.
      modelType - The ParserType to use.
      manifestInfoEntries - Additional information kept in the manifest.
    • ParserModel

      public ParserModel(String languageCode, opennlp.tools.ml.model.MaxentModel buildModel, opennlp.tools.ml.model.MaxentModel checkModel, opennlp.tools.ml.model.MaxentModel attachModel, POSModel parserTagger, ChunkerModel chunkerTagger, opennlp.tools.parser.HeadRules headRules, opennlp.tools.parser.ParserType modelType)
      Initializes a ParserModel instance via given parameters.
      Parameters:
      languageCode - An ISO conform language code.
      buildModel - A valid MaxentModel used to build.
      checkModel - A valid MaxentModel used to check.
      parserTagger - A valid POSModel to parse.
      chunkerTagger - A valid ChunkerModel to chunk.
      headRules - The HeadRules to to use for parsing.
      modelType - The ParserType to use.
    • ParserModel

      public ParserModel(String languageCode, opennlp.tools.ml.model.MaxentModel buildModel, opennlp.tools.ml.model.MaxentModel checkModel, POSModel parserTagger, ChunkerModel chunkerTagger, opennlp.tools.parser.HeadRules headRules, opennlp.tools.parser.ParserType type, Map<String,String> manifestInfoEntries)
      Initializes a ParserModel instance via given parameters.
      Parameters:
      languageCode - An ISO conform language code.
      buildModel - A valid MaxentModel used to build.
      checkModel - A valid MaxentModel used to check.
      parserTagger - A valid POSModel to parse.
      chunkerTagger - A valid ChunkerModel to chunk.
      headRules - The HeadRules to to use for parsing.
      type - The ParserType to use.
      manifestInfoEntries - Additional information kept in the manifest.
    • ParserModel

      public ParserModel(InputStream in) throws IOException
      Initializes a ParserModel instance via a valid InputStream.
      Parameters:
      in - The InputStream used for loading the model.
      Throws:
      IOException - Thrown if IO errors occurred during initialization.
    • ParserModel

      public ParserModel(File modelFile) throws IOException
      Initializes a ParserModel instance via a valid File.
      Parameters:
      modelFile - The File used for loading the model.
      Throws:
      IOException - Thrown if IO errors occurred during initialization.
    • ParserModel

      public ParserModel(Path modelPath) throws IOException
      Initializes a ParserModel instance via a valid Path.
      Parameters:
      modelPath - The Path used for loading the model.
      Throws:
      IOException - Thrown if IO errors occurred during initialization.
    • ParserModel

      public ParserModel(URL modelURL) throws IOException
      Initializes a ParserModel instance via a valid URL.
      Parameters:
      modelURL - The URL used for loading the model.
      Throws:
      IOException - Thrown if IO errors occurred during initialization.
  • Method Details

    • getParserType

      public opennlp.tools.parser.ParserType getParserType()
      Returns:
      Retrieves the ParserType as configured in the manifest.
    • getBuildModel

      public opennlp.tools.ml.model.MaxentModel getBuildModel()
      Returns:
      Retrieves the build model as configured in the manifest.
    • getCheckModel

      public opennlp.tools.ml.model.MaxentModel getCheckModel()
      Returns:
      Retrieves the check model as configured in the manifest.
    • getAttachModel

      public opennlp.tools.ml.model.MaxentModel getAttachModel()
      Returns:
      Retrieves the attach model as configured in the manifest.
    • getParserTaggerModel

      public POSModel getParserTaggerModel()
      Returns:
      Retrieves the POSModel as configured in the manifest.
    • getParserChunkerModel

      public ChunkerModel getParserChunkerModel()
      Returns:
      Retrieves the ChunkerModel as configured in the manifest.
    • getHeadRules

      public opennlp.tools.parser.HeadRules getHeadRules()
      Returns:
      Retrieves the HeadRules as configured in the manifest.
    • updateBuildModel

      public ParserModel updateBuildModel(opennlp.tools.ml.model.MaxentModel buildModel)
      Instantiates a new ParserModel instance from the existing configuration with the specified buildModel for exchange.
      Parameters:
      buildModel - A valid MaxentModel used to build.
      Returns:
      A valid ParserModel.
    • updateCheckModel

      public ParserModel updateCheckModel(opennlp.tools.ml.model.MaxentModel checkModel)
      Instantiates a new ParserModel instance from the existing configuration with the specified checkModel for exchange.
      Parameters:
      checkModel - A valid MaxentModel used to check.
      Returns:
      A valid ParserModel.
    • updateTaggerModel

      public ParserModel updateTaggerModel(POSModel taggerModel)
      Instantiates a new ParserModel instance from the existing configuration with the specified taggerModel for exchange.
      Parameters:
      taggerModel - A valid POSModel used to tag.
      Returns:
      A valid ParserModel.
    • updateChunkerModel

      public ParserModel updateChunkerModel(ChunkerModel chunkModel)
      Instantiates a new ParserModel instance from the existing configuration with the specified chunkModel for exchange.
      Parameters:
      chunkModel - A valid ChunkerModel used to tag.
      Returns:
      A valid ParserModel.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object