-

- -

Thursday, September 6, 2012

JavaScript implementation of Porter Stemmer

.

Javascript implementation of the Porter Stemmer

About

This is the reference javascript implementation for the original Porter Stemmer from 1980.

There is a second project which covers the Porter2 stemming algorithm, (rev. July 2005): you can find that at the following url: https://github.com/kristopolous/Porter2-Stemmer.

The reference has also been included in the spec directory.

Usage

Include the js file, then run stemmer(<word to stem>) to return the stemmed word.

You can get a trace as to what is going on, corresponding to the steps outlined in the papers, by providing a second argument of "true" and using one of the browser debug consoles.

For instance, stemmer("hopefully", true) will output 1c /^(.*[aeiouy].*)y$/ hopefulli, telling us that rule 1c was matched by that regular expression and as a result, we got hopefulli.

Status

As of Sept 6, 2012, PorterStemmer1980 is 100% compliant.

Demo

There is a demo available here

Mailing List

Available over here.

.

https://github.com/kristopolous/Porter-Stemmer

.

https://tartarus.org/martin/PorterStemmer/js.txt

.

http://winkjs.org/wink-porter2-stemmer/

.