Package opennlp.tools.stemmer
Class StemmerAnnotatorProvider
java.lang.Object
opennlp.tools.stemmer.StemmerAnnotatorProvider
- All Implemented Interfaces:
DocumentAnnotatorProvider,Provider<DocumentAnnotator>
Provides a
StemmerAnnotator under the name "stemmer". It supports a spec without
location whose only option is "algorithm": "porter" or absent for the
PorterStemmer, otherwise the name of a SnowballStemmer.ALGORITHM. Values are
compared ignoring case, so "porter" always means the PorterStemmer and the
Snowball algorithm of that name is not reachable through this provider.- Since:
- 3.0.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe option that names the stemming algorithm.private final List<SnowballStemmer.ALGORITHM> static final StringThe name of this provider.static final StringThe "algorithm" value for thePorterStemmer. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreate(ProviderSpec spec) Creates a new instance.private booleanname()private SnowballStemmer.ALGORITHMsnowballAlgorithm(String algorithm) booleansupports(ProviderSpec spec) Checks whether this provider can create an instance for a spec, based on the spec alone.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface opennlp.tools.util.ext.Provider
isAvailable, priority
-
Field Details
-
NAME
The name of this provider.- See Also:
-
ALGORITHM_OPTION
The option that names the stemming algorithm.- See Also:
-
PORTER
The "algorithm" value for thePorterStemmer.- See Also:
-
algorithms
-
-
Constructor Details
-
StemmerAnnotatorProvider
public StemmerAnnotatorProvider()
-
-
Method Details
-
name
- Specified by:
namein interfaceProvider<DocumentAnnotator>- Returns:
- The case-sensitive name of this provider: at most 64 characters of ASCII letters,
digits,
.,_or-, since it is used as a configuration value. A provider with another name is skipped when providers are looked up. Providers of one SPI may share a name;Provider.priority()ranks them.
-
supports
Description copied from interface:ProviderChecks whether this provider can create an instance for a spec, based on the spec alone. The check runs on every resolution, so it must not block.- Specified by:
supportsin interfaceProvider<DocumentAnnotator>- Parameters:
spec- The spec to check. Must not benull.- Returns:
trueifProvider.create(ProviderSpec)acceptsspec.
-
isKnown
-
create
Description copied from interface:ProviderCreates a new instance. The caller owns it and closes it if it is closeable. The location of the spec is unvalidated input of the caller: a provider that opens it decides itself which schemes and which directories it accepts.- Specified by:
createin interfaceProvider<DocumentAnnotator>- Parameters:
spec- The spec to create an instance for. Must not benull.- Returns:
- The new instance. Never
null.
-
snowballAlgorithm
-