class Amatch::DamerauLevenshtein
XXX The DamerauLevenshtein
edit distance is defined as the minimal costs involved to transform one string into another by using three elementary operations: deletion, insertion and substitution of a character. To transform “water” into “wine”, for instance, you have to substitute “a” -> “i”: “witer”, “t” -> “n”: “winer” and delete “r”: “wine”. The edit distance between “water” and “wine” is 3, because you have to apply three operations. The edit distance between “wine” and “wine” is 0 of course: no operation is necessary for the transformation – they're already the same string. It's easy to see that more similar strings have smaller edit distances than strings that differ a lot.
Public Class Methods
static VALUE rb_DamerauLevenshtein_initialize(VALUE self, VALUE pattern) { GET_STRUCT(General) General_pattern_set(amatch, pattern); return self; }
Public Instance Methods
static VALUE rb_DamerauLevenshtein_match(VALUE self, VALUE strings) { GET_STRUCT(General) return General_iterate_strings(amatch, strings, DamerauLevenshtein_match); }
Returns the current pattern string of this Amatch::Sellers
instance.
Sets the current pattern string of this Amatch::Sellers
instance to pattern
.
static VALUE rb_DamerauLevenshtein_search(VALUE self, VALUE strings) { GET_STRUCT(General) return General_iterate_strings(amatch, strings, DamerauLevenshtein_search); }
static VALUE rb_DamerauLevenshtein_similar(VALUE self, VALUE strings) { GET_STRUCT(General) return General_iterate_strings(amatch, strings, DamerauLevenshtein_similar); }