Class SnowballStemmerFactory

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

@ThreadSafe public class SnowballStemmerFactory extends Object implements 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.

  • Field Details

  • 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 - Thrown 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 - Thrown if algorithm is null or repeat is not positive.
  • Method Details