1 # frozen_string_literal: true
13 doc = Nokogiri::HTML(text.to_html)
18 doc.xpath("//a").each do |link|
20 link_size += link.content.length
23 link_proportion = link_size.to_f / doc.content.length
26 spammy_phrases = SpammyPhrase.pluck(:phrase).count do |phrase|
27 doc.content.include?(phrase)
30 ([link_proportion - 0.2, 0.0].max * 200) +