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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0361dccbd493b95c973033250393401c2888c094
4
- data.tar.gz: a03b7c228c9e3c8da609a5d44b20a1ab9c4450d6
3
+ metadata.gz: 9087d21f342c6fbf527446f3b9d12a7704d24fc3
4
+ data.tar.gz: 620b32bfe7e591eb14330ceb04e6c34a83258d5b
5
5
  SHA512:
6
- metadata.gz: 68cc06b5d23967e4ca4921640d5c856a087a258fc977cd27e4b268d58c512e2b509ca4693b18044258079e44e8ab799a5f7a791a4f2aee6eb2d3a5afd3c2f613
7
- data.tar.gz: 45567581427124b3718141db0bd043989ddc393cc3a4edae6b0b132380c6e487ce217c421e46bba62cfb349194d0ad309504ceab79fa01c66ef972762704831c
6
+ metadata.gz: e6214d1f660358148d59dce104fb9b223d3896f89905fb45cdb4c1c72d2478c8ffba7f5d762c28efc030330a7db1837683b965355551a22a148c8101a98a6c7c
7
+ data.tar.gz: c48623402f161cabe1afb70d80ea515a31315f2c16700b61e9e4b797f329958eea4430254e29c1f4105a406c3009d6f71fd220697de74f9e4447a5d46bb10d64
@@ -3,6 +3,9 @@ inherit_from: .rubocop_todo.yml
3
3
  Style/HashSyntax:
4
4
  EnforcedStyle: ruby19
5
5
 
6
+ Style/EmptyCaseCondition:
7
+ Enabled: false
8
+
6
9
  Style/MethodDefParentheses:
7
10
  Exclude:
8
11
  - 'lib/**/*'
@@ -12,7 +12,7 @@ module Emiler
12
12
  end
13
13
 
14
14
  def distance s1, s2
15
- @jw.getDistance s1, s2
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.2 + name * 0.8
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 >= 0.64 }
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
 
@@ -23,7 +23,9 @@ module FuzzyStringMatch
23
23
  true
24
24
  end
25
25
 
26
- def getDistance(s1, s2)
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
- xi = [mi - range, 0].max
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
@@ -1,3 +1,3 @@
1
1
  module Emiler
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
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.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-05-23 00:00:00.000000000 Z
11
+ date: 2016-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler