From 23ad3c9405d9bb358e2305e413e13436a0b8fc93 Mon Sep 17 00:00:00 2001 From: sr9yar Date: Sun, 3 Dec 2017 15:21:32 +0300 Subject: [PATCH] Word bounaries for unicode chars \b are not working for languages other than english. Which makes it impossible to use at all. Simply removing them seems to work fine though. --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 87535b4..bfe523e 100644 --- a/index.js +++ b/index.js @@ -71,7 +71,7 @@ class Rake { phraseList.forEach((phrase) => { phraseScores[phrase] = 0; let candidateScore = 0; - const wordList = phrase.match(/(\b[^\s]+\b)/g); + const wordList = phrase.match(/([^\s]+)/g); wordList.forEach((word) => { candidateScore += wordScore[word]; }); phraseScores[phrase] = candidateScore; });