porterStemmer

Extract the stem of a given word.

Usage

var porterStemmer = require( '@stdlib/nlp/porter-stemmer' );

porterStemmer( word )

Extracts the stem of a given word using the Porter stemming algorithm.

var out = porterStemmer( 'worldwide' );
// returns 'worldwid'

out = porterStemmer( 'fighting' );
// returns 'fight'

Examples

var porterStemmer = require( '@stdlib/nlp/porter-stemmer' );

var out = porterStemmer( 'walking' );
// returns 'walk'

out = porterStemmer( 'walked' );
// returns 'walk'

out = porterStemmer( 'walks' );
// returns 'walk'

out = porterStemmer( '' );
// returns ''

References

  • Porter, Michael F. 1980. "An algorithm for suffix stripping." Program 13 (3): 130–37. doi:10.1108/eb046814.
Did you find this page helpful?