keyword-filter 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/keyword-filter.rb +2 -1
- metadata +1 -1
data/lib/keyword-filter.rb
CHANGED
@@ -12,7 +12,8 @@ class KeywordFilter
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def filter(raw_s)
|
15
|
-
|
15
|
+
regexp = @keywords.join('|')
|
16
|
+
s = raw_s.gsub(/\b(#{regexp})\b/i,'<f>\0</f>')
|
16
17
|
doc = Document.new("<root>#{s}</root>")
|
17
18
|
filtered_words = XPath.match(doc.root, '*')
|
18
19
|
|