Skip to content

Commit

Permalink
more step 4 for #176
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisumbel committed Mar 14, 2015
1 parent 685d8c4 commit 3165cb3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/natural/stemmers/porter_stemmer.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var Stemmer = require('./stemmer');
// denote groups of consecutive consonants with a C and consecutive vowels
// with a V.
function categorizeGroups(token) {
return token.replace(/[^aeiou]+y/g, 'CV').replace(/[aeiou]+/g, 'V').replace(/[^V]+/g, 'C')
return token.replace(/[^aeiouy]+y/g, 'CV').replace(/[aeiou]+/g, 'V').replace(/[^V]+/g, 'C')
}

// denote single consonants with a C and single vowels with a V
Expand Down
5 changes: 5 additions & 0 deletions spec/porter_stemmer_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ var stemmer = require('../lib/natural/stemmers/porter_stemmer');
describe('porter_stemmer', function() {
it('should categorizeGroups', function() {
expect(stemmer.categorizeGroups('syllog')).toBe('CVCVC');
expect(stemmer.categorizeGroups('gypsy')).toBe('CVCV');
});

it('should measure', function() {
Expand Down Expand Up @@ -159,6 +160,10 @@ describe('porter_stemmer', function() {
expect(stemmer.stem('syllogism')).toBe('syllog');
});

it('issue 176 - vehement - step 4', function() {
expect(stemmer.stem('gypsy')).toBe('gypsi');
});

it('issue 176 - corruptiblity', function() {
expect(stemmer.stem('corruptibility')).toBe('corrupt');
});
Expand Down

0 comments on commit 3165cb3

Please sign in to comment.