class Cadmium::JaroWinklerDistance
- Cadmium::JaroWinklerDistance
- Reference
- Object
Overview
Computes the Jaro distance between two string. Code credit goes to kostya. https://github.com/kostya/jaro_winkler
Defined in:
cadmium/distance/jaro_winkler.crConstant Summary
-
DEFAULT_ADJ_TABLE =
[['A', 'E'], ['A', 'I'], ['A', 'O'], ['A', 'U'], ['B', 'V'], ['E', 'I'], ['E', 'O'], ['E', 'U'], ['I', 'O'], ['I', 'U'], ['O', 'U'], ['I', 'Y'], ['E', 'Y'], ['C', 'G'], ['E', 'F'], ['W', 'U'], ['W', 'V'], ['X', 'K'], ['S', 'Z'], ['X', 'S'], ['Q', 'C'], ['U', 'V'], ['M', 'N'], ['L', 'I'], ['Q', 'O'], ['P', 'R'], ['I', 'J'], ['2', 'Z'], ['5', 'S'], ['8', 'B'], ['1', 'I'], ['1', 'L'], ['0', 'O'], ['0', 'Q'], ['C', 'K'], ['G', 'J'], ['E', ' '], ['Y', ' '], ['S', ' ']].reduce(Set(Tuple(Char, Char)).new) do |set, elem| c1, c2 = elem set << {c1, c2} set << {c2, c1} set << {c1.downcase, c2.downcase} set << {c2.downcase, c1.downcase} set << {c1.downcase, c2} set << {c2, c1.downcase} set << {c1, c2.downcase} set << {c2.downcase, c1} set end
Constructors
Instance Method Summary
- #distance(s1 : String, s2 : String)
- #distance(codes1 : Array(Char), codes2 : Array(Char))
- #jaro_distance(s1 : String, s2 : String)
- #jaro_distance(codes1 : Array(Char), codes2 : Array(Char))
- #match_count(len1, len2, flags1, flags2, codes1, codes2, window)
Constructor Detail
def self.new(weight : Float64 = 0.1, threshold : Float64 = 0.7, ignore_case : Bool = false, adj_table : Bool = false)
#