Class: DespamilatorFilter::UnusualCharacters

Inherits:
Despamilator::Filter show all
Defined in:
lib/despamilator/filter/unusual_characters.rb

Instance Method Summary collapse

Instance Method Details

#descriptionObject



11
12
13
# File 'lib/despamilator/filter/unusual_characters.rb', line 11

def description
  'Detects and scores each occurrence of an unusual 2 or 3 character combination'
end

#nameObject



7
8
9
# File 'lib/despamilator/filter/unusual_characters.rb', line 7

def name
  'Unusual Characters'
end

#parse(subject) ⇒ Object



15
16
17
18
19
20
# File 'lib/despamilator/filter/unusual_characters.rb', line 15

def parse subject
  initialize_combos
  tokenize(subject.text.without_uris).each do |token|
    subject.register_match!({:score => 0.05, :filter => self}) if @@combos[token.to_sym]
  end
end