Class: Wikipedia::VandalismDetection::Features::SameEditor
- Defined in:
- lib/wikipedia/vandalism_detection/features/same_editor.rb
Overview
This feature describes whether the contributor of the new revision is the same as the editor of the old revision.
Instance Method Summary collapse
Methods inherited from Base
Instance Method Details
#calculate(edit) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/wikipedia/vandalism_detection/features/same_editor.rb', line 11 def calculate(edit) super old_revision = edit.old_revision if old_revision.contributor.blank? xml = Wikipedia::api_request({ prop: 'revisions', rvprop: 'user',revids: old_revision.id }) contributor = xml.xpath('//rev/@user').text return Features::MISSING_VALUE if contributor.blank? old_revision.contributor = contributor end (old_revision.contributor == edit.new_revision.contributor) ? 1 : 0 end |