lib/pupa/processor.rb
def build_losers_to_winners_map(objects)
      inverse = {}
      objects.each do |id,object|
        (inverse[object.to_h.except(:_id)] ||= []) << id
      end

      {}.tap do |map|
        inverse.values.each do |ids|
          ids.drop(1).each do |id|
            map[id] = ids[0]
          end
        end
      end
    end
def build_losers_to_winners_map(objects)
      inverse = {}
      objects.each do |id,object|
        (inverse[object.to_h.except(:_id)] ||= []) << id
      end

      {}.tap do |map|
        inverse.values.each do |ids|
          ids.drop(1).each do |id|
            map[id] = ids[0]
          end
        end
      end
    end
For each object, map its ID to the ID of its duplicate, if any.

 @param [Hash] objects a hash of scraped objects keyed by ID
 @return [Hash] a mapping from an object ID to the ID of its duplicate