Package opennlp.tools.langdetect
Class LanguageDetectorModel
- java.lang.Object
-
- opennlp.tools.util.model.BaseModel
-
- opennlp.tools.langdetect.LanguageDetectorModel
-
- All Implemented Interfaces:
Serializable
,ArtifactProvider
public class LanguageDetectorModel extends BaseModel
TheLanguageDetectorModel
is the model used by a learnableLanguageDetector
.- 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 aLanguageDetectorModel
instance via a validFile
.LanguageDetectorModel(InputStream in)
Initializes aLanguageDetectorModel
instance via a validInputStream
.LanguageDetectorModel(URL modelURL)
Initializes aLanguageDetectorModel
instance via a validURL
.LanguageDetectorModel(MaxentModel langdetectModel, Map<String,String> manifestInfoEntries, LanguageDetectorFactory factory)
Initializes aLanguageDetectorModel
instance via given parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LanguageDetectorFactory
getFactory()
MaxentModel
getMaxentModel()
-
Methods inherited from class opennlp.tools.util.model.BaseModel
getArtifact, getLanguage, getManifestProperty, getVersion, isLoadedFromSerialized, serialize, serialize, serialize
-
-
-
-
Constructor Detail
-
LanguageDetectorModel
public LanguageDetectorModel(MaxentModel langdetectModel, Map<String,String> manifestInfoEntries, LanguageDetectorFactory factory)
Initializes aLanguageDetectorModel
instance via given parameters.- Parameters:
langdetectModel
- A validMaxentModel
.manifestInfoEntries
- Additional information kept in the manifest.factory
- TheLanguageDetectorFactory
for creating related objects.
-
LanguageDetectorModel
public LanguageDetectorModel(InputStream in) throws IOException
Initializes aLanguageDetectorModel
instance via a validInputStream
.- Parameters:
in
- TheInputStream
used for loading the model.- Throws:
IOException
- Thrown if IO errors occurred during initialization.
-
LanguageDetectorModel
public LanguageDetectorModel(File modelFile) throws IOException
Initializes aLanguageDetectorModel
instance via a validFile
.- Parameters:
modelFile
- TheFile
used for loading the model.- Throws:
IOException
- Thrown if IO errors occurred during initialization.
-
LanguageDetectorModel
public LanguageDetectorModel(URL modelURL) throws IOException
Initializes aLanguageDetectorModel
instance via a validURL
.- Parameters:
modelURL
- TheURL
used for loading the model.- Throws:
IOException
- Thrown if IO errors occurred during initialization.
-
-
Method Detail
-
getFactory
public LanguageDetectorFactory getFactory()
- Returns:
- Retrieves the active
LanguageDetectorFactory
.
-
getMaxentModel
public MaxentModel getMaxentModel()
- Returns:
- Retrieves a
MaxentModel
.
-
-