slide_rule 0.0.2 → 0.0.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: c64f03bd0a58531ff1ba600c493168d36baeca24
4
- data.tar.gz: aacb2941fa539b5051d904b269047b3d33c96b75
3
+ metadata.gz: 2b3179055340569d383b2cc674b77271a8196ccd
4
+ data.tar.gz: 2bb292fb77379d76447ecd1aa623845cbeb7de64
5
5
  SHA512:
6
- metadata.gz: f266a284b49d88cd63f3958f778e8b2288d7d06fb520f22fdaf24aa84c0d75ee2b102595f9333dc9b5e9aa695fddc50b3e56256ca58b61cb5c030eea4a422841
7
- data.tar.gz: 9cd3e4e6689bd4c316b65b5edb91d89c5767597347a66f3b4c53f13fc08ff794fb3f21f13bb36fcf0c1f4581d885b2c131d7f45055bf286832623565d0f04d3a
6
+ metadata.gz: 5adc84a61af1e49a0e7e673b6b88115d389f3fc20e91e9fc568e10c8f6869bf8634ee80d7757f8e5d7eb484d530f4ef58154d6fb24712a6282c697cc86bef341
7
+ data.tar.gz: 53e0320c267447b19e756763415dc74756dc7958756bdc639e92d8848b90da848638cad6cf03f25070be0202b7bbd5a17dc650ec951bb40a000443f3f7be7073
data/.travis.yml CHANGED
@@ -1,4 +1,5 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.2.0
3
+ - jruby-1.7.20.1
4
+ - jruby-9.0.1.0
4
5
  before_install: gem install bundler -v 1.10.6
@@ -2,14 +2,13 @@ module SlideRule
2
2
  module DistanceCalculators
3
3
  class Levenshtein
4
4
  def calculate(first, second)
5
- distance = ::Levenshtein.distance(first, second).to_f
5
+ ::Vladlev.get_normalized_distance(first, second).to_f
6
6
 
7
7
  # Lower bound is difference in length
8
8
  # distance = matrix.last.last.to_f - (first.length - second.length).abs
9
9
 
10
10
  # Upper bound is length of longest string
11
11
  # This will decrease distance more for longer strings.
12
- distance / ([first.length, second.length].max)
13
12
  end
14
13
  end
15
14
  end
@@ -1,3 +1,3 @@
1
1
  module SlideRule
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
data/lib/slide_rule.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'levenshtein'
1
+ require 'vladlev'
2
2
 
3
3
  require_relative './slide_rule/version.rb'
4
4
  require_relative './slide_rule/distance_calculator.rb'
data/slide_rule.gemspec CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
18
18
  ##
19
19
  # Dependencies
20
20
  #
21
- s.add_runtime_dependency 'levenshtein', '~> 0.2'
21
+ s.add_runtime_dependency 'vladlev', '~> 1.0'
22
22
 
23
23
  ##
24
24
  # Development Dependencies
@@ -94,7 +94,7 @@ describe ::SlideRule::DistanceCalculator do
94
94
  # -----------------------------------------
95
95
  # = 0.2318181818181818
96
96
  distance = calculator.calculate_distance(example, candidate)
97
- expect(distance).to eq((3.0 * 0.5 / 15) + (4.0 * 0.5 / 11))
97
+ expect(distance.round(4)).to eq(((3.0 * 0.5 / 15) + (4.0 * 0.5 / 11)).round(4))
98
98
  end
99
99
  end
100
100
 
@@ -6,6 +6,6 @@ describe ::SlideRule::DistanceCalculators::Levenshtein do
6
6
  end
7
7
 
8
8
  it 'should calculate distance as distance divided by length of longest string' do
9
- expect(described_class.new.calculate('this is a test', 'this is a test!')).to eq(1.0 / 15)
9
+ expect(described_class.new.calculate('this is a test', 'this is a test!').round(4)).to eq((1.0 / 15).round(4))
10
10
  end
11
11
  end
metadata CHANGED
@@ -1,97 +1,96 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slide_rule
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - mattnichols
8
8
  - fergmastaflex
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-11-03 00:00:00.000000000 Z
12
+ date: 2015-11-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: levenshtein
16
15
  requirement: !ruby/object:Gem::Requirement
