Class AbstractClassPathModelFinder
- All Implemented Interfaces:
opennlp.tools.models.ClassPathModelFinder
- Direct Known Subclasses:
ClassgraphModelFinder, DirectoryModelFinder, SimpleClassPathModelFinder
ClassPathModelFinder for the detection of
OpenNLP models in the classpath. By default, AbstractClassPathModelFinder will scan for
JAR files starting with "opennlp-models-*".
This search mask can be adjusted by using the one argument
constructor.
Finders that scan with getMatchingJarEntryURIs(List, String) or
matchesWildcard(URL, String), such as
SimpleClassPathModelFinder and
DirectoryModelFinder, accept * for any run of
characters and ? for one Unicode code point, and match masks against decoded names,
including spaces and non-ASCII characters. Other subclasses may apply their own mask rules:
ClassgraphModelFinder follows the wildcard rules of
the ClassGraph library.
findModels(boolean) may be called from several threads. Concurrent first calls scan
the classpath once, and every caller receives the complete, unmodifiable set of models.
Subclasses must keep getContext() and getMatchingURIs(String, Object) free
of shared mutable state.
- See Also:
-
Field Summary
Fields inherited from interface opennlp.tools.models.ClassPathModelFinder
OPENNLP_MODEL_JAR_PREFIX -
Constructor Summary
ConstructorsConstructorDescriptionBy default, it scans forClassPathModelFinder.OPENNLP_MODEL_JAR_PREFIX.AbstractClassPathModelFinder(String jarModelPrefix) -
Method Summary
Modifier and TypeMethodDescriptionSet<opennlp.tools.models.ClassPathModelEntry> findModels(boolean reloadCache)
-
Constructor Details
-
AbstractClassPathModelFinder
public AbstractClassPathModelFinder()By default, it scans forClassPathModelFinder.OPENNLP_MODEL_JAR_PREFIX. -
AbstractClassPathModelFinder
- Parameters:
jarModelPrefix- The leafnames of the jars that should be scanned (e.g. "opennlp.jar"). May contain a wildcard glob ("opennlp-*.jar"). It must not benull.- Throws:
IllegalArgumentException- Thrown ifjarModelPrefixisnull.
-
-
Method Details
-
findModels
The result is cached; concurrent first calls scan the classpath once. The returned set is unmodifiable and does not change when the cache is reloaded.
- Specified by:
findModelsin interfaceopennlp.tools.models.ClassPathModelFinder
-