jaro_winkler 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +13 -5
- data/README.md +1 -1
- data/lib/jaro_winkler.rb +3 -1
- data/lib/jaro_winkler/version.rb +1 -1
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
M2Y4MDU5ZmVjNmIwMWQ3NzNmMDdkYzgzZDYwMDVmZDdkMTc0NGUyMg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MDFmODkwMGZkZTQ5OTk4YjZlODRjOWVmNjQxMDVhMjQ1NDlhYzhiMg==
|
5
7
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
YTI5YjYxMjkwYTAyMDhkZjI3Yjc1ZjNhZjdjZGNjMDAxYzg4MmUxNGUzNDBm
|
10
|
+
NzM1ZGRjM2EwZTUxMzM4MWQzM2JhZDE3NjdkMmE2NTVlODdiMjM2YmJlMWY3
|
11
|
+
N2I4MjdhZjkwNzcxNTEyODE4ZTdkNjg1NmZjMjQ0ZWNkN2MzODM=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ZDc4YWQ3NDJlYmYwMDg2MWQyODVkYzI1MjgyMzRhY2EyZDdmNzBiMWQ2MWIw
|
14
|
+
M2I3OWYyZTZkOTc4YzFjODM3MWM3OThmOTRhYjM4YjIwYTc0YTZhMjBmZWJk
|
15
|
+
ZTg4M2Y2MWEzMWU0YzM2ZWQ3MTBmYTZjZjUxMTI4NDMxODQzYTM=
|
data/README.md
CHANGED
@@ -16,7 +16,7 @@ JaroWinkler.jaro_winkler_distance "MARTHA", "MARHTA"
|
|
16
16
|
# => 0.9611
|
17
17
|
JaroWinkler.jaro_winkler_distance "MARTHA", "marhta", case_match: true
|
18
18
|
# => 0.9611
|
19
|
-
JaroWinkler.jaro_winkler_distance "MARTHA", "
|
19
|
+
JaroWinkler.jaro_winkler_distance "MARTHA", "MARHTA", weight: 0.2
|
20
20
|
# => 0.9778
|
21
21
|
```
|
22
22
|
|
data/lib/jaro_winkler.rb
CHANGED
@@ -36,7 +36,9 @@ module JaroWinkler
|
|
36
36
|
matches == 0 ? 0 : 1.0 / 3.0 * (matches / length1 + matches / length2 + (matches - transpositions) / matches)
|
37
37
|
end
|
38
38
|
|
39
|
-
def jaro_winkler_distance s1, s2,
|
39
|
+
def jaro_winkler_distance s1, s2, options = {}
|
40
|
+
options = {weight: 0.1, threshold: 0.7, case_match: false}.merge options
|
41
|
+
weight, threshold, case_match = options[:weight], options[:threshold], options[:case_match]
|
40
42
|
raise 'Scaling factor should not exceed 0.25, otherwise the distance can become larger than 1' if weight > 0.25
|
41
43
|
s1, s2 = s1.downcase, s2.downcase if case_match
|
42
44
|
distance = jaro_distance(s1, s2)
|
data/lib/jaro_winkler/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jaro_winkler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jian Weihang
|
@@ -14,28 +14,28 @@ dependencies:
|
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.7'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.7'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '10.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
41
|
description: Pure Ruby implementation of Jaro-Winkler distance algorithm.
|
@@ -45,8 +45,8 @@ executables: []
|
|
45
45
|
extensions: []
|
46
46
|
extra_rdoc_files: []
|
47
47
|
files:
|
48
|
-
-
|
49
|
-
-
|
48
|
+
- .gitignore
|
49
|
+
- .rspec
|
50
50
|
- Gemfile
|
51
51
|
- LICENSE.txt
|
52
52
|
- README.md
|
@@ -66,12 +66,12 @@ require_paths:
|
|
66
66
|
- lib
|
67
67
|
required_ruby_version: !ruby/object:Gem::Requirement
|
68
68
|
requirements:
|
69
|
-
- -
|
69
|
+
- - ! '>='
|
70
70
|
- !ruby/object:Gem::Version
|
71
71
|
version: '0'
|
72
72
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
|
-
- -
|
74
|
+
- - ! '>='
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: '0'
|
77
77
|
requirements: []
|