Class: Jamnagar::Refiners::DuplicateDetection
- Defined in:
- lib/jamnagar/refiners/duplicate_detection.rb
Instance Method Summary collapse
-
#initialize(detector = nil, store: nil) ⇒ DuplicateDetection
constructor
A new instance of DuplicateDetection.
- #refine(item) ⇒ Object
- #refinement_result(item) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(detector = nil, store: nil) ⇒ DuplicateDetection
Returns a new instance of DuplicateDetection.
4 5 6 |
# File 'lib/jamnagar/refiners/duplicate_detection.rb', line 4 def initialize(detector=nil, store: nil) @detector = detector || Utilities::DuplicateDetector.new(store) end |
Instance Method Details
#refine(item) ⇒ Object
12 13 14 |
# File 'lib/jamnagar/refiners/duplicate_detection.rb', line 12 def refine(item) super item end |
#refinement_result(item) ⇒ Object
16 17 18 19 20 |
# File 'lib/jamnagar/refiners/duplicate_detection.rb', line 16 def refinement_result(item) result = @detector.detect(item["final_url"]) return {"duplicate" => false} unless result {"duplicate" => true, "duplicate_of" => result["_id"]} end |
#to_s ⇒ Object
8 9 10 |
# File 'lib/jamnagar/refiners/duplicate_detection.rb', line 8 def to_s "Duplicate Detection" end |