As for things to clean up in this code, I have made up a small list :
1. Group the stem rules properly
2. Clean up and improve the stemmer example. poorly written (as of now).
3. Fix the varnamc version of stem (varnamc --stem). Not working now
4. Give more specific error messages inside set_last_error()
I'm possibly doing something wrong with the memory allocation because calling free() on some pointers is giving me "invalid next size (fast)" errors. Please go through the code and suggest changes (add to the above list).