emiler 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/lib/emiler.rb +3 -3
- data/lib/emiler/jarowinkler.rb +6 -5
- data/lib/emiler/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9087d21f342c6fbf527446f3b9d12a7704d24fc3
|
4
|
+
data.tar.gz: 620b32bfe7e591eb14330ceb04e6c34a83258d5b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6214d1f660358148d59dce104fb9b223d3896f89905fb45cdb4c1c72d2478c8ffba7f5d762c28efc030330a7db1837683b965355551a22a148c8101a98a6c7c
|
7
|
+
data.tar.gz: c48623402f161cabe1afb70d80ea515a31315f2c16700b61e9e4b797f329958eea4430254e29c1f4105a406c3009d6f71fd220697de74f9e4447a5d46bb10d64
|
data/.rubocop.yml
CHANGED
data/lib/emiler.rb
CHANGED
@@ -12,7 +12,7 @@ module Emiler
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def distance s1, s2
|
15
|
-
@jw.
|
15
|
+
@jw.get_distance s1, s2
|
16
16
|
end
|
17
17
|
|
18
18
|
MATCHER = JW.new
|
@@ -51,9 +51,9 @@ module Emiler
|
|
51
51
|
else INEXACT_MATCH_COEFFICIENT / 2.0 * JW::MATCHER.distance(em1.first, em2.first)
|
52
52
|
end
|
53
53
|
|
54
|
-
full = domain * 0
|
54
|
+
full = domain * (1.0 - INEXACT_MATCH_COEFFICIENT) + name * INEXACT_MATCH_COEFFICIENT
|
55
55
|
|
56
|
-
{ jw: jw, full: full, name: name, domain: domain, result: full >=
|
56
|
+
{ jw: jw, full: full, name: name, domain: domain, result: full >= INEXACT_MATCH_COEFFICIENT * INEXACT_MATCH_COEFFICIENT }
|
57
57
|
end
|
58
58
|
# rubocop:enable Metrics/AbcSize
|
59
59
|
|
data/lib/emiler/jarowinkler.rb
CHANGED
@@ -23,7 +23,9 @@ module FuzzyStringMatch
|
|
23
23
|
true
|
24
24
|
end
|
25
25
|
|
26
|
-
|
26
|
+
# rubocop:disable Metrics/AbcSize
|
27
|
+
# rubocop:disable Metrics/MethodLength
|
28
|
+
def get_distance(s1, s2)
|
27
29
|
a1 = s1.split(//)
|
28
30
|
a2 = s2.split(//)
|
29
31
|
|
@@ -36,10 +38,7 @@ module FuzzyStringMatch
|
|
36
38
|
matches = 0
|
37
39
|
(0...min.size).each do |mi|
|
38
40
|
c1 = min[mi]
|
39
|
-
|
40
|
-
xn = [mi + range + 1, max.size].min
|
41
|
-
|
42
|
-
(xi...xn).each do |i|
|
41
|
+
([mi - range, 0].max...[mi + range + 1, max.size].min).each do |i|
|
43
42
|
next unless !flags[i] && c1 == max[i]
|
44
43
|
|
45
44
|
indexes[mi] = i
|
@@ -88,5 +87,7 @@ module FuzzyStringMatch
|
|
88
87
|
return j < THRESHOLD ? j : j + [0.1, 1.0 / max.size].min * prefix * (1 - j)
|
89
88
|
end
|
90
89
|
end
|
90
|
+
# rubocop:enable Metrics/MethodLength
|
91
|
+
# rubocop:enable Metrics/AbcSize
|
91
92
|
end
|
92
93
|
end
|
data/lib/emiler/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: emiler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aleksei Matiushkin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|