Sha256: 7672c6f9d209f350b6ca02df48262a1b3181aabdef6ce462cd51191c16ab32f2

Contents?: true

Size: 473 Bytes

Versions: 3

Compression:

Stored size: 473 Bytes

Contents

# coding: utf-8

module StringMetric
  module Levenshtein
    class Experiment
      def self.distance(from, to, options = {})
        m = from.length
        n = to.length

        [m, n].min.times do |i|
          if from[i] == to[i]
            from.slice!(i)
            to.slice!(i)
          end
        end

        options.delete(:strategy)

        # Call default distance implementation
        Levenshtein.distance(from, to, options)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
string_metric-0.1.4 lib/string_metric/levenshtein/experiment.rb
string_metric-0.1.3 lib/string_metric/levenshtein/experiment.rb
string_metric-0.1.2 lib/string_metric/levenshtein/experiment.rb