node-rake icon indicating copy to clipboard operation
node-rake copied to clipboard

TypeError: Cannot read property 'forEach' of null

Open stovenator opened this issue 5 years ago • 1 comments

This occurs only when you have a stop word, followed by multiple spaces, and then followed by a stop word.

For example:

> rake.generate("Please elaborate on planets of    the")
TypeError: Cannot read property 'forEach' of null
    at phraseList.forEach (/Users/mastover/git/rake-test/node_modules/node-rake/index.js:75:16)
    at Array.forEach (<anonymous>)
    at Rake.calculatePhraseScores (/Users/mastover/git/rake-test/node_modules/node-rake/index.js:71:16)
    at Rake.generate (/Users/mastover/git/rake-test/node_modules/node-rake/index.js:89:31)
    at Object.generate (/Users/mastover/git/rake-test/node_modules/node-rake/app.js:13:21)
> rake.generate("Please elaborate on planets   of the")
[ 'elaborate', 'planets' ]
> rake.generate("Please elaborate on     planets   of the")
[ 'elaborate', 'planets' ]

stovenator avatar Sep 11 '18 19:09 stovenator

I collapsed multiple spaces first; but I'm still getting this same error message when using stopwords.

mcthulhu avatar Aug 30 '20 20:08 mcthulhu