Module: Synt::Similar::Tanimoto

Extended by:
Tanimoto
Included in:
Tanimoto
Defined in:
lib/synt/similar/tanimoto.rb

Instance Method Summary collapse

Instance Method Details

#compare(src, cmp) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/synt/similar/tanimoto.rb', line 18

def compare src, cmp
  a = src.uniq
  b = cmp.uniq
  i = a & b

  i.length.to_f / (a.length.to_f + b.length.to_f - i.length.to_f) * 100
end