Class: Wikipedia::VandalismDetection::Features::EditsPerUser

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

Overview

This feature calculates the number of submitted edits by the same editor (IP or ID) as the edit’s editor.

Instance Method Summary collapse

Methods inherited from Base

#count

Instance Method Details

#calculate(edit) ⇒ Object

Returns the number of edits the edit’s editor made in the same article. Attention! This is pretty time consuming (~2sec) due to the url request.



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/wikipedia/vandalism_detection/features/edits_per_user.rb', line 15

def calculate(edit)
  super

  revision = edit.new_revision
  page = edit.page

  if page && page.id
    edits_count_from_page(edit)
  else
    edits_count_from_api_request(revision)
  end
end