Class: Wikipedia::VandalismDetection::Features::RemovedVulgarismFrequency

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

Overview

This feature computes frequency of vulgarism words in the removed text.

Instance Method Summary collapse

Methods inherited from FrequencyBase

#frequency

Methods inherited from Base

#count

Instance Method Details

#calculate(edit) ⇒ Object

Returns the percentage of vulgarism words in the removed text. Returns 0.0 if removed clean text is of zero length.



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

def calculate(edit)
  super

  text = Text.new(edit.removed_words.join("\n")).clean
  frequency(text, WordLists::VULGARISM)
end