A python wrapper around surgebase's porter2 implimentation.
The surgebase library impliments a finate state machine and as such has very good performance. For more information see Credits
from porter2 import stem
print(stem("running"))
# "run"
In order to make this wrapper library I took the porter2.go file from Surgebase, made a few small modifications including making the stem function accept and return C strings and renaming the package to main. I then compiled that file to C, and provided a small wrapper to call the C version.
Becuase the C version of porter2.go is 2.4 MB, I went ahead and compressed it using Python's built in bz2 and added the zipper module to unzip it on first use. The bz2 version is about 0.8 MB. As a result of the decompression step, the very first time porter2 is imported it will take a small amount of time longer than future imports.
I'm not clear on the relationship between surgebase and Jian Zhen but zhenjl appears to deserve authorship credit and surgebase is where I found the go implimentation.