All Downloads are FREE. Search and download functionalities are using the official Maven repository.

morfologik.stemming.PolishStemmer Maven / Gradle / Ivy

Go to download

Morfologik provides high quality lemmatisation for the Polish language, along with tools for building and using byte-based finite state automata.

There is a newer version: 2.1.9
Show newest version
package morfologik.stemming;

import java.util.Iterator;
import java.util.List;

/**
 * A dictionary-based stemmer for the Polish language. This stemmer requires an
 * FSA-compiled dictionary to be present in classpath resources.
 * 
 * Objects of this class are not thread safe.
 * 
 * @see morfologik.stemming.DictionaryLookup
 */
public final class PolishStemmer implements IStemmer, Iterable {
	/**
	 * Dictionary lookup delegate.
	 */
	private final DictionaryLookup delegate;

	/**
	 * This constructor is initialized with a built-in dictionary or fails with
	 * a runtime exception if the dictionary is not available.
	 */
	public PolishStemmer() {
		final String languageCode = "pl";

		this.delegate = new DictionaryLookup(Dictionary.getForLanguage(languageCode));
	}

	/**
	 * {@inheritDoc}
	 */
	public List lookup(CharSequence word) {
		return delegate.lookup(word);
	}

	/**
	 * Iterates over all dictionary forms stored in this stemmer.
	 */
	public Iterator iterator() {
		return delegate.iterator();
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy