NaturalNode / natural

general natural language facilities for node
MIT License
10.65k stars 859 forks source link

Porter stemmer fails to stem "animated" #167

Closed chrisumbel closed 10 years ago

chrisumbel commented 10 years ago

"animated" results in "animated"

kkoch986 commented 10 years ago

Looks like changing this line:

        if(categorizeGroups(token).indexOf('V') > 0) {

to

        if(categorizeGroups(token).indexOf('V') >= 0) {

Did the trick, confirmed by looking at another implementation where the regular expression: ^([^aeiou])?[aeiou] is used, the first section of consonants is optional so the stem may start with a vowel (as in animated) and still succeed this test.