The Porter stemming algorithm (or ‘Porter stemmer’) is a process for removing the commoner morphological and inflexional endings from words in English. Its main use is as part of a term normalization process that is usually done when setting up Information Retrieval systems. The rules in the Porter algorithm are separated into five distinct phases numbered from 1 to 5. They are applied to the words in the text starting from phase 1 and moving on to phase 5. Further, they are applied sequentially one after the other as commands in a program.

This is the Porter stemming algorithm, coded up in ANSI C by the author. It may be be regarded as cononical, 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 marked –DEPARTURE– below.

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!

You can compile it on Unix with ‘gcc -O3 -o stem stem.c’ after which ‘stem’ takes a list of inputs and sends the stemmed equivalent to stdout.

The algorithm as encoded here is particularly fast.

0 Shares
Share
+1
Tweet
Share
Stumble