Sha256: de8ba7721393c0a056387ca03f72b1ecc09d9d6daa1cfa3d4214e75949540ee7

Contents?: true

Size: 434 Bytes

Versions: 8

Compression:

Stored size: 434 Bytes

Contents

module SlideRule
  module DistanceCalculators
    class Levenshtein
      def calculate(first, second)
        ::Vladlev.get_normalized_distance(first, second).to_f

        # Lower bound is difference in length
        # distance = matrix.last.last.to_f - (first.length - second.length).abs

        # Upper bound is length of longest string
        # This will decrease distance more for longer strings.
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
slide_rule-0.2.2 lib/slide_rule/distance_calculators/levenshtein.rb
slide_rule-0.2.1 lib/slide_rule/distance_calculators/levenshtein.rb
slide_rule-0.2.0 lib/slide_rule/distance_calculators/levenshtein.rb
slide_rule-0.0.4 lib/slide_rule/distance_calculators/levenshtein.rb
slide_rule-0.1.2 lib/slide_rule/distance_calculators/levenshtein.rb
slide_rule-0.1.1 lib/slide_rule/distance_calculators/levenshtein.rb
slide_rule-0.1.0 lib/slide_rule/distance_calculators/levenshtein.rb
slide_rule-0.0.3 lib/slide_rule/distance_calculators/levenshtein.rb