bmatch 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +7 -0
- data/Rakefile +1 -0
- data/bmatch.gemspec +4 -2
- data/ext/Makefile +8 -1
- data/ext/extconf.rb +2 -18
- data/lib/bmatch/version.rb +1 -1
- metadata +32 -4
- data/spec/bmatch/similarities_spec.rb +0 -34
- data/spec/spec_helper.rb +0 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f819a1d0254eb5bca96dfc412b2c2af03d16e040
|
4
|
+
data.tar.gz: d01110a00145c9e7da61a9be015bf3a43ac847c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 08673b462411eb3e191c477a8d34bc674ae622ca2a2336b35664c1fc04c7b20fa21024e1be2a94ea4c94c6b2ea08c1b2b173a22cfafd17f7a9d1802c2591ad3c
|
7
|
+
data.tar.gz: eba6661dcd3a90e7360c8304d416c228615ee77e691d97cb615968946cc3dc30cf8f6fa898bacbd720558c3228357843d446ac2ce50f97db4493c53cdee22e01
|
data/.travis.yml
ADDED
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bmatch.gemspec
CHANGED
@@ -15,10 +15,12 @@ Gem::Specification.new do |s|
|
|
15
15
|
s.platform = Gem::Platform::RUBY
|
16
16
|
s.extensions = ['ext/extconf.rb']
|
17
17
|
|
18
|
-
s.files
|
19
|
-
s.
|
18
|
+
s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
19
|
+
s.require_paths = ["lib"]
|
20
20
|
|
21
21
|
s.add_dependency 'ffi', '~> 1.9'
|
22
22
|
s.add_development_dependency 'pry', '~> 0.10'
|
23
23
|
s.add_development_dependency 'rspec', '~> 3.3'
|
24
|
+
s.add_development_dependency 'bundler'
|
25
|
+
s.add_development_dependency 'rake'
|
24
26
|
end
|
data/ext/Makefile
CHANGED
data/ext/extconf.rb
CHANGED
@@ -3,21 +3,5 @@ require 'mkmf'
|
|
3
3
|
# Stops the installation process if one of these commands is not found in
|
4
4
|
# $PATH.
|
5
5
|
find_executable('go')
|
6
|
-
|
7
|
-
|
8
|
-
# installation process. On Linux this would result in the file "bmatch.so"
|
9
|
-
# being created in the current working directory.
|
10
|
-
#
|
11
|
-
# Normally the generated Makefile would take care of this but since we
|
12
|
-
# don't generate one we'll have to do this manually.
|
13
|
-
#
|
14
|
-
File.open(File.join(Dir.pwd, 'bmatch.' + RbConfig::CONFIG['DLEXT']), "w") {}
|
15
|
-
|
16
|
-
Dir.chdir(File.dirname(__FILE__)) do
|
17
|
-
`go build -buildmode=c-shared -o similarities.so similarities.go`
|
18
|
-
end
|
19
|
-
|
20
|
-
# This is normally set by calling create_makefile() but we don't need that
|
21
|
-
# method since we'll provide a dummy Makefile. Without setting this value
|
22
|
-
# RubyGems will abort the installation.
|
23
|
-
$makefile_created = true
|
6
|
+
puts "running make"
|
7
|
+
`make build`
|
data/lib/bmatch/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bmatch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Udo Groebner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
@@ -52,6 +52,34 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.3'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
55
83
|
description: Provides string similarity functions like levenshtein distance or dice's
|
56
84
|
coefficient as native extensions.
|
57
85
|
email: udo.groebner@crealytics.com
|
@@ -62,9 +90,11 @@ extra_rdoc_files: []
|
|
62
90
|
files:
|
63
91
|
- ".gitignore"
|
64
92
|
- ".rspec"
|
93
|
+
- ".travis.yml"
|
65
94
|
- Gemfile
|
66
95
|
- LICENSE
|
67
96
|
- README.md
|
97
|
+
- Rakefile
|
68
98
|
- bmatch.gemspec
|
69
99
|
- ext/Makefile
|
70
100
|
- ext/build.sh
|
@@ -72,8 +102,6 @@ files:
|
|
72
102
|
- ext/similarities.go
|
73
103
|
- lib/bmatch/similarities.rb
|
74
104
|
- lib/bmatch/version.rb
|
75
|
-
- spec/bmatch/similarities_spec.rb
|
76
|
-
- spec/spec_helper.rb
|
77
105
|
homepage: https://github.com/udl/bmatch
|
78
106
|
licenses:
|
79
107
|
- MIT
|
@@ -1,34 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require 'bmatch/similarities'
|
3
|
-
RSpec.describe Similarities do
|
4
|
-
|
5
|
-
context "#dice_similarity" do
|
6
|
-
it "has a similarity of 1 for the same string" do
|
7
|
-
expect(Similarities.dice_similarity("aa", "aa")).to be 1.0
|
8
|
-
end
|
9
|
-
|
10
|
-
it "has a similarity of 1/4 for 'night' and 'nacht'" do
|
11
|
-
expect(Similarities.dice_similarity("night", "nacht")).to be 0.25
|
12
|
-
end
|
13
|
-
|
14
|
-
it "also works for utf-8" do
|
15
|
-
expect(Similarities.dice_similarity("münchen", "munich")).to be 0.1818181872367859
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
context "#levenshtein_distance" do
|
20
|
-
it "has a distance of 0 for the same string" do
|
21
|
-
expect(Similarities.levenshtein_distance("aa", "aa")).to be 0
|
22
|
-
end
|
23
|
-
|
24
|
-
it "has a distance of 1 for a one-off string" do
|
25
|
-
expect(Similarities.levenshtein_distance("aa", "ab")).to be 1
|
26
|
-
end
|
27
|
-
|
28
|
-
it "also works for utf-8" do
|
29
|
-
expect(Similarities.levenshtein_distance("aa", "aü")).to be 1
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
data/spec/spec_helper.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
$:.unshift File.join(File.dirname(__FILE__), "..", "lib")
|
2
|
-
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
3
|
-
RSpec.configure do |config|
|
4
|
-
config.expect_with :rspec do |expectations|
|
5
|
-
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
6
|
-
end
|
7
|
-
|
8
|
-
config.mock_with :rspec do |mocks|
|
9
|
-
mocks.verify_partial_doubles = true
|
10
|
-
end
|
11
|
-
|
12
|
-
config.filter_run :focus
|
13
|
-
config.run_all_when_everything_filtered = true
|
14
|
-
|
15
|
-
config.example_status_persistence_file_path = "spec/examples.txt"
|
16
|
-
|
17
|
-
config.disable_monkey_patching!
|
18
|
-
|
19
|
-
config.warnings = true
|
20
|
-
|
21
|
-
if config.files_to_run.one?
|
22
|
-
config.default_formatter = 'doc'
|
23
|
-
end
|
24
|
-
|
25
|
-
config.profile_examples = 10
|
26
|
-
|
27
|
-
config.order = :random
|
28
|
-
|
29
|
-
Kernel.srand config.seed
|
30
|
-
end
|