damerau-levenshtein 0.5.3 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -6,12 +6,13 @@ source "http://rubygems.org"
6
6
  # Add dependencies to develop your gem here.
7
7
  # Include everything needed to run rake, tests, features, etc.
8
8
  group :development do
9
+ gem "rake"
9
10
  gem "rake-compiler"
10
11
  gem "rspec", "~> 2.3.0"
11
12
  gem "cucumber", ">= 0"
12
13
  gem "bundler", "~> 1.0.0"
13
14
  gem "jeweler", "~> 1.6.0"
14
- gem "rcov", ">= 0"
15
+ gem "simplecov"
15
16
  gem "ruby-debug19"
16
17
  gem "ruby-prof"
17
18
  gem "shoulda"
data/Gemfile.lock CHANGED
@@ -3,29 +3,31 @@ GEM
3
3
  specs:
4
4
  archive-tar-minitar (0.5.2)
5
5
  builder (3.0.0)
6
- columnize (0.3.3)
7
- cucumber (1.0.2)
6
+ columnize (0.3.6)
7
+ cucumber (1.1.4)
8
8
  builder (>= 2.1.2)
9
9
  diff-lcs (>= 1.1.2)
10
- gherkin (~> 2.4.5)
10
+ gherkin (~> 2.7.1)
11
11
  json (>= 1.4.6)
12
- term-ansicolor (>= 1.0.5)
13
- diff-lcs (1.1.2)
14
- gherkin (2.4.5)
12
+ term-ansicolor (>= 1.0.6)
13
+ diff-lcs (1.1.3)
14
+ gherkin (2.7.7)
15
15
  json (>= 1.4.6)
16
16
  git (1.2.5)
17
17
  jeweler (1.6.4)
18
18
  bundler (~> 1.0)
19
19
  git (>= 1.2.5)
20
20
  rake
21
- json (1.5.3)
21
+ json (1.6.5)
22
22
  linecache19 (0.5.12)
23
23
  ruby_core_source (>= 0.1.4)
24
- mocha (0.9.12)
25
- rake (0.9.2)
26
- rake-compiler (0.7.9)
24
+ metaclass (0.0.1)
25
+ mocha (0.10.4)
26
+ metaclass (~> 0.0.1)
27
+ multi_json (1.0.4)
28
+ rake (0.9.2.2)
29
+ rake-compiler (0.8.0)
27
30
  rake
28
- rcov (0.9.9)
29
31
  rspec (2.3.0)
30
32
  rspec-core (~> 2.3.0)
31
33
  rspec-expectations (~> 2.3.0)
@@ -42,11 +44,15 @@ GEM
42
44
  columnize (>= 0.3.1)
43
45
  linecache19 (>= 0.5.11)
44
46
  ruby-debug-base19 (>= 0.11.19)
45
- ruby-prof (0.10.7)
47
+ ruby-prof (0.10.8)
46
48
  ruby_core_source (0.1.5)
47
49
  archive-tar-minitar (>= 0.5.2)
48
50
  shoulda (2.11.3)
49
- term-ansicolor (1.0.6)
51
+ simplecov (0.5.4)
52
+ multi_json (~> 1.0.3)
53
+ simplecov-html (~> 0.5.3)
54
+ simplecov-html (0.5.3)
55
+ term-ansicolor (1.0.7)
50
56
 
51
57
  PLATFORMS
52
58
  ruby
@@ -56,9 +62,10 @@ DEPENDENCIES
56
62
  cucumber
57
63
  jeweler (~> 1.6.0)
58
64
  mocha
65
+ rake
59
66
  rake-compiler
60
- rcov
61
67
  rspec (~> 2.3.0)
62
68
  ruby-debug19
63
69
  ruby-prof
64
70
  shoulda
71
+ simplecov
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2011 Dmitry Mozzherin
1
+ Copyright (c) 2011-2012 Marine Biological Laboratory
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/Rakefile CHANGED
@@ -9,6 +9,7 @@ rescue Bundler::BundlerError => e
9
9
  $stderr.puts "Run `bundle install` to install missing gems"
10
10
  exit e.status_code
11
11
  end
12
+ require 'rake/dsl_definition'
12
13
  require 'rake'
13
14
  require 'rake/extensiontask'
