amatch 0.4.1 → 0.6.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1689f380896534ca221c7a45280dbb585a34f60c1b44768da7aa51009cdfef3f
4
- data.tar.gz: b79c18622db8a63d6663bb23b32bba2e6d1f3878a245eae1389a4322580c6237
3
+ metadata.gz: 4fc4761462d177bcebf7212934afe5658a103b8dd6b32083d32ab1ee98a93459
4
+ data.tar.gz: 9d73b4f9e4ab4033f3d9f72dd7c3b0bf37fdefff78008675a15abbd7f4960e77
5
5
  SHA512:
6
- metadata.gz: 3f006e0912e06325dd59cae3c4479a4c10569ed22c27f06c687aa255fcd4d035b9a7fa14f8a0ab90d5627a97e9f2a6bd1b82b8f9836bda3673fe6a1954fe5f31
7
- data.tar.gz: 61d56bd7d7a4f08fe9aa00b1233c7335899c6c06280afa4faa57bb8f9b9ad55b3c51398e5207b3b919e321ff8c07215bf7c06ed11cade5d51bfcc15a9d544daa
6
+ metadata.gz: a808291e86d7660209c4a4c34639c2c1f024a25e28b84ce09d1415b775ea7989c2dc489a69684506f737c7b3603eec4f260ec60aae8a967ccd56e8f0ad573922
7
+ data.tar.gz: 91e485ecdd534ab4678fedba873db8bb6f2612fc3f0a9fc002ca849e1e9c6bd42f0e57a6a76ddf674c3e0d34e56187f022f52b78f53719596cdaf9aa7531502e
data/.utilsrc ADDED
@@ -0,0 +1,24 @@
1
+ # vim: set ft=ruby:
2
+
3
+ search do
4
+ prune_dirs /\A(\.svn|\.git|CVS|tmp|tags|coverage|pkg|doc|\.yardoc)\z/
5
+ skip_files /(\A\.|\.sw[pon]\z|\.(log|fnm|jpg|jpeg|png|pdf|svg)\z|tags|~\z)/i
6
+ end
7
+
8
+ discover do
9
+ prune_dirs /\A(\.svn|\.git|CVS|tmp|tags|coverage|pkg|doc|\.yardoc)\z/
10
+ skip_files /(\A\.|\.sw[pon]\z|\.log\z|~\z)/
11
+ end
12
+
13
+ strip_spaces do
14
+ prune_dirs /\A(\..*|CVS|pkg|doc|\.yardoc)\z/
15
+ skip_files /(\A\.|\.sw[pon]\z|\.log\z|~\z)/
16
+ end
17
+
18
+ probe do
19
+ test_framework :'test-unit'
20
+ end
21
+
22
+ ssh_tunnel do
23
+ terminal_multiplexer :tmux
24
+ end
data/CHANGES.md ADDED
@@ -0,0 +1,135 @@
1
+ # Changes
2
+
3
+ ## 2025-12-19 v0.6.0
4
+
5
+ - Moved the `debug` gem from regular dependencies to development dependencies
6
+ in `Rakefile` and updated `amatch.gemspec` accordingly
7
+ - Added `openssl-dev` dependency and included `ruby:4.0-rc-alpine` image
8
+ configuration in `.all_images.yml`
9
+ - Changed `bundle update` command to `bundle update --all` for improved
10
+ dependency management
11
+
12
+ ## 2025-09-11 v0.5.0
13
+
14
+ - Added `yaml-dev` dependency and installed `bundler` and `gem_hadar` gems in `.all_images.yml`
15
+ - Modified script section in `.all_images.yml` to use `bundle update` with parallel installation
16
+ - Changed `fail_fast` setting in `.all_images.yml` from `yes` to `true`
17
+ - Added `ext/amatch_ext*` to `.gitignore` and updated `Rakefile` to ignore these files during packaging
18
+ - Added `coverage` to `.gitignore` and `Rakefile` ignore lists
19
+ - Updated `tins` dependency from `~>1.0` to `~>1`
20
+ - Added `debug` gem as a regular dependency
21
+ - Added `simplecov` as a development dependency
22
+ - Created `.utilsrc` configuration file for `utilrb` gem with specified settings
23
+ - Replaced individual test requires with `require 'test_helper'` in all test files
24
+ - Created `tests/test_helper.rb` to centralize test setup including SimpleCov and debug loading
25
+ - The `gem_hadar/simplecov` gem is used for code coverage reporting
26
+
27
+ ## 2025-07-10 v0.4.2
28
+
29
+ * Single-character identical strings now return a similarity score of `1.0`.
30
+ * Updated C extension to handle this edge case.
31
+ * Added tests for Jaro and Jaro-Winkler algorithms.
32
+ * Thx to Jared Nielson for the fix.
33
+
34
+ ## 2022-05-15 v0.4.1
35
+
36
+ * **Moved CI testing from Travis to All Images**
37
+ + Updated configuration to use `all_images` instead of Travis for continuous integration testing.
38
+
39
+ ## 2017-07-04 v0.4.0
40
+
41
+ * Officially support DamerauLevenshtein matching algorithm.
42
+ * Change license to Apache 2.0
43
+
44
+ ## 2017-05-23 v0.3.1
45
+
46
+ * Include PairDistance fix from dominikgrygiel, Thx.
47
+
48
+ ## 2014-03-27 v0.3.0
49
+
50
+ * Update some dependencies
51
+
52
+ ## 2013-10-14 v0.2.12
53
+
54
+ * Include test fix from Juanito Fatas <katehuang0320@gmail.com>. Thx!
55
+
56
+ ## 2013-01-16 v0.2.11
57
+
58
+ * Include some fixes from Jason Colburne <jason@redbeardenterprises.com>.
59
+ Thx!
60
+
61
+ ## 2012-02-06 v0.2.10
62
+
63
+ * Use xfree instead of free to avoid (possible) problems.
64
+
65
+ ## 2011-11-15 v0.2.9
66
+
67
+ * Provide amatch/rude and amatch/polite for require (the latter doesn't
68
+ extend ::String on its own)
69
+ * `pair_distance_similar` method now can take an optional regexp argument for
70
+ tokenizing.
71
+
72
+ ## 2011-08-06 v0.2.8
73
+
74
+ * Depend on tins library.
75
+
76
+ ## 2011-08-06 v0.2.7
77
+
78
+ * Fix some violations of ISO C90 standard.
79
+
80
+ ## 2011-07-16 v0.2.6
81
+
82
+ * Applied patch by Kevin J. Lynagh <kevin@keminglabs.com> fixing memory
83
+ leak in Jaro match.
84
+
85
+ ## 2009-09-25 v0.2.5
86
+
87
+ * Added lib to gem's require_paths.
88
+ * Using rake-compiler now.
89
+
90
+ ## 2009-08-25 v0.2.4
91
+
92
+ * Included Jaro and Jaro-Winkler metrics implementation of Kevin Ballard
93
+ <kevin@rapleaf.com>. Thanks a lot.
94
+ * Made the extension compile under Ruby 1.9.
95
+
96
+ ## 2006-06-25 v0.2.3
97
+
98
+ * Fixed agrep.rb to use the new API.
99
+
100
+ ## 2005-10-11 v0.2.2
101
+ * Fixed a typo in extconf.rb that prohibitted compiling on
102
+ non-gcc compilers.
103
+
104
+ ## 2005-09-12 v0.2.1
105
+
106
+ * Bugfix: Wrong type for pattern length corrected. Thanks to David
107
+ Heinemeier Hansson for reporting it.
108
+
109
+ ## 2005-06-01 v0.2.0
110
+
111
+ * Major changes in API and implementation:
112
+ Now the Levenshtein edit distance, Sellers edit distance, the Hamming
113
+ distance, the longest common subsequence length, the longest common
114
+ substring length, and the pair distance metric can be computed.
115
+
116
+ ## 2005-01-20 v0.1.4
117
+
118
+ * Better argument handling in initialization method
119
+ * Minor changes in Rakefile and README.en
120
+
121
+ ## 2004-09-27 v0.1.3
122
+
123
+ * Rakefile and gem support added.
124
+
125
+ ## 2004-09-24 v0.1.2
126
+
127
+ * Uses Test::Unit for regression tests now.
128
+
129
+ ## 2002-04-21 v0.1.1
130
+
131
+ * Minor changes: documentation, more test cases and exceptions.
132
+
133
+ ## 2009-08-26 v0.1.0
134
+
135
+ * Initial Version
data/Rakefile CHANGED
@@ -8,23 +8,29 @@ GemHadar do
8
8
  email 'flori@ping.de'
