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.5.4'
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 = {})
  validate!(str1, str2)
  _distance str1.codepoints.to_a, str2.codepoints.to_a, options
end

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


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

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