Method: Wikipedia::VandalismDetection::Features::LongestWord#calculate

Defined in:
lib/wikipedia/vandalism_detection/features/longest_word.rb

#calculate(edit) ⇒ Object



11
12
13
14
15
16
# File 'lib/wikipedia/vandalism_detection/features/longest_word.rb', line 11

def calculate(edit)
  super

  sequence_hash = Text.new(edit.inserted_words.join("\n")).clean.split(/[\b\s+,;:]/).group_by(&:length)
  sequence_hash.empty? ? 0 : sequence_hash.max.first
end