Package opennlp.tools.models.dir
Class DirectoryModelFinder
java.lang.Object
opennlp.tools.models.AbstractClassPathModelFinder
opennlp.tools.models.dir.DirectoryModelFinder
- All Implemented Interfaces:
ClassPathModelFinder
public class DirectoryModelFinder
extends AbstractClassPathModelFinder
implements ClassPathModelFinder
The
DirectoryModelFinder class is responsible for finding model files in a given directory
on the classpath.
This class allows searching for models based on wildcard patterns, either in plain directory structures or within JAR files. The search can be performed recursively depending on the specified configuration.
Usage:
- Provide the prefix for models to be found in JAR files using the
jarModelPrefixparameter. - Specify the directory to search and whether to enable recursive scanning.
- The class supports resolving both direct file matches and entries within JAR archives.
-
Field Summary
Fields inherited from interface opennlp.tools.models.ClassPathModelFinder
OPENNLP_MODEL_JAR_PREFIX -
Constructor Summary
ConstructorsConstructorDescriptionDirectoryModelFinder(String jarModelPrefix, Path directory, boolean recursive) Instantiates a newDirectoryModelFinderwith the specified parameters. -
Method Summary
Methods inherited from class opennlp.tools.models.AbstractClassPathModelFinder
findModelsMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface opennlp.tools.models.ClassPathModelFinder
findModels
-
Constructor Details
-
DirectoryModelFinder
Instantiates a newDirectoryModelFinderwith the specified parameters.- Parameters:
jarModelPrefix- The prefix for identifying model files in JAR archives; may benull. If it isnull,ClassPathModelFinder.OPENNLP_MODEL_JAR_PREFIXis used.directory- The root directory to scan from for model files; must not benull.recursive-trueif the search should include subdirectories,falseotherwise.- Throws:
IllegalArgumentException- Thrown ifdirectoryisnull.
-