Package opennlp.tools.langdetect
Class LanguageDetectorFactory
java.lang.Object
opennlp.tools.util.BaseToolFactory
opennlp.tools.langdetect.LanguageDetectorFactory
Default factory used by
LanguageDetector
.
Extend this class to change the Language Detector behaviour,
such as the LanguageDetectorContextGenerator
.
The default DefaultLanguageDetectorContextGenerator
will use char n-grams of
size 1 to 3 and the following normalizers:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic LanguageDetectorFactory
Instantiates aLanguageDetectorFactory
via a givensubclassName
.void
init()
void
Validates the parsed artifacts.Methods inherited from class opennlp.tools.util.BaseToolFactory
create, create, createArtifactMap, createArtifactSerializersMap, createManifestEntries
-
Constructor Details
-
LanguageDetectorFactory
public LanguageDetectorFactory()
-
-
Method Details
-
getContextGenerator
- Returns:
- Retrieves a
LanguageDetectorContextGenerator
.
-
create
Instantiates aLanguageDetectorFactory
via a givensubclassName
.- Parameters:
subclassName
- The class name used for instantiation. Ifnull
, an instance ofLanguageDetectorFactory
will be returned per default. Otherwise, theExtensionLoader
mechanism is applied to load the requestedsubclassName
.- Returns:
- A valid
LanguageDetectorFactory
instance. - Throws:
InvalidFormatException
- Thrown if theExtensionLoader
mechanism failed to create the factory associated withsubclassName
.
-
init
public void init() -
validateArtifactMap
Description copied from class:BaseToolFactory
Validates the parsed artifacts.Note: Subclasses should generally invoke
super.validateArtifactMap
at the beginning of this method.- Specified by:
validateArtifactMap
in classBaseToolFactory
- Throws:
InvalidFormatException
- Thrown if validation found invalid states.
-