The most important application scenario in machine learning is the automatic classification of machines, and the key to classification is stemming. So we're going to use the snowball. Here's a look at two ways to extract stems from snowball.
Two methods:
Method One:
>>> from NLTK import Snowballstemmer
>>> Snowballstemmer.languages # See which languages is supported
(' Danish ', ' Dutch ', ' 中文版 ', ' Finnish ', ' French ', ' German ', ' Hungarian ',
' Italian ', ' Norwegian ', ' Porter ', ' Portuguese ', ' Romanian ',
' Russian ', ' Spanish ', ' Swedish ')
>>> stemmer = Snowballstemmer ("German") # Choose a language
>>> stemmer.stem (U "Autobahnen") # Stem a word
U ' Autobahn '
But when you know the language scene you are using, you can call it directly using the following method:
Method Two:
>>> PS = Nltk.stem.snowball.PortugueseStemmer ()
>>> ps.stem (' Celular ')
U ' Celul '
>>> ps.stem (' Celular ')
U ' Celul '