Package TEES :: Package Utils :: Package Libraries :: Module PorterStemmer
[hide private]

Module PorterStemmer

source code

Porter Stemming Algorithm This is the Porter stemming algorithm, ported to Python from the version coded up in ANSI C by the author. It may be be regarded as canonical, in that it follows the algorithm presented in

Porter, 1980, An algorithm for suffix stripping, Program, Vol. 14, no. 3, pp 130-137,

only differing from it at the points maked --DEPARTURE-- below.

See also http://www.tartarus.org/~martin/PorterStemmer

The algorithm as described in the paper could be exactly replicated by adjusting the points of DEPARTURE, but this is barely necessary, because (a) the points of DEPARTURE are definitely improvements, and (b) no encoding of the Porter stemmer I have seen is anything like as exact as this version, even with the points of DEPARTURE!

Vivake Gupta (v@nano.com)

Modified by Jari Bjorne (added module-level stem-function)

Release 1: January 2001

Classes [hide private]
  PorterStemmer
Functions [hide private]
 
stem(word, startPos=None, endPos=None)
Get the stem of a word.
source code
Variables [hide private]
  porterStemmerSingleton = None
  __package__ = 'TEES.Utils.Libraries'
Function Details [hide private]

stem(word, startPos=None, endPos=None)

source code 
Get the stem of a word.

Returns the stem of the word. Can optionally stem only a substring
of the word argument, if startPos and endPos are defined.

Keyword arguments:
    word (string): the word to be stemmed
    startPos (int): start index of the section to stem in word
    endPos (int): end index of the section to stem in word
Return value (string):
    The stem