lib/plagiarism/strategries/engine.rb in plagiarism2-0.0.8 vs lib/plagiarism/strategries/engine.rb in plagiarism2-0.0.9
- old
+ new
@@ -33,17 +33,14 @@
def initialize(c, p)
@content, @params = c, p
end
- def retrieve_link(response)
- raise
- end
-
def unique?
+ threshold = Config.threshold || THRESHOLD
ps = PragmaticSegmenter::Segmenter.new(text: content)
valid_segments = self.class.valid_segments(ps, params)
- valid_segments / ps.segment.size >= THRESHOLD
+ valid_segments / ps.segment.size >= threshold
end
def match
typhoeus = self.class.fetch("\"#{content}\"", params)
typhoeus.success? && retrieve_link(typhoeus.response_body)