17
16
  requirements:
18
- - - "~>"
17
+ - - ~>
19
18
  - !ruby/object:Gem::Version
20
- version: '0.2'
21
- type: :runtime
19
+ version: '1.0'
20
+ name: vladlev
22
21
  prerelease: false
22
+ type: :runtime
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - "~>"
25
+ - - ~>
26
26
  - !ruby/object:Gem::Version
27
- version: '0.2'
27
+ version: '1.0'
28
28
  - !ruby/object:Gem::Dependency
29
- name: rake
30
29
  requirement: !ruby/object:Gem::Requirement
31
30
  requirements:
32
- - - "~>"
31
+ - - ~>
33
32
  - !ruby/object:Gem::Version
34
33
  version: '10'
35
- type: :development
34
+ name: rake
36
35
  prerelease: false
36
+ type: :development
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - "~>"
39
+ - - ~>
40
40
  - !ruby/object:Gem::Version
41
41
  version: '10'
42
42
  - !ruby/object:Gem::Dependency
43
- name: pry
44
43
  requirement: !ruby/object:Gem::Requirement
45
44
  requirements:
46
- - - "~>"
45
+ - - ~>
47
46
  - !ruby/object:Gem::Version
48
47
  version: '0'
49
- type: :development
48
+ name: pry
50
49
  prerelease: false
50
+ type: :development
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - "~>"
53
+ - - ~>
54
54
  - !ruby/object:Gem::Version
55
55
  version: '0'
56
56
  - !ruby/object:Gem::Dependency
57
- name: rspec
58
57
  requirement: !ruby/object:Gem::Requirement
59
58
  requirements:
60
- - - "~>"
59
+ - - ~>
61
60
  - !ruby/object:Gem::Version
62
61
  version: '3'
63
- type: :development
62
+ name: rspec
64
63
  prerelease: false
64
+ type: :development
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - "~>"
67
+ - - ~>
68
68
  - !ruby/object:Gem::Version
69
69
  version: '3'
70
70
  - !ruby/object:Gem::Dependency
71
- name: rubocop
72
71
  requirement: !ruby/object:Gem::Requirement
73
72
  requirements:
74
- - - "~>"
73
+ - - ~>
75
74
  - !ruby/object:Gem::Version
76
75
  version: '0'
77
- type: :development
76
+ name: rubocop
78
77
  prerelease: false
78
+ type: :development
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - "~>"
81
+ - - ~>
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0'
84
- description: Calculates the distance between 2 arbitrary objects using specified fields
85
- and algorithms.
84
+ description: Calculates the distance between 2 arbitrary objects using specified fields and algorithms.
86
85
  email:
87
86
  - dev@mx.com
88
87
  executables: []
89
88
  extensions: []
90
89
  extra_rdoc_files: []
91
90
  files:
92
- - ".gitignore"
93
- - ".rubocop.yml"
94
- - ".travis.yml"
91
+ - .gitignore
92
+ - .rubocop.yml
93
+ - .travis.yml
95
94
  - CODE_OF_CONDUCT.md
96
95
  - Gemfile
97
96
  - LICENSE
@@ -113,24 +112,24 @@ homepage: https://github.com/mattnichols/slide_rule
113
112
  licenses:
114
113
  - MIT
115
114
  metadata: {}
116
- post_install_message:
115
+ post_install_message:
117
116
  rdoc_options: []
118
117
  require_paths:
119
118
  - lib
120
119
  required_ruby_version: !ruby/object:Gem::Requirement
121
120
  requirements:
122
- - - ">="
121
+ - - '>='
123
122
  - !ruby/object:Gem::Version
124
123
  version: '0'
125
124
  required_rubygems_version: !ruby/object:Gem::Requirement
126
125
  requirements:
127
- - - ">="
126
+ - - '>='
128
127
  - !ruby/object:Gem::Version
129
128
  version: '0'
130
129
  requirements: []
131
- rubyforge_project:
132
- rubygems_version: 2.4.6
133
- signing_key:
130
+ rubyforge_project:
131
+ rubygems_version: 2.4.5
132
+ signing_key:
134
133
  specification_version: 4
135
134
  summary: Ruby object distance calculator
136
135
  test_files: