Class DependencyModel

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

public class DependencyModel extends BaseModel
The persisted form of a trained DependencyParserME: the transition classification model plus the standard model manifest, serialized and loaded through the same BaseModel machinery as every other tool model.
Since:
3.0.0
See Also:
  • Constructor Details

    • DependencyModel

      public DependencyModel(String languageCode, opennlp.tools.ml.model.MaxentModel parserModel, Map<String,String> manifestInfoEntries)
      Initializes a DependencyModel from a trained transition model.
      Parameters:
      languageCode - The ISO language code of the training data. Must not be null.
      parserModel - The transition classification model. Must not be null.
      manifestInfoEntries - Additional entries for the manifest, or null.
      Throws:
      IllegalArgumentException - Thrown if languageCode or parserModel is null.
    • DependencyModel

      public DependencyModel(InputStream in) throws IOException
      Initializes a DependencyModel from a serialized model.
      Parameters:
      in - The stream to read the model from. Must not be null.
      Throws:
      IOException - Thrown if reading fails or the content is not a valid model.
      IllegalArgumentException - Thrown if in is null.
    • DependencyModel

      public DependencyModel(File modelFile) throws IOException
      Initializes a DependencyModel from a serialized model file.
      Parameters:
      modelFile - The file to read the model from. Must not be null.
      Throws:
      IOException - Thrown if reading fails or the content is not a valid model.
      IllegalArgumentException - Thrown if modelFile is null.
    • DependencyModel

      public DependencyModel(Path modelPath) throws IOException
      Initializes a DependencyModel from a serialized model file.
      Parameters:
      modelPath - The path to read the model from. Must not be null.
      Throws:
      IOException - Thrown if reading fails or the content is not a valid model.
      IllegalArgumentException - Thrown if modelPath is null.
  • Method Details

    • getParserModel

      public opennlp.tools.ml.model.MaxentModel getParserModel()
      Returns:
      The transition classification model. Never null.