step1ab()
is a method of the class PorterStemmer
within the nltk.stem.porter module. So you can call it like this:
myPorterStemmer = nltk.stem.porter.PorterStemmer()
...
myPorterStemmer.step1ab()
However, it's not really designed to be called directly. One would usually call myPorterStemmer.stem(word)
, which would then delegate to step1ab()
to do part of the work.
If you really want to use step1ab
in isolation though, you would have to set a bunch of variables and you'd get something like this:
>>> word = "countries"
>>> myStemmer = nltk.stem.porter.PorterStemmer()
>>> myStemmer.b = word
>>> myStemmer.k = len(word) - 1
>>> myStemmer.k0 = 0
>>> myStemmer.step1ab()
>>> myStemmer.b[myStemmer.k0:myStemmer.k+1]
'countri'