Sha256: 0ee003a6a430a8142493e7612130648d25ae4cb0b24c60796fc4e6983e13c5db

Contents?: true

Size: 699 Bytes

Versions: 7

Compression:

Stored size: 699 Bytes

Contents

class FuzzyMatch
  class Score
    # be sure to `require 'amatch'` before you use this class
    class Amatch < Score

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

      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

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
fuzzy_match-1.5.0 lib/fuzzy_match/score/amatch.rb
fuzzy_match-1.4.1 lib/fuzzy_match/score/amatch.rb
fuzzy_match-1.4.0 lib/fuzzy_match/score/amatch.rb
fuzzy_match-1.3.3 lib/fuzzy_match/score/amatch.rb
fuzzy_match-1.3.2 lib/fuzzy_match/score/amatch.rb
fuzzy_match-1.3.1 lib/fuzzy_match/score/amatch.rb
fuzzy_match-1.3.0 lib/fuzzy_match/score/amatch.rb