lib/fuzzy_match/similarity.rb in fuzzy_match-2.0.4 vs lib/fuzzy_match/similarity.rb in fuzzy_match-2.1.0
- old
+ new
@@ -20,12 +20,12 @@
def best_score
@best_score ||= FuzzyMatch.score_class.new(record1.clean, record2.clean)
end
def satisfy?(needle, threshold)
- best_score.dices_coefficient_similar > threshold or
+ best_score.dices_coefficient_similar > (threshold || 0) or
((record2.clean.length < 3 or needle.clean.length < 3) and best_score.levenshtein_similar > 0) or
- (needle.words & record2.words).any?
+ (threshold.nil? && (needle.words & record2.words).any?)
end
def inspect
%{#{record2.clean.inspect} ~ #{record1.clean.inspect} => #{best_score.inspect}}
end