Class: Wikipedia::VandalismDetection::Features::CommentSexFrequency

Inherits:
FrequencyBase
  • Object
show all
Defined in:
lib/wikipedia/vandalism_detection/features/comment_sex_frequency.rb

Overview

This feature computes frequency of sex words in the comment of the edit’s new revision.

Instance Method Summary collapse

Methods inherited from FrequencyBase

#frequency

Methods inherited from Base

#count

Instance Method Details

#calculate(edit) ⇒ Object

Returns the percentage of sex words in the new revision’s comment. Returns 0.0 if text is of zero length.



13
14
15
16
17
18
# File 'lib/wikipedia/vandalism_detection/features/comment_sex_frequency.rb', line 13

def calculate(edit)
  super

  comment = edit.new_revision.comment.clean
  frequency(comment, WordLists::SEX)
end