9
9
  homepage "http://github.com/flori/#{name}"
10
10
  summary 'Approximate String Matching library'
11
- description <<EOT
12
- Amatch is a library for approximate string matching and searching in strings.
13
- Several algorithms can be used to do this, and it's also possible to compute a
14
- similarity metric number between 0.0 and 1.0 for two given strings.
15
- EOT
11
+ description <<~EOT
12
+ Amatch is a library for approximate string matching and searching in strings.
13
+ Several algorithms can be used to do this, and it's also possible to compute a
14
+ similarity metric number between 0.0 and 1.0 for two given strings.
15
+ EOT
16
16
  executables << 'agrep' << 'dupfind'
17
17
  bindir 'bin'
18
18
  test_dir 'tests'
19
- ignore '.*.sw[pon]', 'pkg', 'Gemfile.lock', '.AppleDouble', '.rbx', 'Makefile'
19
+ ignore '.*.sw[pon]', 'pkg', 'Gemfile.lock', '.AppleDouble', '.rbx',
20
+ 'Makefile', '*.bundle', '*.o', '*.so', 'coverage', 'ext/amatch_ext*'
20
21
  package_ignore '.all_images.yml', '.gitignore', 'VERSION'
21
22
  title "#{name.camelize} - Approximate Matching"
22
23
  readme 'README.md'
