From 3756a8b3387f3f7e5c778b964ec681dcf110b098 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Tue, 22 Nov 2016 13:11:39 +0100 Subject: [PATCH] fixed JS tokenizer stopword filter the in operator does not work as it was used here. fixes https://github.com/yiisoft/yii2-apidoc/issues/42 --- lib/tokenizer/StandardTokenizer.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/tokenizer/StandardTokenizer.php b/lib/tokenizer/StandardTokenizer.php index 37ce02c..710d90b 100644 --- a/lib/tokenizer/StandardTokenizer.php +++ b/lib/tokenizer/StandardTokenizer.php @@ -76,7 +76,10 @@ function(string) { return string.split(/[\s$delimiters]+/).map(function(val) { return val.toLowerCase(); }).filter(function(val) { - return !(val in stopWords); + for (w in stopWords) { + if (stopWords[w] == val) return false; + } + return true; }).map(function(word) { return {t: word, w: 1}; });