Module: JaroWinkler

Defined in:
lib/jaro_winkler/version.rb,
lib/jaro_winkler/adjusting_table.rb,
lib/jaro_winkler/jaro_winkler_pure.rb,
ext/jaro_winkler/jaro_winkler.c

Defined Under Namespace

Classes: Error, InvalidWeightError

Constant Summary collapse

VERSION =
'1.6.0'
DEFAULT_ADJ_TABLE =
Hash.new { |h, k| h[k] = Hash.new(&h.default_proc) }
DEFAULT_WEIGHT =
0.1
DEFAULT_THRESHOLD =
0.7
DEFAULT_OPTIONS =
{
  jaro: { adj_table: false, ignore_case: false },
  jaro_winkler: { weight: DEFAULT_WEIGHT, threshold: DEFAULT_THRESHOLD }
}.freeze

Class Method Summary collapse

Class Method Details

.distance(str1, str2, options = {}) ⇒ Object



7
8
9
10
# File 'ext/jaro_winkler/jaro_winkler.c', line 7

def distance(str1, str2, options = {})
  warn("JaroWinkler.distance is deprecated. Use JaroWinkler.similarity instead.")
  similarity(str1, str2, options)
end

.jaro_distance(str1, str2, options = {}) ⇒ Object



9
10
11
12
# File 'ext/jaro_winkler/jaro_winkler.c', line 9

def jaro_distance(str1, str2, options = {})
  warn("JaroWinkler.jaro_distance is deprecated. Use JaroWinkler.jaro_similarity instead.")
  jaro_similarity(str1, str2, options)
end

.jaro_similarity(str1, str2, options = {}) ⇒ Object



10
11
12
13
# File 'ext/jaro_winkler/jaro_winkler.c', line 10

def jaro_similarity(str1, str2, options = {})
  validate!(str1, str2)
  _jaro_distance str1.codepoints.to_a, str2.codepoints.to_a, options
end

.similarity(str1, str2, options = {}) ⇒ Object



8
9
10
11
# File 'ext/jaro_winkler/jaro_winkler.c', line 8

def similarity(str1, str2, options = {})
  validate!(str1, str2)
  _distance str1.codepoints.to_a, str2.codepoints.to_a, options
end