class Amatch::JaroWinkler
This class computes the Jaro-Winkler metric for two strings. The Jaro-Winkler metric computes the similarity between 0 (no match) and 1 (exact match) by looking for matching and transposed characters.
It is a variant of the Jaro metric, with additional weighting towards common prefixes.
Public Class Methods
Creates a new Amatch::JaroWinkler instance
from pattern
.
static VALUE rb_JaroWinkler_initialize(VALUE self, VALUE pattern) { GET_STRUCT(JaroWinkler) JaroWinkler_pattern_set(amatch, pattern); amatch->ignore_case = 1; amatch->scaling_factor = 0.1; return self; }
Public Instance Methods
Returns whether case is ignored when computing matching characters.
Sets whether case is ignored when computing matching characters.
Uses this Amatch::Jaro instance to match Amatch::Jaro#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_JaroWinkler_match(VALUE self, VALUE strings) { GET_STRUCT(JaroWinkler) return JaroWinkler_iterate_strings(amatch, strings, JaroWinkler_match); }
Returns the current pattern string of this instance.
Sets the current pattern string of this instance to pattern
.
The scaling factor is how much weight to give common prefixes. Default is 0.1.
Sets the weight to give common prefixes.