23
24
  require_paths %w[lib ext]
24
- dependency 'tins', '~>1.0'
25
+
26
+ required_ruby_version '>=2.4'
27
+
28
+ dependency 'tins', '~>1'
25
29
  dependency 'mize'
30
+ development_dependency 'debug'
26
31
  development_dependency 'test-unit', '~>3.0'
27
32
  development_dependency 'all_images'
28
- required_ruby_version '>=2.4'
33
+ development_dependency 'simplecov'
34
+
29
35
  licenses << 'Apache-2.0'
30
36
  end
data/amatch.gemspec CHANGED
Binary file
data/ext/amatch_ext.c CHANGED
@@ -790,7 +790,11 @@ static VALUE LongestSubstring_similar(General *amatch, VALUE string)
790
790
  } \
791
791
  } \
792
792
  if (m == 0) { \
793
- result = 0.0; \
793
+ if(a_len == b_len && a_len == 1 && a_ptr[0] == b_ptr[0]) { \
794
+ result = 1.0; \
795
+ } else { \
796
+ result = 0.0; \
797
+ } \
794
798
  } else { \
795
799
  k = t = 0; \
796
800
  for (i = 0; i < a_len; i++) { \
@@ -1,6 +1,6 @@
1
1
  module Amatch
2
2
  # Amatch version
3
- VERSION = '0.4.1'
3
+ VERSION = '0.6.0'
4
4
  VERSION_ARRAY = VERSION.split('.').map(&:to_i) # :nodoc:
5
5
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
6
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
@@ -1,5 +1,4 @@
1
- require 'test/unit'
2
- require 'amatch'
1
+ require 'test_helper'
3
2
 
4
3
  class TestDamerauLevenshtein < Test::Unit::TestCase
5
4
  include Amatch
@@ -1,5 +1,4 @@
1
- require 'test/unit'
2
- require 'amatch'
1
+ require 'test_helper'
3
2
 
4
3
  class TestHamming < Test::Unit::TestCase
5
4
  include Amatch
@@ -0,0 +1,8 @@
1
+ require 'gem_hadar/simplecov'
2
+ GemHadar::SimpleCov.start
3
+ begin
4
+ require 'debug'
5
+ rescue LoadError
6
+ end
7
+ require 'test/unit'
8
+ require 'amatch'
data/tests/test_jaro.rb CHANGED
@@ -1,5 +1,4 @@
1
- require 'test/unit'
2
- require 'amatch'
1
+ require 'test_helper'
3
2
 
4
3
  class TestJaro < Test::Unit::TestCase
5
4
  include Amatch
@@ -11,6 +10,7 @@ class TestJaro < Test::Unit::TestCase
11
10
  @dwayne = Jaro.new('dwayne')
12
11
  @dixon = Jaro.new('DIXON')
13
12
  @one = Jaro.new('one')
13
+ @single = Jaro.new('a')
14
14
  end
15
15
 
16
16
  def test_case
@@ -25,5 +25,6 @@ class TestJaro < Test::Unit::TestCase
25
25
  assert_in_delta 0.822, @dwayne.match('DUANE'), D
26
26
  assert_in_delta 0.767, @dixon.match('DICKSONX'), D
27
27
  assert_in_delta 0.667, @one.match('orange'), D
28
+ assert_in_delta 1.0, @single.match('a')
28
29
  end
29
30
  end
@@ -1,5 +1,5 @@
1
1
  require 'test/unit'
2
- require 'amatch'
2
+ require 'test_helper'
3
3
 
4
4
  class TestJaroWinkler < Test::Unit::TestCase
5
5
  include Amatch
@@ -11,6 +11,7 @@ class TestJaroWinkler < Test::Unit::TestCase
11
11
  @dwayne = JaroWinkler.new('dwayne')
12
12
  @dixon = JaroWinkler.new('DIXON')
13
13
  @one = JaroWinkler.new("one")
14
+ @single = JaroWinkler.new("a")
14
15
  end
15
16
 
16
17
  def test_case
@@ -26,6 +27,7 @@ class TestJaroWinkler < Test::Unit::TestCase
26
27
  assert_in_delta 0.813, @dixon.match('DICKSONX'), D
27
28
  assert_in_delta 0, @one.match('two'), D
28
29
  assert_in_delta 0.700, @one.match('orange'), D
30
+ assert_in_delta 1.0, @single.match("a")
29
31
  end
30
32
 
31
33
  def test_scaling_factor
@@ -1,5 +1,4 @@
1
- require 'test/unit'
2
- require 'amatch'
1
+ require 'test_helper'
3
2
 
4
3
  class TestLevenshtein < Test::Unit::TestCase
5
4
  include Amatch
@@ -1,5 +1,4 @@
1
- require 'test/unit'
2
- require 'amatch'
1
+ require 'test_helper'
3
2
 
4
3
  class TestLongestSubsequence < Test::Unit::TestCase
5
4
  include Amatch
@@ -1,5 +1,4 @@
1
- require 'test/unit'
2
- require 'amatch'
1
+ require 'test_helper'
3
2
 
4
3
  class TestLongestSubstring < Test::Unit::TestCase
5
4
  include Amatch
@@ -1,5 +1,4 @@
1
- require 'test/unit'
2
- require 'amatch'
1
+ require 'test_helper'
3
2
 
4
3
  class TestPairDistance < Test::Unit::TestCase
5
4
  include Amatch
@@ -1,5 +1,4 @@
1
- require 'test/unit'
2
- require 'amatch'
1
+ require 'test_helper'
3
2
 
4
3
  class TestSellers < Test::Unit::TestCase
5
4
  include Amatch
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: amatch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2022-05-15 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: gem_hadar
@@ -16,14 +15,28 @@ dependencies:
16
15
  requirements:
17
16
  - - "~>"
18
17
  - !ruby/object:Gem::Version
19
- version: 1.12.0
18
+ version: '2.10'
20
19
  type: :development
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
23
  - - "~>"
25
24
  - !ruby/object:Gem::Version
26
- version: 1.12.0
25
+ version: '2.10'
26
+ - !ruby/object:Gem::Dependency
27
+ name: debug
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
27
40
  - !ruby/object:Gem::Dependency
28
41
  name: test-unit
29
42
  requirement: !ruby/object:Gem::Requirement
@@ -52,20 +65,34 @@ dependencies:
52
65
  - - ">="
53
66
  - !ruby/object:Gem::Version
54
67
  version: '0'
68
+ - !ruby/object:Gem::Dependency
69
+ name: simplecov
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ type: :development
76
+ prerelease: false
77
+ version_requirements: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
55
82
  - !ruby/object:Gem::Dependency
56
83
  name: tins
57
84
  requirement: !ruby/object:Gem::Requirement
58
85
  requirements:
59
86
  - - "~>"
60
87
  - !ruby/object:Gem::Version
61
- version: '1.0'
88
+ version: '1'
62
89
  type: :runtime
63
90
  prerelease: false
64
91
  version_requirements: !ruby/object:Gem::Requirement
65
92
  requirements:
66
93
  - - "~>"
67
94
  - !ruby/object:Gem::Version
68
- version: '1.0'
95
+ version: '1'
69
96
  - !ruby/object:Gem::Dependency
70
97
  name: mize
71
98
  requirement: !ruby/object:Gem::Requirement
@@ -92,14 +119,15 @@ extensions:
92
119
  - ext/extconf.rb
93
120
  extra_rdoc_files:
94
121
  - README.md
122
+ - ext/amatch_ext.c
123
+ - ext/pair.c
95
124
  - lib/amatch.rb
96
125
  - lib/amatch/polite.rb
97
126
  - lib/amatch/rude.rb
98
127
  - lib/amatch/version.rb
99
- - ext/amatch_ext.c
100
- - ext/pair.c
101
128
  files:
102
- - CHANGES
129
+ - ".utilsrc"
130
+ - CHANGES.md
103
131
  - COPYING
104
132
  - Gemfile
105
133
  - README.md
@@ -121,6 +149,7 @@ files:
121
149
  - lib/amatch/version.rb
122
150
  - tests/test_damerau_levenshtein.rb
123
151
  - tests/test_hamming.rb
152
+ - tests/test_helper.rb
124
153
  - tests/test_jaro.rb
125
154
  - tests/test_jaro_winkler.rb
126
155
  - tests/test_levenshtein.rb
@@ -132,7 +161,6 @@ homepage: http://github.com/flori/amatch
132
161
  licenses:
133
162
  - Apache-2.0
134
163
  metadata: {}
135
- post_install_message:
136
164
  rdoc_options:
137
165
  - "--title"
138
166
  - Amatch - Approximate Matching
@@ -152,13 +180,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
152
180
  - !ruby/object:Gem::Version
153
181
  version: '0'
154
182
  requirements: []
155
- rubygems_version: 3.3.13
156
- signing_key:
183
+ rubygems_version: 4.0.2
157
184
  specification_version: 4
158
185
  summary: Approximate String Matching library
159
186
  test_files:
160
187
  - tests/test_damerau_levenshtein.rb
161
188
  - tests/test_hamming.rb
189
+ - tests/test_helper.rb
162
190
  - tests/test_jaro.rb
163
191
  - tests/test_jaro_winkler.rb
164
192
  - tests/test_levenshtein.rb
data/CHANGES DELETED
@@ -1,57 +0,0 @@
1
- 2017-07-04 (0.4.0)
2
- * Officially support DamerauLevenshtein matching algorithm.
3
- * Change license to Apache 2.0
4
- 2017-05-23 (0.3.1)
5
- * Include PairDistance fix from dominikgrygiel, Thx.
6
- 2017-03-27 (0.3.0)
7
- * Update some dependencies
8
- 2013-10-14 (0.2.12)
9
- * Include test fix from Juanito Fatas <katehuang0320@gmail.com>. Thx!
10
- 2013-01-16 (0.2.11)
11
- * Include some fixes from Jason Colburne <jason@redbeardenterprises.com>.
12
- Thx!
13
- 2012-02-06 (0.2.10)
14
- * Use xfree instead of free to avoid (possible) problems.
15
- 2011-11-14 (0.2.9)
16
- * Provide amatch/rude and amatch/polite for require (the latter doesn't
17
- extend ::String on its own)
18
- * pair_distance_similar method now can take an optional regexp argument for
19
- tokenizing.
20
- 2011-09-26 (0.2.8)
21
- * Depend on tins library.
22
- 2011-08-06 (0.2.7)
23
- * Fix some violations of ISO C90 standard.
24
- 2011-07-16 (0.2.6)
25
- * Applied patch by Kevin J. Lynagh <kevin@keminglabs.com> fixing memory
26
- leak in Jaro match.
27
- 2009-09-23 (0.2.5)
28
- * Added lib to gem's require_paths.
29
- * Using rake-compiler now.
30
- 2009-08-25 (0.2.4)
31
- * Included Jaro and Jaro-Winkler metrics implementation of Kevin Ballard
32
- <kevin@rapleaf.com>. Thanks a lot.
33
- * Made the extension compile under Ruby 1.9.
34
- 2006-06-25 (0.2.3)
35
- * Fixed agrep.rb to use the new API.
36
- 2005-10-11 (0.2.2)
37
- * Fixed a typo in extconf.rb that prohibitted compiling on
38
- non-gcc compilers.
39
- 2005-09-12 (0.2.1)
40
- * Bugfix: Wrong type for pattern length corrected. Thanks to David
41
- Heinemeier Hansson for reporting it.
42
- 2005-06-01 (0.2.0)
43
- * Major changes in API and implementation:
44
- Now the Levenshtein edit distance, Sellers edit distance, the Hamming
45
- distance, the longest common subsequence length, the longest common
46
- substring length, and the pair distance metric can be computed.
47
- 2005-01-20 (0.1.4)
48
- * Better argument handling in initialization method
49
- * Minor changes in Rakefile and README.en
50
- 2004-09-27 (0.1.3)
51
- * Rakefile and gem support added.
52
- 2004-09-24 (0.1.2)
53
- * Uses Test::Unit for regression tests now.
54
- 2002-04-21 (0.1.1)
55
- * Minor changes: documentation, more test cases and exceptions.
56
- 2002-03-14 (0.1.0)
57
- * Initial Version