diff --git a/spec/porter_stemmer_spec.js b/spec/porter_stemmer_spec.js index dd413f0fb..37592a53a 100644 --- a/spec/porter_stemmer_spec.js +++ b/spec/porter_stemmer_spec.js @@ -21,6 +21,7 @@ THE SOFTWARE. */ var stemmer = require('../lib/natural/stemmers/porter_stemmer'); +var stopwords = require('../lib/natural/util/stopwords'); describe('porter_stemmer', function() { it('should categorizeGroups', function() { @@ -179,4 +180,13 @@ describe('porter_stemmer', function() { expect('scoring stinks'.tokenizeAndStem()).toEqual(['score', 'stink']); expect('SCORING STINKS'.tokenizeAndStem()).toEqual(['score', 'stink']); }); + + it('should tokenize and stem ignoring stopwords', function() { + expect('My dog is very fun TO play with And another thing, he is A poodle.'.tokenizeAndStem()).toEqual(['dog', 'fun', 'plai', 'thing', 'poodl']); + }); + + it('should tokenize and stem ignoring all capital stopwords', function() { + var allCapitalStopwords = stopwords.words.join(' ').toUpperCase(); + expect(allCapitalStopwords.tokenizeAndStem()).toEqual([]); + }); });