Class SnowballStemmerFactory

java.lang.Object
opennlp.tools.stemmer.snowball.SnowballStemmerFactory
All Implemented Interfaces:
opennlp.tools.stemmer.StemmerFactory

@ThreadSafe public class SnowballStemmerFactory extends Object implements opennlp.tools.stemmer.StemmerFactory
A thread-safe factory that captures a Snowball stemmer configuration for APIs that accept a StemmerFactory.

Use this factory for the classic one-stemmer-per-thread pattern: newStemmer() returns a plain, thread-confined stemmer without the per-call thread routing of the shareable SnowballStemmer.

  • Constructor Details

    • SnowballStemmerFactory

      public SnowballStemmerFactory(SnowballStemmer.ALGORITHM algorithm)
      Creates a factory with repeat = 1.
      Parameters:
      algorithm - The Snowball algorithm. Must not be null.
      Throws:
      IllegalArgumentException - if algorithm is null.
    • SnowballStemmerFactory

      public SnowballStemmerFactory(SnowballStemmer.ALGORITHM algorithm, int repeat)
      Creates a factory over the given algorithm and repeat count.
      Parameters:
      algorithm - The Snowball algorithm. Must not be null.
      repeat - How many times to apply the stemmer per word; must be positive.
      Throws:
      IllegalArgumentException - if algorithm is null or repeat is not positive.
  • Method Details

    • newStemmer

      public opennlp.tools.stemmer.Stemmer newStemmer()
      Specified by:
      newStemmer in interface opennlp.tools.stemmer.StemmerFactory