amatch 0.4.1 → 0.5.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: dc09a597846ffefb73bd3ec19c95dc51cc4d48f76e78082dbc45dcb0d92710b9
4
+ data.tar.gz: d17ce5ead9e01625991ae2a169734209fa5d69ecdbe1af77d05621a7d9290cc3
5
5
  SHA512:
6
- metadata.gz: 3f006e0912e06325dd59cae3c4479a4c10569ed22c27f06c687aa255fcd4d035b9a7fa14f8a0ab90d5627a97e9f2a6bd1b82b8f9836bda3673fe6a1954fe5f31
7
- data.tar.gz: 61d56bd7d7a4f08fe9aa00b1233c7335899c6c06280afa4faa57bb8f9b9ad55b3c51398e5207b3b919e321ff8c07215bf7c06ed11cade5d51bfcc15a9d544daa
6
+ metadata.gz: 432504036ac797eb82f927154c7851bc2c9ece721ac5e80d0eaa7eed690c9196c5a703b2ae2cde7e6c72f2f6013ac0ea5f3e565d4d99e2d8fc6fc697d2400d85
7
+ data.tar.gz: 239233612af4b2bdf1ad04aae68611609fd3c56f2d517316415ea0f8c0f7ba04fe3664535666ca44b3d5d5b7cc52e74bd09ec5a7ea30896146b9105c6b36bf9c
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,126 @@
1
+ # Changes
2
+
3
+ ## 2025-09-11 v0.5.0
4
+
5
+ - Added `yaml-dev` dependency and installed `bundler` and `gem_hadar` gems in `.all_images.yml`
6
+ - Modified script section in `.all_images.yml` to use `bundle update` with parallel installation
7
+ - Changed `fail_fast` setting in `.all_images.yml` from `yes` to `true`
8
+ - Added `ext/amatch_ext*` to `.gitignore` and updated `Rakefile` to ignore these files during packaging
9
+ - Added `coverage` to `.gitignore` and `Rakefile` ignore lists
10
+ - Updated `tins` dependency from `~>1.0` to `~>1`
11
+ - Added `debug` gem as a regular dependency
12
+ - Added `simplecov` as a development dependency
13
+ - Created `.utilsrc` configuration file for `utilrb` gem with specified settings
14
+ - Replaced individual test requires with `require 'test_helper'` in all test files
15
+ - Created `tests/test_helper.rb` to centralize test setup including SimpleCov and debug loading
16
+ - The `gem_hadar/simplecov` gem is used for code coverage reporting
17
+
18
+ ## 2025-07-10 v0.4.2
19
+
20
+ * Single-character identical strings now return a similarity score of `1.0`.
21
+ * Updated C extension to handle this edge case.
22
+ * Added tests for Jaro and Jaro-Winkler algorithms.
23
+ * Thx to Jared Nielson for the fix.
24
+
25
+ ## 2022-05-15 v0.4.1
26
+
27
+ * **Moved CI testing from Travis to All Images**
28
+ + Updated configuration to use `all_images` instead of Travis for continuous integration testing.
29
+
30
+ ## 2017-07-04 v0.4.0
31
+
32
+ * Officially support DamerauLevenshtein matching algorithm.
33
+ * Change license to Apache 2.0
34
+
35
+ ## 2017-05-23 v0.3.1
36
+
37
+ * Include PairDistance fix from dominikgrygiel, Thx.
38
+
39
+ ## 2014-03-27 v0.3.0
40
+
41
+ * Update some dependencies
42
+
43
+ ## 2013-10-14 v0.2.12
44
+
45
+ * Include test fix from Juanito Fatas <katehuang0320@gmail.com>. Thx!
46
+
47
+ ## 2013-01-16 v0.2.11
48
+
49
+ * Include some fixes from Jason Colburne <jason@redbeardenterprises.com>.
50
+ Thx!
51
+
52
+ ## 2012-02-06 v0.2.10
53
+
54
+ * Use xfree instead of free to avoid (possible) problems.
55
+
56
+ ## 2011-11-15 v0.2.9
57
+
58
+ * Provide amatch/rude and amatch/polite for require (the latter doesn't
59
+ extend ::String on its own)
60
+ * `pair_distance_similar` method now can take an optional regexp argument for
61
+ tokenizing.
62
+
63
+ ## 2011-08-06 v0.2.8
64
+
65
+ * Depend on tins library.
66
+
67
+ ## 2011-08-06 v0.2.7
68
+
69
+ * Fix some violations of ISO C90 standard.
70
+
71
+ ## 2011-07-16 v0.2.6
72
+
73
+ * Applied patch by Kevin J. Lynagh <kevin@keminglabs.com> fixing memory
74
+ leak in Jaro match.
75
+
76
+ ## 2009-09-25 v0.2.5
77
+
78
+ * Added lib to gem's require_paths.
79
+ * Using rake-compiler now.
80
+
81
+ ## 2009-08-25 v0.2.4
82
+
83
+ * Included Jaro and Jaro-Winkler metrics implementation of Kevin Ballard
84
+ <kevin@rapleaf.com>. Thanks a lot.
85
+ * Made the extension compile under Ruby 1.9.
86
+
87
+ ## 2006-06-25 v0.2.3
88
+
89
+ * Fixed agrep.rb to use the new API.
90
+
91
+ ## 2005-10-11 v0.2.2
92
+ * Fixed a typo in extconf.rb that prohibitted compiling on
93
+ non-gcc compilers.
94
+
95
+ ## 2005-09-12 v0.2.1
96
+
97
+ * Bugfix: Wrong type for pattern length corrected. Thanks to David
98
+ Heinemeier Hansson for reporting it.
99
+
100
+ ## 2005-06-01 v0.2.0
101
+
102
+ * Major changes in API and implementation:
103
+ Now the Levenshtein edit distance, Sellers edit distance, the Hamming
104
+ distance, the longest common subsequence length, the longest common
105
+ substring length, and the pair distance metric can be computed.
106
+
107
+ ## 2005-01-20 v0.1.4
108
+
109
+ * Better argument handling in initialization method
110
+ * Minor changes in Rakefile and README.en
111
+
112
+ ## 2004-09-27 v0.1.3
113
+
114
+ * Rakefile and gem support added.
115
+
116
+ ## 2004-09-24 v0.1.2
117
+
118
+ * Uses Test::Unit for regression tests now.
119
+
120
+ ## 2002-04-21 v0.1.1
121
+
122
+ * Minor changes: documentation, more test cases and exceptions.
123
+
124
+ ## 2009-08-26 v0.1.0
125
+
126
+ * 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
+ 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.5.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.5.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,14 @@ dependencies:
16
15
  requirements:
