Class: FuzzyMatch::Score::Amatch

Inherits:
FuzzyMatch::Score show all
Defined in:
lib/fuzzy_match/score/amatch.rb

Overview

be sure to ‘require ’amatch’‘ before you use this class

Instance Attribute Summary

Attributes inherited from FuzzyMatch::Score

#str1, #str2

Instance Method Summary collapse

Methods inherited from FuzzyMatch::Score

#<=>, #initialize

Constructor Details

This class inherits a constructor from FuzzyMatch::Score

Instance Method Details

#dices_coefficient_similarObject



10
11
12
13
14
15
16
17
18
# File 'lib/fuzzy_match/score/amatch.rb', line 10

def dices_coefficient_similar
  @dices_coefficient_similar ||= if str1 == str2
    1.0
  elsif str1.length == 1 and str2.length == 1
    0.0
  else
    str1.pair_distance_similar str2
  end
end

#inspectObject



6
7
8
# File 'lib/fuzzy_match/score/amatch.rb', line 6

def inspect
  %{#<FuzzyMatch::Score::Amatch: str1=#{str1.inspect} str2=#{str2.inspect} dices_coefficient_similar=#{dices_coefficient_similar} levenshtein_similar=#{levenshtein_similar}>}
end

#levenshtein_similarObject



20
21
22
# File 'lib/fuzzy_match/score/amatch.rb', line 20

def levenshtein_similar
  @levenshtein_similar ||= str1.levenshtein_similar str2
end