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 jarModelPrefix parameter.
  • Specify the directory to search and whether to enable recursive scanning.
  • The class supports resolving both direct file matches and entries within JAR archives.
See Also:
  • Constructor Details

    • DirectoryModelFinder

      public DirectoryModelFinder(String jarModelPrefix, Path directory, boolean recursive)
      Instantiates a new DirectoryModelFinder with the specified parameters.
      Parameters:
      jarModelPrefix - The prefix for identifying model files in JAR archives; may be null. If it is null, ClassPathModelFinder.OPENNLP_MODEL_JAR_PREFIX is used.
      directory - The root directory to scan from for model files; must not be null.
      recursive - true if the search should include subdirectories, false otherwise.
      Throws:
      IllegalArgumentException - Thrown if directory is null.