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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic LanguageDetectorFactoryInstantiates aLanguageDetectorFactoryvia a givensubclassName.opennlp.tools.langdetect.LanguageDetectorContextGeneratorvoidinit()voidValidates the parsed artifacts.Methods inherited from class BaseToolFactory
create, create, createArtifactMap, createArtifactSerializersMap, createManifestEntries
-
Constructor Details
-
LanguageDetectorFactory
public LanguageDetectorFactory()
-
-
Method Details
-
getContextGenerator
public opennlp.tools.langdetect.LanguageDetectorContextGenerator getContextGenerator()- Returns:
- Retrieves a
LanguageDetectorContextGenerator.
-
create
public static LanguageDetectorFactory create(String subclassName) throws opennlp.tools.util.InvalidFormatException Instantiates aLanguageDetectorFactoryvia a givensubclassName.- Parameters:
subclassName- The class name used for instantiation. Ifnull, an instance ofLanguageDetectorFactorywill be returned per default. Otherwise, theExtensionLoadermechanism is applied to load the requestedsubclassName.- Returns:
- A valid
LanguageDetectorFactoryinstance. - Throws:
opennlp.tools.util.InvalidFormatException- Thrown if theExtensionLoadermechanism failed to create the factory associated withsubclassName.
-
init
public void init() -
validateArtifactMap
public void validateArtifactMap() throws opennlp.tools.util.InvalidFormatExceptionDescription copied from class:BaseToolFactoryValidates the parsed artifacts.Note: Subclasses should generally invoke
super.validateArtifactMapat the beginning of this method.- Specified by:
validateArtifactMapin classBaseToolFactory- Throws:
opennlp.tools.util.InvalidFormatException- Thrown if validation found invalid states.
-