Class: Wikipedia::VandalismDetection::Features::RevisionsCharacterDistribution

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

Overview

This feature computes the Kullback-Leibler Divergence of the old and new text’s character distribution. The smaller the divergence, the higher the similarity of the distributions and conversely.

Instance Method Summary collapse

Methods inherited from Base

#count

Instance Method Details

#calculate(edit) ⇒ Object



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

def calculate(edit)
  super

  kullback_leibler_divergence(edit.old_revision.text, edit.new_revision.text)
end