Package opennlp.tools.langdetect

# Class LanguageDetectorModel

java.lang.Object
opennlp.tools.util.model.BaseModel
opennlp.tools.langdetect.LanguageDetectorModel

All Implemented Interfaces:
  `Serializable`, `opennlp.tools.util.model.ArtifactProvider`

public class LanguageDetectorModel extends BaseModel
The `LanguageDetectorModel` is the model used by a learnable `LanguageDetector`.

See Also:
  - `LanguageDetectorME`
  - Serialized Form

- ## Field Summary

  ### Fields inherited from class opennlp.tools.util.model.BaseModel

  `TRAINING_CUTOFF_PROPERTY, TRAINING_EVENTHASH_PROPERTY, TRAINING_ITERATIONS_PROPERTY`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `LanguageDetectorModel(File modelFile)`
  Initializes a `LanguageDetectorModel` instance via a valid `File`.
  `LanguageDetectorModel(InputStream in)`
  Initializes a `LanguageDetectorModel` instance via a valid `InputStream`.
  `LanguageDetectorModel(URL modelURL)`
  Initializes a `LanguageDetectorModel` instance via a valid `URL`.
  `LanguageDetectorModel(opennlp.tools.ml.model.MaxentModel langdetectModel, Map<String,String> manifestInfoEntries, LanguageDetectorFactory factory)`
  Initializes a `LanguageDetectorModel` instance via given parameters.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `LanguageDetectorFactory`
  `getFactory()`
  `opennlp.tools.ml.model.MaxentModel`
  `getMaxentModel()`

  ### Methods inherited from class opennlp.tools.util.model.BaseModel

  `getArtifact, getLanguage, getManifestProperty, getVersion, isLoadedFromSerialized, serialize, serialize, serialize`

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### LanguageDetectorModel

    public LanguageDetectorModel(opennlp.tools.ml.model.MaxentModel langdetectModel, Map<String,String> manifestInfoEntries, LanguageDetectorFactory factory)
    Initializes a `LanguageDetectorModel` instance via given parameters.
    Parameters:
      `langdetectModel` - A valid `MaxentModel`.
      `manifestInfoEntries` - Additional information kept in the manifest.
      `factory` - The `LanguageDetectorFactory` for creating related objects.

  - ### LanguageDetectorModel

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

  - ### LanguageDetectorModel

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

  - ### LanguageDetectorModel

    public LanguageDetectorModel(URL modelURL) throws IOException
    Initializes a `LanguageDetectorModel` 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

  - ### getFactory

    public LanguageDetectorFactory getFactory()
    Returns:
      Retrieves the active `LanguageDetectorFactory`.

  - ### getMaxentModel

    public opennlp.tools.ml.model.MaxentModel getMaxentModel()
    Returns:
      Retrieves a `MaxentModel`.