Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- (unknown)
Instance Method Summary collapse
-
#hamming_similar(strings) ⇒ Object
If called on a String, this string is used as a Amatch::Hamming#pattern to match against
strings
. -
#levenshtein_similar(strings) ⇒ Object
If called on a String, this string is used as a Amatch::Levenshtein#pattern to match against
strings
. -
#longest_subsequence_similar(strings) ⇒ Object
If called on a String, this string is used as a Amatch::LongestSubsequence#pattern to match against
strings
. -
#longest_substring_similar(strings) ⇒ Object
If called on a String, this string is used as a Amatch::LongestSubstring#pattern to match against
strings
. -
#pair_distance_similar(strings) ⇒ Object
If called on a String, this string is used as a Amatch::PairDistance#pattern to match against
strings
using /s+/ as the tokenizing regular expression.
Instance Method Details
#hamming_similar(strings) ⇒ Object
If called on a String, this string is used as a Amatch::Hamming#pattern to match against strings
. It returns a Hamming distance metric number between 0.0 for very unsimilar strings and 1.0 for an exact match. strings
has to be either a String or an Array of Strings. The returned results
are either a Float or an Array of Floats respectively.
1058 1059 1060 1061 1062 |
# File 'ext/amatch.c', line 1058
static VALUE rb_str_hamming_similar(VALUE self, VALUE strings)
{
VALUE amatch = rb_Hamming_new(rb_cHamming, self);
return rb_Hamming_similar(amatch, strings);
}
|
#levenshtein_similar(strings) ⇒ Object
If called on a String, this string is used as a Amatch::Levenshtein#pattern to match against strings
. It returns a Levenshtein distance metric number between 0.0 for very unsimilar strings and 1.0 for an exact match. strings
has to be either a String or an Array of Strings. The returned results
are either a Float or an Array of Floats respectively.
695 696 697 698 699 |
# File 'ext/amatch.c', line 695
static VALUE rb_str_levenshtein_similar(VALUE self, VALUE strings)
{
VALUE amatch = rb_Levenshtein_new(rb_cLevenshtein, self);
return rb_Levenshtein_similar(amatch, strings);
}
|
#longest_subsequence_similar(strings) ⇒ Object
If called on a String, this string is used as a Amatch::LongestSubsequence#pattern to match against strings
. It returns a longest subsequence distance metric number between 0.0 for very unsimilar strings and 1.0 for an exact match. strings
has to be either a String or an Array of Strings. The returned results
are either a Float or an Array of Floats respectively.
1134 1135 1136 1137 1138 |
# File 'ext/amatch.c', line 1134
static VALUE rb_str_longest_subsequence_similar(VALUE self, VALUE strings)
{
VALUE amatch = rb_LongestSubsequence_new(rb_cLongestSubsequence, self);
return rb_LongestSubsequence_similar(amatch, strings);
}
|
#longest_substring_similar(strings) ⇒ Object
If called on a String, this string is used as a Amatch::LongestSubstring#pattern to match against strings
. It returns a longest substring distance metric number between 0.0 for very unsimilar strings and 1.0 for an exact match. strings
has to be either a String or an Array of Strings. The returned results
are either a Float or an Array of Floats respectively.
1212 1213 1214 1215 1216 |
# File 'ext/amatch.c', line 1212
static VALUE rb_str_longest_substring_similar(VALUE self, VALUE strings)
{
VALUE amatch = rb_LongestSubstring_new(rb_cLongestSubstring, self);
return rb_LongestSubstring_similar(amatch, strings);
}
|
#pair_distance_similar(strings) ⇒ Object
If called on a String, this string is used as a Amatch::PairDistance#pattern to match against strings
using /s+/ as the tokenizing regular expression. It returns a pair distance metric number between 0.0 for very unsimilar strings and 1.0 for an exact match. strings
has to be either a String or an Array of Strings. The returned results
are either a Float or an Array of Floats respectively.
983 984 985 986 987 |
# File 'ext/amatch.c', line 983
static VALUE rb_str_pair_distance_similar(VALUE self, VALUE strings)
{
VALUE amatch = rb_PairDistance_new(rb_cPairDistance, self);
return rb_PairDistance_match(1, &strings, amatch);
}
|