Skip to content

Commit

Permalink
Added tests validating bug exists where stopword filtering was incorr…
Browse files Browse the repository at this point in the history
…ectly case-sensitive.
  • Loading branch information
Mike Amaral committed Apr 30, 2015
1 parent fd0340c commit a29689b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions spec/porter_stemmer_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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([]);
});
});

0 comments on commit a29689b

Please sign in to comment.