Class FeedforwardDependencyModel

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

public class FeedforwardDependencyModel extends BaseModel
The persisted form of a trained FeedforwardDependencyParser: the network weights plus the standard model manifest, serialized and loaded through the same BaseModel machinery as every other tool model.

The weights are not modified after construction or loading. A model can be shared between threads and between parsers; refine trains a copy and returns a new model.

Since:
3.0.0
See Also:
  • Constructor Details

    • FeedforwardDependencyModel

      public FeedforwardDependencyModel(InputStream in) throws IOException
      Initializes a FeedforwardDependencyModel 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, or if it holds the model package of another component; the cause is an InvalidFormatException.
    • FeedforwardDependencyModel

      public FeedforwardDependencyModel(File modelFile) throws IOException
      Initializes a FeedforwardDependencyModel 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, or if it holds the model package of another component; the cause is an InvalidFormatException.
    • FeedforwardDependencyModel

      public FeedforwardDependencyModel(Path modelPath) throws IOException
      Initializes a FeedforwardDependencyModel 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, or if it holds the model package of another component; the cause is an InvalidFormatException.
  • Method Details

    • getBeamSize

      public int getBeamSize()
      Returns the beam size a parser uses when none is given: the beam size the model was refined with, which the manifest records under "BeamSize", or 1 (greedy) for a model that was not refined.
      Returns:
      The beam size. Always positive.