14
15
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.3
1
+ 0.5.4
@@ -32,7 +32,6 @@ VALUE method_distance_utf(VALUE self, VALUE _s, VALUE _t, VALUE _block_size, VAL
32
32
 
33
33
  sl = (int) RARRAY_LEN(_s);
34
34
  tl = (int) RARRAY_LEN(_t);
35
-
36
35
  if (sl == 0) return INT2NUM(tl);
37
36
  if (tl == 0) return INT2NUM(sl);
38
37
  //case of lengths 1 must present or it will break further in the code
@@ -67,8 +66,8 @@ VALUE method_distance_utf(VALUE self, VALUE _s, VALUE _t, VALUE _block_size, VAL
67
66
  half_sl = (sl - 1)/2;
68
67
  half_tl = (tl - 1)/2;
69
68
 
70
- block = block_size < half_sl ? block_size : half_sl;
71
- block = block < half_tl ? block : half_tl;
69
+ block = block_size < half_sl || half_sl == 0 ? block_size : half_sl;
70
+ block = block < half_tl || half_tl == 0 ? block : half_tl;
72
71
 
73
72
  while (block >= 1){
74
73
  int swap1 = 1;
@@ -28,8 +28,14 @@ Pomatomus|pomatomus|10|1|1
28
28
  Pomatomus||10|1|9
29
29
  |Pomatomus|10|1|9
30
30
  P|p|10|1|1
31
- #TODO: one letter vs longer string generates a big negative number
32
- #L|Linneaus|10|1|7
31
+ ab|a|10|0|1
32
+ a|ab|10|0|1
33
+ ab|a|10|1|1
34
+ -b|-|10|0|1
35
+ -b|-|10|1|1
36
+ ab|-|10|0|2
37
+ a|ab|10|1|1
38
+ L|Linneaus|10|1|7
33
39
 
34
40
 
35
41
  #it should calculate Damerau Levenshtein distance with 1 character transpositions, insertions, deletions, substitutions (block size 1)
metadata CHANGED
@@ -1,144 +1,153 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: damerau-levenshtein
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.4
4
5
  prerelease:
5
- version: 0.5.3
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Dmitry Mozzherin
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2011-07-23 00:00:00 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
12
+ date: 2012-02-13 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rake
16
+ requirement: &70145779820660 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: *70145779820660
25
+ - !ruby/object:Gem::Dependency
16
26
  name: rake-compiler
17
- requirement: &id001 !ruby/object:Gem::Requirement
27
+ requirement: &70145779820100 !ruby/object:Gem::Requirement
18
28
  none: false
19
- requirements:
20
- - - ">="
21
- - !ruby/object:Gem::Version
22
- version: "0"
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
23
33
  type: :development
24
34
  prerelease: false
25
- version_requirements: *id001
26
- - !ruby/object:Gem::Dependency
35
+ version_requirements: *70145779820100
36
+ - !ruby/object:Gem::Dependency
27
37
  name: rspec
28
- requirement: &id002 !ruby/object:Gem::Requirement
38
+ requirement: &70145779819600 !ruby/object:Gem::Requirement
29
39
  none: false
30
- requirements:
40
+ requirements:
31
41
  - - ~>
32
- - !ruby/object:Gem::Version
42
+ - !ruby/object:Gem::Version
33
43
  version: 2.3.0
34
44
  type: :development
35
45
  prerelease: false
36
- version_requirements: *id002
37
- - !ruby/object:Gem::Dependency
46
+ version_requirements: *70145779819600
47
+ - !ruby/object:Gem::Dependency
38
48
  name: cucumber
39
- requirement: &id003 !ruby/object:Gem::Requirement
49
+ requirement: &70145779819100 !ruby/object:Gem::Requirement
40
50
  none: false
41
- requirements:
42
- - - ">="
43
- - !ruby/object:Gem::Version
44
- version: "0"
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
45
55
  type: :development
46
56
  prerelease: false
47
- version_requirements: *id003
48
- - !ruby/object:Gem::Dependency
57
+ version_requirements: *70145779819100
58
+ - !ruby/object:Gem::Dependency
49
59
  name: bundler
50
- requirement: &id004 !ruby/object:Gem::Requirement
60
+ requirement: &70145779818600 !ruby/object:Gem::Requirement
51
61
  none: false
52
- requirements:
62
+ requirements:
53
63
  - - ~>
54
- - !ruby/object:Gem::Version
64
+ - !ruby/object:Gem::Version
55
65
  version: 1.0.0
56
66
  type: :development
57
67
  prerelease: false
58
- version_requirements: *id004
59
- - !ruby/object:Gem::Dependency
68
+ version_requirements: *70145779818600
69
+ - !ruby/object:Gem::Dependency
60
70
  name: jeweler
61
- requirement: &id005 !ruby/object:Gem::Requirement
71
+ requirement: &70145779818100 !ruby/object:Gem::Requirement
62
72
  none: false
63
- requirements:
73
+ requirements:
64
74
  - - ~>
65
- - !ruby/object:Gem::Version
75
+ - !ruby/object:Gem::Version
66
76
  version: 1.6.0
67
77
  type: :development
68
78
  prerelease: false
69
- version_requirements: *id005
70
- - !ruby/object:Gem::Dependency
71
- name: rcov
72
- requirement: &id006 !ruby/object:Gem::Requirement
79
+ version_requirements: *70145779818100
80
+ - !ruby/object:Gem::Dependency
81
+ name: simplecov
82
+ requirement: &70145779817600 !ruby/object:Gem::Requirement
73
83
  none: false
74
- requirements:
75
- - - ">="
76
- - !ruby/object:Gem::Version
77
- version: "0"
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
78
88
  type: :development
79
89
  prerelease: false
80
- version_requirements: *id006
81
- - !ruby/object:Gem::Dependency
90
+ version_requirements: *70145779817600
91
+ - !ruby/object:Gem::Dependency
82
92
  name: ruby-debug19
83
- requirement: &id007 !ruby/object:Gem::Requirement
93
+ requirement: &70145779817100 !ruby/object:Gem::Requirement
84
94
  none: false
85
- requirements:
86
- - - ">="
87
- - !ruby/object:Gem::Version
88
- version: "0"
95
+ requirements:
96
+ - - ! '>='
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
89
99
  type: :development
90
100
  prerelease: false
91
- version_requirements: *id007
92
- - !ruby/object:Gem::Dependency
101
+ version_requirements: *70145779817100
102
+ - !ruby/object:Gem::Dependency
93
103
  name: ruby-prof
94
- requirement: &id008 !ruby/object:Gem::Requirement
104
+ requirement: &70145779816600 !ruby/object:Gem::Requirement
95
105
  none: false
96
- requirements:
97
- - - ">="
98
- - !ruby/object:Gem::Version
99
- version: "0"
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
100
110
  type: :development
101
111
  prerelease: false
102
- version_requirements: *id008
103
- - !ruby/object:Gem::Dependency
112
+ version_requirements: *70145779816600
113
+ - !ruby/object:Gem::Dependency
104
114
  name: shoulda
105
- requirement: &id009 !ruby/object:Gem::Requirement
115
+ requirement: &70145779816100 !ruby/object:Gem::Requirement
106
116
  none: false
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: "0"
117
+ requirements:
118
+ - - ! '>='
119
+ - !ruby/object:Gem::Version
120
+ version: '0'
111
121
  type: :development
112
122
  prerelease: false
113
- version_requirements: *id009
114
- - !ruby/object:Gem::Dependency
123
+ version_requirements: *70145779816100
124
+ - !ruby/object:Gem::Dependency
115
125
  name: mocha
116
- requirement: &id010 !ruby/object:Gem::Requirement
126
+ requirement: &70145779815620 !ruby/object:Gem::Requirement
117
127
  none: false
118
- requirements:
119
- - - ">="
120
- - !ruby/object:Gem::Version
121
- version: "0"
128
+ requirements:
129
+ - - ! '>='
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
122
132
  type: :development
123
133
  prerelease: false
124
- version_requirements: *id010
125
- description: Calculation of editing distance for 2 strings using Levenshtein or Damerau-Levenshtein algorithms
134
+ version_requirements: *70145779815620
135
+ description: Calculation of editing distance for 2 strings using Levenshtein or Damerau-Levenshtein
136
+ algorithms
126
137
  email: dmozzherin@gmail.com
127
138
  executables: []
128
-
129
- extensions:
139
+ extensions:
130
140
  - ext/damerau_levenshtein_binding/extconf.rb
131
- extra_rdoc_files:
141
+ extra_rdoc_files:
132
142
  - LICENSE.txt
133
143
  - README.rdoc
134
- files:
144
+ files:
135
145
  - Gemfile
136
146
  - Gemfile.lock
137
147
  - LICENSE.txt
138
148
  - README.rdoc
139
149
  - Rakefile
140
150
  - VERSION
141
- - damerau-levenshtein.gemspec
142
151
  - ext/damerau_levenshtein_binding/damerau_levenshtein_binding.c
143
152
  - lib/damerau-levenshtein.rb
144
153
  - spec/damerau-levenshtein_spec.rb
@@ -146,34 +155,32 @@ files:
146
155
  - spec/spec_helper.rb
147
156
  - ext/damerau_levenshtein_binding/extconf.rb
148
157
  homepage: http://github.com/dimus/damerau-levenshtein
149
- licenses:
158
+ licenses:
150
159
  - MIT
151
160
  post_install_message:
152
161
  rdoc_options: []
153
-
154
- require_paths:
162
+ require_paths:
155
163
  - lib
156
- required_ruby_version: !ruby/object:Gem::Requirement
164
+ required_ruby_version: !ruby/object:Gem::Requirement
157
165
  none: false
158
- requirements:
159
- - - ">="
160
- - !ruby/object:Gem::Version
161
- hash: -3535294163359070239
162
- segments:
166
+ requirements:
167
+ - - ! '>='
168
+ - !ruby/object:Gem::Version
169
+ version: '0'
170
+ segments:
163
171
  - 0
164
- version: "0"
165
- required_rubygems_version: !ruby/object:Gem::Requirement
172
+ hash: -435084811815183405
173
+ required_rubygems_version: !ruby/object:Gem::Requirement
166
174
  none: false
167
- requirements:
168
- - - ">="
169
- - !ruby/object:Gem::Version
170
- version: "0"
175
+ requirements:
176
+ - - ! '>='
177
+ - !ruby/object:Gem::Version
178
+ version: '0'
171
179
  requirements: []
172
-
173
180
  rubyforge_project:
174
- rubygems_version: 1.8.5
181
+ rubygems_version: 1.8.10
175
182
  signing_key:
176
183
  specification_version: 3
177
- summary: Calculation of editing distance for 2 strings using Levenshtein or Damerau-Levenshtein algorithms
184
+ summary: Calculation of editing distance for 2 strings using Levenshtein or Damerau-Levenshtein
185
+ algorithms
178
186
  test_files: []
179
-
@@ -1,79 +0,0 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
- # -*- encoding: utf-8 -*-
5
-
6
- Gem::Specification.new do |s|
7
- s.name = %q{damerau-levenshtein}
8
- s.version = "0.5.3"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = [%q{Dmitry Mozzherin}]
12
- s.date = %q{2011-07-23}
13
- s.description = %q{Calculation of editing distance for 2 strings using Levenshtein or Damerau-Levenshtein algorithms}
14
- s.email = %q{dmozzherin@gmail.com}
15
- s.extensions = [%q{ext/damerau_levenshtein_binding/extconf.rb}]
16
- s.extra_rdoc_files = [
17
- "LICENSE.txt",
18
- "README.rdoc"
19
- ]
20
- s.files = [
21
- "Gemfile",
22
- "Gemfile.lock",
23
- "LICENSE.txt",
24
- "README.rdoc",
25
- "Rakefile",
26
- "VERSION",
27
- "damerau-levenshtein.gemspec",
28
- "ext/damerau_levenshtein_binding/damerau_levenshtein_binding.c",
29
- "lib/damerau-levenshtein.rb",
30
- "spec/damerau-levenshtein_spec.rb",
31
- "spec/damerau_levenshtein_test.txt",
32
- "spec/spec_helper.rb"
33
- ]
34
- s.homepage = %q{http://github.com/dimus/damerau-levenshtein}
35
- s.licenses = [%q{MIT}]
36
- s.require_paths = [%q{lib}]
37
- s.rubygems_version = %q{1.8.5}
38
- s.summary = %q{Calculation of editing distance for 2 strings using Levenshtein or Damerau-Levenshtein algorithms}
39
-
40
- if s.respond_to? :specification_version then
41
- s.specification_version = 3
42
-
43
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
44
- s.add_development_dependency(%q<rake-compiler>, [">= 0"])
45
- s.add_development_dependency(%q<rspec>, ["~> 2.3.0"])
46
- s.add_development_dependency(%q<cucumber>, [">= 0"])
47
- s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
48
- s.add_development_dependency(%q<jeweler>, ["~> 1.6.0"])
49
- s.add_development_dependency(%q<rcov>, [">= 0"])
50
- s.add_development_dependency(%q<ruby-debug19>, [">= 0"])
51
- s.add_development_dependency(%q<ruby-prof>, [">= 0"])
52
- s.add_development_dependency(%q<shoulda>, [">= 0"])
53
- s.add_development_dependency(%q<mocha>, [">= 0"])
54
- else
55
- s.add_dependency(%q<rake-compiler>, [">= 0"])
56
- s.add_dependency(%q<rspec>, ["~> 2.3.0"])
57
- s.add_dependency(%q<cucumber>, [">= 0"])
58
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
59
- s.add_dependency(%q<jeweler>, ["~> 1.6.0"])
60
- s.add_dependency(%q<rcov>, [">= 0"])
61
- s.add_dependency(%q<ruby-debug19>, [">= 0"])
62
- s.add_dependency(%q<ruby-prof>, [">= 0"])
63
- s.add_dependency(%q<shoulda>, [">= 0"])
64
- s.add_dependency(%q<mocha>, [">= 0"])
65
- end
66
- else
67
- s.add_dependency(%q<rake-compiler>, [">= 0"])
68
- s.add_dependency(%q<rspec>, ["~> 2.3.0"])
69
- s.add_dependency(%q<cucumber>, [">= 0"])
70
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
71
- s.add_dependency(%q<jeweler>, ["~> 1.6.0"])
72
- s.add_dependency(%q<rcov>, [">= 0"])
73
- s.add_dependency(%q<ruby-debug19>, [">= 0"])
74
- s.add_dependency(%q<ruby-prof>, [">= 0"])
75
- s.add_dependency(%q<shoulda>, [">= 0"])
76
- s.add_dependency(%q<mocha>, [">= 0"])
77
- end
78
- end
79
-