class SlideRule::DistanceCalculators::Levenshtein
Public Instance Methods
calculate(first, second, options={})
click to toggle source
# File lib/slide_rule/distance_calculators/levenshtein.rb, line 4 def calculate(first, second, options={}) ::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