17
16
  - - "~>"
18
17
  - !ruby/object:Gem::Version
19
- version: 1.12.0
18
+ version: '2.4'
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.4'
27
26
  - !ruby/object:Gem::Dependency
28
27
  name: test-unit
29
28
  requirement: !ruby/object:Gem::Requirement
@@ -52,20 +51,34 @@ dependencies:
52
51
  - - ">="
53
52
  - !ruby/object:Gem::Version
54
53
  version: '0'
54
+ - !ruby/object:Gem::Dependency
55
+ name: simplecov
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ type: :development
62
+ prerelease: false
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
55
68
  - !ruby/object:Gem::Dependency
56
69
  name: tins
57
70
  requirement: !ruby/object:Gem::Requirement
58
71
  requirements:
59
72
  - - "~>"
60
73
  - !ruby/object:Gem::Version
61
- version: '1.0'
74
+ version: '1'
62
75
  type: :runtime
63
76
  prerelease: false
64
77
  version_requirements: !ruby/object:Gem::Requirement
65
78
  requirements:
66
79
  - - "~>"
67
80
  - !ruby/object:Gem::Version
68
- version: '1.0'
81
+ version: '1'
69
82
  - !ruby/object:Gem::Dependency
70
83
  name: mize
71
84
  requirement: !ruby/object:Gem::Requirement
@@ -80,6 +93,20 @@ dependencies:
80
93
  - - ">="
81
94
  - !ruby/object:Gem::Version
82
95
  version: '0'
96
+ - !ruby/object:Gem::Dependency
97
+ name: debug
98
+ requirement: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ type: :runtime
104
+ prerelease: false
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
83
110
  description: |
84
111
  Amatch is a library for approximate string matching and searching in strings.
85
112
  Several algorithms can be used to do this, and it's also possible to compute a
@@ -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: 3.6.9
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