class Amatch::Jaro
This class computes the Jaro metric for two strings. The Jaro metric computes the similarity between 0 (no match) and 1 (exact match) by looking for matching and transposed characters.
Public Class Methods
new(pattern)
click to toggle source
Creates a new Amatch::Jaro instance from
pattern
.
static VALUE rb_Jaro_initialize(VALUE self, VALUE pattern) { GET_STRUCT(Jaro) Jaro_pattern_set(amatch, pattern); amatch->ignore_case = 1; return self; }
Public Instance Methods
ignore_case → true/false
Returns whether case is ignored when computing matching characters.
ignore_case=(true/false)
Sets whether case is ignored when computing matching characters.
match(strings) → results
click to toggle source
Uses this Amatch::Jaro instance to match #pattern against
strings
, that is compute the jaro metric with the strings.
strings
has to be either a String
or an Array of Strings. The returned results
is either a Float
or an Array of Floats respectively.
static VALUE rb_Jaro_match(VALUE self, VALUE strings) { GET_STRUCT(Jaro) return Jaro_iterate_strings(amatch, strings, Jaro_match); }
Also aliased as: similar
pattern → pattern string
Returns the current pattern string of this instance.
pattern=(pattern)
Sets the current pattern string of this instance to pattern
.