lib/text/white_similarity.rb in text-1.0.3 vs lib/text/white_similarity.rb in text-1.0.4
- old
+ new
@@ -35,13 +35,13 @@
def similarity(str1, str2)
pairs1 = word_letter_pairs(str1)
pairs2 = word_letter_pairs(str2).dup
- union = pairs1.count + pairs2.count
+ union = pairs1.length + pairs2.length
intersection = 0
- pairs1.each_with_index do |pair1|
+ pairs1.each do |pair1|
if index = pairs2.index(pair1)
intersection += 1
pairs2.delete_at(index)
end
end