Class StemmerAnnotatorProvider

java.lang.Object
opennlp.tools.stemmer.StemmerAnnotatorProvider
All Implemented Interfaces:
DocumentAnnotatorProvider, Provider<DocumentAnnotator>

public final class StemmerAnnotatorProvider extends Object implements DocumentAnnotatorProvider
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 Details

  • Constructor Details

    • StemmerAnnotatorProvider

      public StemmerAnnotatorProvider()
  • Method Details

    • name

      public String name()
      Specified by:
      name in interface Provider<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

      public boolean supports(ProviderSpec spec)
      Description copied from interface: Provider
      Checks 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:
      supports in interface Provider<DocumentAnnotator>
      Parameters:
      spec - The spec to check. Must not be null.
      Returns:
      true if Provider.create(ProviderSpec) accepts spec.
    • isKnown

      private boolean isKnown(String algorithm)
    • create

      public DocumentAnnotator create(ProviderSpec spec)
      Description copied from interface: Provider
      Creates 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:
      create in interface Provider<DocumentAnnotator>
      Parameters:
      spec - The spec to create an instance for. Must not be null.
      Returns:
      The new instance. Never null.
    • snowballAlgorithm

      private SnowballStemmer.ALGORITHM snowballAlgorithm(String algorithm)