Class: Wikipedia::VandalismDetection::Features::ContainsBase
- Defined in:
- lib/wikipedia/vandalism_detection/features/contains_base.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#contains(comment, terms) ⇒ Object
Returns whether the comment contains the given term.
Methods inherited from Base
Instance Method Details
#contains(comment, terms) ⇒ Object
Returns whether the comment contains the given term. It returns 0 if term is not included, else 1.
11 12 13 14 |
# File 'lib/wikipedia/vandalism_detection/features/contains_base.rb', line 11 def contains(comment, terms) terms = terms.is_a?(Array) ? terms.join('|') : terms (comment =~ /#{terms}/i) ? 1 : 0 end |