waseem18 / node-rake

A NodeJS implementation of the Rapid Automatic Keyword Extraction algorithm.
http://www.thabraze.me/node-rake/
MIT License
100 stars 20 forks source link

Filter newlines out of phrase list #6

Closed sleepycat closed 7 years ago

sleepycat commented 7 years ago

The generatePhrases function was checking for '' and ' ' but not '\n'. Input text containing new lines would find their way into the phrase list and then blow up in calculateKeywordScores when word_list.length was called. The error was:

TypeError: Cannot read property 'length' of null