Class: Wikipedia::VandalismDetection::Features::Blanking

Inherits:
Base
  • Object
show all
Defined in:
lib/wikipedia/vandalism_detection/features/blanking.rb

Overview

This feature returns whether the edit’s is a blanking. size < 7, based on Mola Velasco 2010 implementation.

Constant Summary collapse

BLANKING_THRESHOLD =
7

Instance Method Summary collapse

Methods inherited from Base

#count

Instance Method Details

#calculate(edit) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/wikipedia/vandalism_detection/features/blanking.rb', line 13

def calculate(edit)
  super

  old_text_size = edit.old_revision.text.size
  new_text_size = edit.new_revision.text.size

  blanking = (old_text_size > new_text_size) && (new_text_size < BLANKING_THRESHOLD)
  blanking ? 1.0 : 0.0
end