damerau-levenshtein 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +21 -0
- data/.rspec +1 -0
- data/.rvmrc +2 -0
- data/.travis.yml +11 -0
- data/CHANGELOG +4 -0
- data/Gemfile +6 -8
- data/Gemfile.lock +25 -48
- data/LICENSE.txt +3 -1
- data/README.md +3 -2
- data/Rakefile +8 -28
- data/damerau-levenshtein.gemspec +19 -61
- data/ext/{damerau_levenshtein_binding/damerau_levenshtein_binding.c → damerau_levenshtein/damerau_levenshtein.c} +9 -10
- data/ext/damerau_levenshtein/extconf.rb +8 -0
- data/features/damerau-levenshtein.feature +39 -0
- data/features/step_definitions/damerau-levenshtein_steps.rb +15 -0
- data/features/support/env.rb +13 -0
- data/lib/damerau-levenshtein.rb +3 -2
- data/lib/damerau-levenshtein/version.rb +3 -0
- data/spec/damerau-levenshtein_spec.rb +1 -1
- metadata +23 -94
- data/VERSION +0 -1
- data/ext/damerau_levenshtein_binding/extconf.rb +0 -11
data/.document
ADDED
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/.rvmrc
ADDED
data/.travis.yml
ADDED
data/CHANGELOG
CHANGED
data/Gemfile
CHANGED
@@ -1,19 +1,17 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
gem 'bundler', '~> 1.
|
4
|
-
gem 'jeweler', '~> 1.8'
|
2
|
+
|
3
|
+
gem 'bundler', '~> 1.3'
|
5
4
|
gem 'rake', '~> 10.0'
|
6
5
|
gem 'rake-compiler', '~> 0.8'
|
7
6
|
|
8
7
|
group :development do
|
9
|
-
gem 'debugger',
|
8
|
+
gem 'debugger', '~> 1.5'
|
10
9
|
end
|
11
10
|
|
12
11
|
group :test do
|
13
12
|
gem 'rspec', '~> 2.13'
|
14
|
-
gem 'cucumber', '~> 1.
|
15
|
-
gem 'simplecov', '~> 0.7'
|
13
|
+
gem 'cucumber', '~> 1.3'
|
16
14
|
gem 'ruby-prof', '~> 0.13'
|
17
|
-
gem 'shoulda', '~> 3.
|
18
|
-
gem 'mocha', '~> 0.10'
|
15
|
+
gem 'shoulda', '~> 3.5'
|
19
16
|
end
|
17
|
+
|
data/Gemfile.lock
CHANGED
@@ -1,45 +1,30 @@
|
|
1
1
|
GEM
|
2
2
|
remote: https://rubygems.org/
|
3
3
|
specs:
|
4
|
-
activesupport (3.2.
|
5
|
-
i18n (
|
4
|
+
activesupport (3.2.13)
|
5
|
+
i18n (= 0.6.1)
|
6
6
|
multi_json (~> 1.0)
|
7
|
-
bourne (1.1.2)
|
8
|
-
mocha (= 0.10.5)
|
9
7
|
builder (3.2.0)
|
10
8
|
columnize (0.3.6)
|
11
|
-
cucumber (1.
|
9
|
+
cucumber (1.3.1)
|
12
10
|
builder (>= 2.1.2)
|
13
11
|
diff-lcs (>= 1.1.3)
|
14
|
-
gherkin (~> 2.
|
12
|
+
gherkin (~> 2.12.0)
|
15
13
|
multi_json (~> 1.3)
|
16
|
-
debugger (1.
|
14
|
+
debugger (1.6.0)
|
17
15
|
columnize (>= 0.3.1)
|
18
|
-
debugger-linecache (~> 1.
|
19
|
-
debugger-ruby_core_source (~> 1.2.
|
20
|
-
debugger-linecache (1.
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
jeweler (1.8.4)
|
29
|
-
bundler (~> 1.0)
|
30
|
-
git (>= 1.2.5)
|
31
|
-
rake
|
32
|
-
rdoc
|
33
|
-
json (1.7.7)
|
34
|
-
metaclass (0.0.1)
|
35
|
-
mocha (0.10.5)
|
36
|
-
metaclass (~> 0.0.1)
|
37
|
-
multi_json (1.6.1)
|
38
|
-
rake (10.0.3)
|
16
|
+
debugger-linecache (~> 1.2.0)
|
17
|
+
debugger-ruby_core_source (~> 1.2.1)
|
18
|
+
debugger-linecache (1.2.0)
|
19
|
+
debugger-ruby_core_source (1.2.1)
|
20
|
+
diff-lcs (1.2.4)
|
21
|
+
gherkin (2.12.0)
|
22
|
+
multi_json (~> 1.3)
|
23
|
+
i18n (0.6.1)
|
24
|
+
multi_json (1.7.3)
|
25
|
+
rake (10.0.4)
|
39
26
|
rake-compiler (0.8.3)
|
40
27
|
rake
|
41
|
-
rdoc (4.0.0)
|
42
|
-
json (~> 1.4)
|
43
28
|
rspec (2.13.0)
|
44
29
|
rspec-core (~> 2.13.0)
|
45
30
|
rspec-expectations (~> 2.13.0)
|
@@ -47,32 +32,24 @@ GEM
|
|
47
32
|
rspec-core (2.13.1)
|
48
33
|
rspec-expectations (2.13.0)
|
49
34
|
diff-lcs (>= 1.1.3, < 2.0)
|
50
|
-
rspec-mocks (2.13.
|
35
|
+
rspec-mocks (2.13.1)
|
51
36
|
ruby-prof (0.13.0)
|
52
|
-
shoulda (3.
|
53
|
-
shoulda-context (~> 1.0.1)
|
54
|
-
shoulda-matchers (
|
55
|
-
shoulda-context (1.
|
56
|
-
shoulda-matchers (1.
|
37
|
+
shoulda (3.5.0)
|
38
|
+
shoulda-context (~> 1.0, >= 1.0.1)
|
39
|
+
shoulda-matchers (>= 1.4.1, < 3.0)
|
40
|
+
shoulda-context (1.1.1)
|
41
|
+
shoulda-matchers (2.1.0)
|
57
42
|
activesupport (>= 3.0.0)
|
58
|
-
bourne (~> 1.1.2)
|
59
|
-
simplecov (0.7.1)
|
60
|
-
multi_json (~> 1.0)
|
61
|
-
simplecov-html (~> 0.7.1)
|
62
|
-
simplecov-html (0.7.1)
|
63
43
|
|
64
44
|
PLATFORMS
|
65
45
|
ruby
|
66
46
|
|
67
47
|
DEPENDENCIES
|
68
|
-
bundler (~> 1.
|
69
|
-
cucumber (~> 1.
|
70
|
-
debugger (~> 1.
|
71
|
-
jeweler (~> 1.8)
|
72
|
-
mocha (~> 0.10)
|
48
|
+
bundler (~> 1.3)
|
49
|
+
cucumber (~> 1.3)
|
50
|
+
debugger (~> 1.5)
|
73
51
|
rake (~> 10.0)
|
74
52
|
rake-compiler (~> 0.8)
|
75
53
|
rspec (~> 2.13)
|
76
54
|
ruby-prof (~> 0.13)
|
77
|
-
shoulda (~> 3.
|
78
|
-
simplecov (~> 0.7)
|
55
|
+
shoulda (~> 3.5)
|
data/LICENSE.txt
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2011-2013 Marine Biological Laboratory
|
2
4
|
|
3
5
|
Permission is hereby granted, free of charge, to any person obtaining
|
4
6
|
a copy of this software and associated documentation files (the
|
data/README.md
CHANGED
@@ -94,8 +94,9 @@ Levenshtein algorithm is expensive, so it makes sense to give up when edit
|
|
94
94
|
distance is becoming too big. The argument max_distance does just that.
|
95
95
|
|
96
96
|
DamerauLevenshtein.distance('abcdefg', '1234567', 0, 3)
|
97
|
-
#
|
98
|
-
|
97
|
+
# output: 4 -- it gave up when edit distance exceeded 3
|
98
|
+
|
99
|
+
|
99
100
|
Contributing to damerau-levenshtein
|
100
101
|
-----------------------------------
|
101
102
|
|
data/Rakefile
CHANGED
@@ -2,6 +2,9 @@
|
|
2
2
|
|
3
3
|
require 'rubygems'
|
4
4
|
require 'bundler'
|
5
|
+
|
6
|
+
Bundler::GemHelper.install_tasks
|
7
|
+
|
5
8
|
begin
|
6
9
|
Bundler.setup(:default, :development)
|
7
10
|
rescue Bundler::BundlerError => e
|
@@ -9,46 +12,23 @@ rescue Bundler::BundlerError => e
|
|
9
12
|
$stderr.puts 'Run `bundle install` to install missing gems'
|
10
13
|
exit e.status_code
|
11
14
|
end
|
15
|
+
|
12
16
|
require 'rake/dsl_definition'
|
13
17
|
require 'rake'
|
14
18
|
require 'rake/extensiontask'
|
15
|
-
|
16
|
-
require 'jeweler'
|
17
|
-
Jeweler::Tasks.new do |gem|
|
18
|
-
# gem is a Gem::Specification...
|
19
|
-
# see http://docs.rubygems.org/read/chapter/20 for more options
|
20
|
-
gem.name = 'damerau-levenshtein'
|
21
|
-
gem.homepage = 'http://github.com/GlobalNamesArchitecture/damerau-levenshtein'
|
22
|
-
gem.license = 'MIT'
|
23
|
-
gem.summary = %Q{Calculation of editing distance for 2 strings \
|
24
|
-
using Levenshtein or Damerau-Levenshtein algorithms}
|
25
|
-
gem.description = %Q{Calculation of editing distance for 2 strings using \
|
26
|
-
Levenshtein or Damerau-Levenshtein algorithms}
|
27
|
-
gem.email = 'dmozzherin@gmail.com'
|
28
|
-
gem.authors = ['Dmitry Mozzherin']
|
29
|
-
gem.files = FileList['[A-Z]*', '*.gemspec', '{bin,generators,lib,spec}/**/*']
|
30
|
-
gem.files -= FileList['lib/**/*.bundle', 'lib/**/*.dll', 'lib/**/*.so']
|
31
|
-
gem.files += FileList['ext/**/*.c']
|
32
|
-
gem.extensions = FileList['ext/**/extconf.rb']
|
33
|
-
end
|
34
|
-
Jeweler::RubygemsDotOrgTasks.new
|
35
|
-
|
36
19
|
require 'rspec'
|
37
20
|
require 'rspec/core/rake_task'
|
21
|
+
|
38
22
|
RSpec::Core::RakeTask.new(:spec) do |spec|
|
39
23
|
spec.pattern = FileList['spec/**/*_spec.rb']
|
40
24
|
end
|
41
25
|
|
42
|
-
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
43
|
-
spec.pattern = 'spec/**/*_spec.rb'
|
44
|
-
spec.rcov = true
|
45
|
-
end
|
46
|
-
|
47
26
|
require 'cucumber/rake/task'
|
48
27
|
Cucumber::Rake::Task.new(:features)
|
49
28
|
|
50
|
-
Rake::ExtensionTask.new('
|
51
|
-
extension.
|
29
|
+
Rake::ExtensionTask.new('damerau_levenshtein') do |extension|
|
30
|
+
extension.ext_dir = 'ext/damerau_levenshtein'
|
31
|
+
extension.lib_dir = 'lib/damerau-levenshtein'
|
52
32
|
end
|
53
33
|
|
54
34
|
Rake::Task[:spec].prerequisites << :compile
|
data/damerau-levenshtein.gemspec
CHANGED
@@ -1,65 +1,23 @@
|
|
1
|
-
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
-
# -*- encoding: utf-8 -*-
|
1
|
+
$:.push File.expand_path("../lib", __FILE__)
|
5
2
|
|
3
|
+
require "damerau-levenshtein/version"
|
4
|
+
|
5
|
+
# Describe your gem and declare its dependencies:
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "damerau-levenshtein"
|
8
|
-
s.version =
|
9
|
-
|
10
|
-
s.
|
11
|
-
s.
|
12
|
-
|
13
|
-
s.description =
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
s.files =
|
21
|
-
|
22
|
-
|
23
|
-
"Gemfile.lock",
|
24
|
-
"LICENSE.txt",
|
25
|
-
"README.md",
|
26
|
-
"Rakefile",
|
27
|
-
"VERSION",
|
28
|
-
"damerau-levenshtein.gemspec",
|
29
|
-
"ext/damerau_levenshtein_binding/damerau_levenshtein_binding.c",
|
30
|
-
"lib/damerau-levenshtein.rb",
|
31
|
-
"spec/damerau-levenshtein_spec.rb",
|
32
|
-
"spec/damerau_levenshtein_test.txt",
|
33
|
-
"spec/spec_helper.rb"
|
34
|
-
]
|
35
|
-
s.homepage = "http://github.com/GlobalNamesArchitecture/damerau-levenshtein"
|
36
|
-
s.licenses = ["MIT"]
|
37
|
-
s.require_paths = ["lib"]
|
38
|
-
s.rubygems_version = "1.8.25"
|
39
|
-
s.summary = "Calculation of editing distance for 2 strings using Levenshtein or Damerau-Levenshtein algorithms"
|
40
|
-
|
41
|
-
if s.respond_to? :specification_version then
|
42
|
-
s.specification_version = 3
|
43
|
-
|
44
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
45
|
-
s.add_runtime_dependency(%q<bundler>, ["~> 1.0"])
|
46
|
-
s.add_runtime_dependency(%q<jeweler>, ["~> 1.8"])
|
47
|
-
s.add_runtime_dependency(%q<rake>, ["~> 10.0"])
|
48
|
-
s.add_runtime_dependency(%q<rake-compiler>, ["~> 0.8"])
|
49
|
-
s.add_development_dependency(%q<debugger>, ["~> 1.4"])
|
50
|
-
else
|
51
|
-
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
52
|
-
s.add_dependency(%q<jeweler>, ["~> 1.8"])
|
53
|
-
s.add_dependency(%q<rake>, ["~> 10.0"])
|
54
|
-
s.add_dependency(%q<rake-compiler>, ["~> 0.8"])
|
55
|
-
s.add_dependency(%q<debugger>, ["~> 1.4"])
|
56
|
-
end
|
57
|
-
else
|
58
|
-
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
59
|
-
s.add_dependency(%q<jeweler>, ["~> 1.8"])
|
60
|
-
s.add_dependency(%q<rake>, ["~> 10.0"])
|
61
|
-
s.add_dependency(%q<rake-compiler>, ["~> 0.8"])
|
62
|
-
s.add_dependency(%q<debugger>, ["~> 1.4"])
|
63
|
-
end
|
8
|
+
s.version = DamerauLevenshtein::VERSION
|
9
|
+
s.homepage = "https://github.com/GlobalNamesArchitecture/damerau-levenshtein"
|
10
|
+
s.license = 'MIT'
|
11
|
+
s.summary = %Q{Calculation of editing distance for 2 strings \
|
12
|
+
using Levenshtein or Damerau-Levenshtein algorithms}
|
13
|
+
s.description = %Q{This gem implements pure Levenshtein algorithm, \
|
14
|
+
Damerau modification of it (where 2 character transposition counts \
|
15
|
+
as 1 edit distance). It also includes Boehmer & Rees 2008 modification \
|
16
|
+
of Damerau algorithm, where transposition of bigger than 1 character \
|
17
|
+
blocks is taken in account as well (Boehmer & Rees 2008).}
|
18
|
+
s.authors = ['Dmitry Mozzherin']
|
19
|
+
s.email = 'dmozzherin@gmail.com'
|
20
|
+
s.files = `git ls-files`.split("\n")
|
21
|
+
s.extensions = ['ext/damerau_levenshtein/extconf.rb']
|
22
|
+
s.require_paths = ["lib", "lib/damerau-levenshtein"]
|
64
23
|
end
|
65
|
-
|
@@ -2,43 +2,42 @@
|
|
2
2
|
|
3
3
|
VALUE DamerauLevenshteinBinding = Qnil;
|
4
4
|
|
5
|
-
void
|
5
|
+
void Init_damerau_levenshtein();
|
6
6
|
|
7
7
|
VALUE method_distance_utf(VALUE self, VALUE _s, VALUE _t, VALUE _block_size, VALUE _max_distance);
|
8
8
|
|
9
|
-
void
|
9
|
+
void Init_damerau_levenshtein() {
|
10
10
|
DamerauLevenshteinBinding = rb_define_module("DamerauLevenshteinBinding");
|
11
11
|
rb_define_method(DamerauLevenshteinBinding, "distance_utf", method_distance_utf, 4);
|
12
12
|
}
|
13
13
|
|
14
14
|
VALUE method_distance_utf(VALUE self, VALUE _s, VALUE _t, VALUE _block_size, VALUE _max_distance){
|
15
|
+
VALUE *sv = RARRAY_PTR(_s);
|
16
|
+
VALUE *tv = RARRAY_PTR(_t);
|
15
17
|
int i, i1, j, j1, k, half_tl, cost, *d, distance, del, ins, subs, transp, block;
|
16
|
-
int
|
18
|
+
int half_sl;
|
17
19
|
int stop_execution = 0;
|
18
20
|
int min = 0;
|
19
21
|
int current_distance = 0;
|
20
22
|
int pure_levenshtein = 0;
|
21
|
-
|
22
23
|
int block_size = NUM2INT(_block_size);
|
23
24
|
int max_distance = NUM2INT(_max_distance);
|
25
|
+
int sl = (int) RARRAY_LEN(_s);
|
26
|
+
int tl = (int) RARRAY_LEN(_t);
|
27
|
+
int s[sl];
|
28
|
+
int t[tl];
|
24
29
|
|
25
30
|
if (block_size == 0) {
|
26
31
|
pure_levenshtein = 1;
|
27
32
|
block_size = 1;
|
28
33
|
}
|
29
34
|
|
30
|
-
VALUE *sv = RARRAY_PTR(_s);
|
31
|
-
VALUE *tv = RARRAY_PTR(_t);
|
32
35
|
|
33
|
-
sl = (int) RARRAY_LEN(_s);
|
34
|
-
tl = (int) RARRAY_LEN(_t);
|
35
36
|
if (sl == 0) return INT2NUM(tl);
|
36
37
|
if (tl == 0) return INT2NUM(sl);
|
37
38
|
//case of lengths 1 must present or it will break further in the code
|
38
39
|
if (sl == 1 && tl == 1 && sv[0] != tv[0]) return INT2NUM(1);
|
39
40
|
|
40
|
-
int s[sl];
|
41
|
-
int t[tl];
|
42
41
|
|
43
42
|
for (i=0; i < sl; i++) s[i] = NUM2INT(sv[i]);
|
44
43
|
for (i=0; i < tl; i++) t[i] = NUM2INT(tv[i]);
|
@@ -0,0 +1,39 @@
|
|
1
|
+
Feature: something something
|
2
|
+
In order to something something
|
3
|
+
A user something something
|
4
|
+
something something something
|
5
|
+
|
6
|
+
Scenario: find edit distance between two unicode (utf8) strings
|
7
|
+
Given strings "Sjostedt" and "Sojstedt", block size "0", and a maximum allowed distance "4"
|
8
|
+
When I run "DamerauLevenshtein" method "distance"
|
9
|
+
Then I should receive edit distance "2"
|
10
|
+
|
11
|
+
Scenario: find edit distance between two unicode (utf8) strings
|
12
|
+
Given strings "Sjostedt" and "Sojstedt", block size "1", and a maximum allowed distance "4"
|
13
|
+
When I run "DamerauLevenshtein" method "distance"
|
14
|
+
Then I should receive edit distance "1"
|
15
|
+
|
16
|
+
Scenario: find edit distance between two unicode (utf8) strings
|
17
|
+
Given strings "Choriozopella trägårdhi" and "Choriozopella tragardhi", block size "1", and a maximum allowed distance "4"
|
18
|
+
When I run "DamerauLevenshtein" method "distance"
|
19
|
+
Then I should receive edit distance "2"
|
20
|
+
|
21
|
+
Scenario: find edit distance between two strings with non-alphanumeric characters
|
22
|
+
Given strings "abcd" and "ab-cd", block size "1", and a maximum allowed distance "4"
|
23
|
+
When I run "DamerauLevenshtein" method "distance"
|
24
|
+
Then I should receive edit distance "1"
|
25
|
+
|
26
|
+
Scenario: find edit distance between one-character and multicharacter strings
|
27
|
+
Given strings "a" and "ab", block size "0", and a maximum allowed distance "4"
|
28
|
+
When I run "DamerauLevenshtein" method "distance"
|
29
|
+
Then I should receive edit distance "1"
|
30
|
+
|
31
|
+
Scenario: find edit distance between one-character and multicharacter strings
|
32
|
+
Given strings "a" and "ab", block size "1", and a maximum allowed distance "4"
|
33
|
+
When I run "DamerauLevenshtein" method "distance"
|
34
|
+
Then I should receive edit distance "1"
|
35
|
+
|
36
|
+
Scenario: limit distance to maximum distance + 1
|
37
|
+
Given strings "abcdefg#$%123" and "higklmnop(*&ç123", block size "0", and a maximum allowed distance "4"
|
38
|
+
When I run "DamerauLevenshtein" method "distance"
|
39
|
+
Then I should receive edit distance "5"
|
@@ -0,0 +1,15 @@
|
|
1
|
+
Given /^strings "([^\"]*)" and "([^\"]*)", block size "([^\"]*)", and a maximum allowed distance "([^\"]*)"$/ do |str1, str2, block_size, max_distance|
|
2
|
+
@str1 = str1
|
3
|
+
@str2 = str2
|
4
|
+
@block_size = block_size.to_i
|
5
|
+
@max_distance = max_distance.to_i
|
6
|
+
end
|
7
|
+
|
8
|
+
When /^I run "([^\"]*)" method "([^\"]*)"$/ do |klass, meth|
|
9
|
+
dl = eval(klass)
|
10
|
+
@distance = dl.distance(@str1, @str2, @block_size, @max_distance)
|
11
|
+
end
|
12
|
+
|
13
|
+
Then /^I should receive edit distance "([^\"]*)"$/ do |edit_distance|
|
14
|
+
@distance.should == edit_distance.to_i
|
15
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
begin
|
3
|
+
Bundler.setup(:default, :development)
|
4
|
+
rescue Bundler::BundlerError => e
|
5
|
+
$stderr.puts e.message
|
6
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
7
|
+
exit e.status_code
|
8
|
+
end
|
9
|
+
|
10
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
|
11
|
+
require 'damerau-levenshtein'
|
12
|
+
|
13
|
+
require 'rspec/expectations'
|
data/lib/damerau-levenshtein.rb
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'damerau-levenshtein/version'
|
4
|
+
require 'damerau-levenshtein/damerau_levenshtein'
|
4
5
|
|
5
6
|
module DamerauLevenshtein
|
6
7
|
extend DamerauLevenshteinBinding
|
7
8
|
|
8
9
|
def self.version
|
9
|
-
|
10
|
+
VERSION
|
10
11
|
end
|
11
12
|
|
12
13
|
def self.distance(str1, str2, block_size = 1, max_distance = 10)
|
@@ -3,7 +3,7 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
3
3
|
describe DamerauLevenshtein do
|
4
4
|
|
5
5
|
it 'should return version' do
|
6
|
-
DamerauLevenshtein.
|
6
|
+
DamerauLevenshtein::VERSION.should =~ /^\d+\.\d+\.\d+$/
|
7
7
|
end
|
8
8
|
|
9
9
|
it 'should get tests' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: damerau-levenshtein
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,119 +9,48 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
13
|
-
dependencies:
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
requirements:
|
19
|
-
- - ~>
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: '1.0'
|
22
|
-
type: :runtime
|
23
|
-
prerelease: false
|
24
|
-
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ~>
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '1.0'
|
30
|
-
- !ruby/object:Gem::Dependency
|
31
|
-
name: jeweler
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
|
-
requirements:
|
35
|
-
- - ~>
|
36
|
-
- !ruby/object:Gem::Version
|
37
|
-
version: '1.8'
|
38
|
-
type: :runtime
|
39
|
-
prerelease: false
|
40
|
-
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
|
-
requirements:
|
43
|
-
- - ~>
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: '1.8'
|
46
|
-
- !ruby/object:Gem::Dependency
|
47
|
-
name: rake
|
48
|
-
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
|
-
requirements:
|
51
|
-
- - ~>
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: '10.0'
|
54
|
-
type: :runtime
|
55
|
-
prerelease: false
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
|
-
requirements:
|
59
|
-
- - ~>
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '10.0'
|
62
|
-
- !ruby/object:Gem::Dependency
|
63
|
-
name: rake-compiler
|
64
|
-
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
|
-
requirements:
|
67
|
-
- - ~>
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: '0.8'
|
70
|
-
type: :runtime
|
71
|
-
prerelease: false
|
72
|
-
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
|
-
requirements:
|
75
|
-
- - ~>
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
version: '0.8'
|
78
|
-
- !ruby/object:Gem::Dependency
|
79
|
-
name: debugger
|
80
|
-
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
|
-
requirements:
|
83
|
-
- - ~>
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
version: '1.4'
|
86
|
-
type: :development
|
87
|
-
prerelease: false
|
88
|
-
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
|
-
requirements:
|
91
|
-
- - ~>
|
92
|
-
- !ruby/object:Gem::Version
|
93
|
-
version: '1.4'
|
94
|
-
description: Calculation of editing distance for 2 strings using Levenshtein or
|
95
|
-
Damerau-Levenshtein algorithms
|
12
|
+
date: 2013-05-15 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: This gem implements pure Levenshtein algorithm, Damerau modification
|
15
|
+
of it (where 2 character transposition counts as 1 edit distance). It also includes
|
16
|
+
Boehmer & Rees 2008 modification of Damerau algorithm, where transposition of
|
17
|
+
bigger than 1 character blocks is taken in account as well (Boehmer & Rees 2008).
|
96
18
|
email: dmozzherin@gmail.com
|
97
19
|
executables: []
|
98
20
|
extensions:
|
99
|
-
- ext/
|
100
|
-
extra_rdoc_files:
|
101
|
-
- LICENSE.txt
|
102
|
-
- README.md
|
21
|
+
- ext/damerau_levenshtein/extconf.rb
|
22
|
+
extra_rdoc_files: []
|
103
23
|
files:
|
24
|
+
- .document
|
25
|
+
- .gitignore
|
26
|
+
- .rspec
|
27
|
+
- .rvmrc
|
28
|
+
- .travis.yml
|
104
29
|
- CHANGELOG
|
105
30
|
- Gemfile
|
106
31
|
- Gemfile.lock
|
107
32
|
- LICENSE.txt
|
108
33
|
- README.md
|
109
34
|
- Rakefile
|
110
|
-
- VERSION
|
111
35
|
- damerau-levenshtein.gemspec
|
112
|
-
- ext/
|
36
|
+
- ext/damerau_levenshtein/damerau_levenshtein.c
|
37
|
+
- ext/damerau_levenshtein/extconf.rb
|
38
|
+
- features/damerau-levenshtein.feature
|
39
|
+
- features/step_definitions/damerau-levenshtein_steps.rb
|
40
|
+
- features/support/env.rb
|
113
41
|
- lib/damerau-levenshtein.rb
|
42
|
+
- lib/damerau-levenshtein/version.rb
|
114
43
|
- spec/damerau-levenshtein_spec.rb
|
115
44
|
- spec/damerau_levenshtein_test.txt
|
116
45
|
- spec/spec_helper.rb
|
117
|
-
|
118
|
-
homepage: http://github.com/GlobalNamesArchitecture/damerau-levenshtein
|
46
|
+
homepage: https://github.com/GlobalNamesArchitecture/damerau-levenshtein
|
119
47
|
licenses:
|
120
48
|
- MIT
|
121
49
|
post_install_message:
|
122
50
|
rdoc_options: []
|
123
51
|
require_paths:
|
124
52
|
- lib
|
53
|
+
- lib/damerau-levenshtein
|
125
54
|
required_ruby_version: !ruby/object:Gem::Requirement
|
126
55
|
none: false
|
127
56
|
requirements:
|
@@ -130,7 +59,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
130
59
|
version: '0'
|
131
60
|
segments:
|
132
61
|
- 0
|
133
|
-
hash:
|
62
|
+
hash: 4170554596565128103
|
134
63
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
135
64
|
none: false
|
136
65
|
requirements:
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
1.0.1
|