jaro_winkler 1.5.5 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/jaro_winkler/jaro_winkler.c +21 -0
- data/lib/jaro_winkler/jaro_winkler_pure.rb +10 -0
- data/lib/jaro_winkler/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 30727667e49f3cdcafdff62435bd00f3347a6d81c6f257c01fe3a11895a54d91
|
4
|
+
data.tar.gz: b6a8dd2fd12acf7375f23cc8c8cf3769adaa35bc94a3fba014b6fd5abd816d4a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4377bd38d2c379a2584ce60723868b558ac05f5bc585cb5ee87d0e0b6036060d8a6f700cc922638b74eb8f596e8c7506e4df134d31862e2f6aec9a559b2600f9
|
7
|
+
data.tar.gz: 6e5ec4835471adf2f4bd567bd7bbf2a9e02f9e23bd470cd7077638d60880f39adea46d10ae278945ea2edc594f7aa727bc60f630c86c61a9dbe14e22e53bc8d9
|
@@ -5,13 +5,20 @@
|
|
5
5
|
VALUE rb_mJaroWinkler, rb_eError, rb_eInvalidWeightError;
|
6
6
|
|
7
7
|
VALUE rb_jaro_winkler_distance(int argc, VALUE *argv, VALUE self);
|
8
|
+
VALUE rb_jaro_winkler_similarity(int argc, VALUE *argv, VALUE self);
|
8
9
|
VALUE rb_jaro_distance(int argc, VALUE *argv, VALUE self);
|
10
|
+
VALUE rb_jaro_similarity(int argc, VALUE *argv, VALUE self);
|
9
11
|
VALUE distance(int argc, VALUE *argv, VALUE self,
|
10
12
|
double (*distance_fn)(uint32_t *codepoints1, size_t len1,
|
11
13
|
uint32_t *codepoints2, size_t len2,
|
12
14
|
Options *));
|
13
15
|
|
14
16
|
void Init_jaro_winkler_ext(void) {
|
17
|
+
|
18
|
+
#ifdef HAVE_RB_EXT_RACTOR_SAFE
|
19
|
+
rb_ext_ractor_safe(true);
|
20
|
+
#endif
|
21
|
+
|
15
22
|
rb_mJaroWinkler = rb_define_module("JaroWinkler");
|
16
23
|
rb_eError = rb_define_class_under(rb_mJaroWinkler, "Error", rb_eRuntimeError);
|
17
24
|
rb_eInvalidWeightError =
|
@@ -20,6 +27,10 @@ void Init_jaro_winkler_ext(void) {
|
|
20
27
|
rb_jaro_winkler_distance, -1);
|
21
28
|
rb_define_singleton_method(rb_mJaroWinkler, "jaro_distance", rb_jaro_distance,
|
22
29
|
-1);
|
30
|
+
rb_define_singleton_method(rb_mJaroWinkler, "similarity",
|
31
|
+
rb_jaro_winkler_similarity, -1);
|
32
|
+
rb_define_singleton_method(rb_mJaroWinkler, "jaro_similarity", rb_jaro_similarity,
|
33
|
+
-1);
|
23
34
|
}
|
24
35
|
|
25
36
|
VALUE distance(int argc, VALUE *argv, VALUE self,
|
@@ -64,9 +75,19 @@ VALUE distance(int argc, VALUE *argv, VALUE self,
|
|
64
75
|
}
|
65
76
|
|
66
77
|
VALUE rb_jaro_distance(int argc, VALUE *argv, VALUE self) {
|
78
|
+
rb_warn("JaroWinkler.jaro_distance is deprecated. Use JaroWinkler.jaro_similarity instead.");
|
79
|
+
return rb_jaro_similarity(argc, argv, self);
|
80
|
+
}
|
81
|
+
|
82
|
+
VALUE rb_jaro_similarity(int argc, VALUE *argv, VALUE self) {
|
67
83
|
return distance(argc, argv, self, jaro_distance_from_codes);
|
68
84
|
}
|
69
85
|
|
70
86
|
VALUE rb_jaro_winkler_distance(int argc, VALUE *argv, VALUE self) {
|
87
|
+
rb_warn("JaroWinkler.distance is deprecated. Use JaroWinkler.similarity instead.");
|
88
|
+
return rb_jaro_winkler_similarity(argc, argv, self);
|
89
|
+
}
|
90
|
+
|
91
|
+
VALUE rb_jaro_winkler_similarity(int argc, VALUE *argv, VALUE self) {
|
71
92
|
return distance(argc, argv, self, jaro_winkler_distance_from_codes);
|
72
93
|
}
|
@@ -14,11 +14,21 @@ module JaroWinkler
|
|
14
14
|
|
15
15
|
class << self
|
16
16
|
def distance(str1, str2, options = {})
|
17
|
+
warn("JaroWinkler.distance is deprecated. Use JaroWinkler.similarity instead.")
|
18
|
+
similarity(str1, str2, options)
|
19
|
+
end
|
20
|
+
|
21
|
+
def similarity(str1, str2, options = {})
|
17
22
|
validate!(str1, str2)
|
18
23
|
_distance str1.codepoints.to_a, str2.codepoints.to_a, options
|
19
24
|
end
|
20
25
|
|
21
26
|
def jaro_distance(str1, str2, options = {})
|
27
|
+
warn("JaroWinkler.jaro_distance is deprecated. Use JaroWinkler.jaro_similarity instead.")
|
28
|
+
jaro_similarity(str1, str2, options)
|
29
|
+
end
|
30
|
+
|
31
|
+
def jaro_similarity(str1, str2, options = {})
|
22
32
|
validate!(str1, str2)
|
23
33
|
_jaro_distance str1.codepoints.to_a, str2.codepoints.to_a, options
|
24
34
|
end
|
data/lib/jaro_winkler/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jaro_winkler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jian Weihang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-06-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -82,9 +82,9 @@ licenses:
|
|
82
82
|
- MIT
|
83
83
|
metadata:
|
84
84
|
bug_tracker_uri: https://github.com/tonytonyjan/jaro_winkler/issues
|
85
|
-
changelog_uri: https://github.com/tonytonyjan/jaro_winkler/blob/v1.
|
86
|
-
documentation_uri: https://www.rubydoc.info/gems/jaro_winkler/1.
|
87
|
-
source_code_uri: https://github.com/tonytonyjan/jaro_winkler/tree/v1.
|
85
|
+
changelog_uri: https://github.com/tonytonyjan/jaro_winkler/blob/v1.6.0/CHANGELOG.md
|
86
|
+
documentation_uri: https://www.rubydoc.info/gems/jaro_winkler/1.6.0
|
87
|
+
source_code_uri: https://github.com/tonytonyjan/jaro_winkler/tree/v1.6.0
|
88
88
|
post_install_message:
|
89
89
|
rdoc_options: []
|
90
90
|
require_paths:
|
@@ -100,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
100
100
|
- !ruby/object:Gem::Version
|
101
101
|
version: '0'
|
102
102
|
requirements: []
|
103
|
-
rubygems_version: 3.
|
103
|
+
rubygems_version: 3.5.9
|
104
104
|
signing_key:
|
105
105
|
specification_version: 4
|
106
106
|
summary: An implementation of Jaro-Winkler distance algorithm written \ in C extension
|