from nltk.stem.snowball import SnowballStemmer stemmer = SnowballStemmer("english") words = ["running", "runner", "runs"] stemmed_words = [stemmer.stem(word) for word in words] print(stemmed_words)
from nltk.stem.snowball import SnowballStemmer stemmer = SnowballStemmer("french") words = ["marcher", "marchait", "marchons"] stemmed_words = [stemmer.stem(word) for word in words] print(stemmed_words)Output: ['march', 'march', 'marchon'] This example shows how to use the SnowballStemmer to stem French words. In this case, we create a SnowballStemmer object for the French language using the "french" argument. We then apply the stemmer to a list of words and print the stemmed words. Overall, the nltk.stem.snowball module is part of the Natural Language Toolkit (nltk) library, which is a package for working with human language data in Python.