Module: Eco::Data::FuzzyMatch::ClassMethods

Includes:
ArrayHelpers, CharsPositionScore, NGramsScore, Pairing, StringHelpers
Included in:
Eco::Data::FuzzyMatch
Defined in:
lib/eco/data/fuzzy_match.rb

Instance Method Summary collapse

Methods included from NGramsScore

#ngrams_score, #words_ngrams_score

Methods included from CharsPositionScore

#chars_position_score

Methods included from Pairing

#paired_words

Methods included from StringHelpers

#get_words, #no_blanks, #normalize_string, #remove_matching_words, #string_combinations, #string_ngrams, #string_permutations, #word_ngrams

Methods included from ArrayHelpers

#combinations, #facet, #ngrams, #permutations

Instance Method Details

#jaro_winkler(str1, str2, **options) ⇒ Object



26
27
28
29
30
31
32
33
34
35
# File 'lib/eco/data/fuzzy_match.rb', line 26

def jaro_winkler(str1, str2, **options)
  return 0 if !str1 || !str2
  options = {
    ignore_case: true,
    weight:      0.25
  }.merge(options)

  require 'jaro_winkler'
  JaroWinkler.distance(str1, str2, **options)
end