amatch 0.4.1 → 0.4.2

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: 588c17ff90e55b20273ef43b5b492e53e6792e2159115f68cd5c51ae587e7419
4
+ data.tar.gz: 329159a6723b97a7f4d2faa0a5e580f1e812156d7c391f0e580a918b2df84d22
5
5
  SHA512:
6
- metadata.gz: 3f006e0912e06325dd59cae3c4479a4c10569ed22c27f06c687aa255fcd4d035b9a7fa14f8a0ab90d5627a97e9f2a6bd1b82b8f9836bda3673fe6a1954fe5f31
7
- data.tar.gz: 61d56bd7d7a4f08fe9aa00b1233c7335899c6c06280afa4faa57bb8f9b9ad55b3c51398e5207b3b919e321ff8c07215bf7c06ed11cade5d51bfcc15a9d544daa
6
+ metadata.gz: 8cb9a9986c94a1b0cf1ec84be77d5aa6d53e454843a92334c99a7b2103bd75e03804c539555aeb5b66c6332f44e2bb21053b612f87c62ab0eeddd63f2eeb441f
7
+ data.tar.gz: e656d288645b309eac412b65e3126843921c248dd56bd3ece8cdc9e7d619a1744bed01274183d08708c92cb386f099b7be6f52c497fb779286f0d6e4b83a6d44
data/CHANGES.md ADDED
@@ -0,0 +1,111 @@
1
+ # Changes
2
+
3
+ ## 2025-07-10 v0.4.2
4
+
5
+ * Single-character identical strings now return a similarity score of `1.0`.
6
+ * Updated C extension to handle this edge case.
7
+ * Added tests for Jaro and Jaro-Winkler algorithms.
8
+ * Thx to Jared Nielson for the fix.
9
+
10
+ ## 2022-05-15 v0.4.1
11
+
12
+ * **Moved CI testing from Travis to All Images**
13
+ + Updated configuration to use `all_images` instead of Travis for continuous integration testing.
14
+
15
+ ## 2017-07-04 v0.4.0
16
+
17
+ * Officially support DamerauLevenshtein matching algorithm.
18
+ * Change license to Apache 2.0
19
+
20
+ ## 2017-05-23 v0.3.1
21
+
22
+ * Include PairDistance fix from dominikgrygiel, Thx.
23
+
24
+ ## 2014-03-27 v0.3.0
25
+
26
+ * Update some dependencies
27
+
28
+ ## 2013-10-14 v0.2.12
29
+
30
+ * Include test fix from Juanito Fatas <katehuang0320@gmail.com>. Thx!
31
+
32
+ ## 2013-01-16 v0.2.11
33
+
34
+ * Include some fixes from Jason Colburne <jason@redbeardenterprises.com>.
35
+ Thx!
36
+
37
+ ## 2012-02-06 v0.2.10
38
+
39
+ * Use xfree instead of free to avoid (possible) problems.
40
+
41
+ ## 2011-11-15 v0.2.9
42
+
43
+ * Provide amatch/rude and amatch/polite for require (the latter doesn't
44
+ extend ::String on its own)
45
+ * `pair_distance_similar` method now can take an optional regexp argument for
46
+ tokenizing.
47
+
48
+ ## 2011-08-06 v0.2.8
49
+
50
+ * Depend on tins library.
51
+
52
+ ## 2011-08-06 v0.2.7
53
+
54
+ * Fix some violations of ISO C90 standard.
55
+
56
+ ## 2011-07-16 v0.2.6
57
+
58
+ * Applied patch by Kevin J. Lynagh <kevin@keminglabs.com> fixing memory
59
+ leak in Jaro match.
60
+
61
+ ## 2009-09-25 v0.2.5
62
+
63
+ * Added lib to gem's require_paths.
64
+ * Using rake-compiler now.
65
+
66
+ ## 2009-08-25 v0.2.4
67
+
68
+ * Included Jaro and Jaro-Winkler metrics implementation of Kevin Ballard
69
+ <kevin@rapleaf.com>. Thanks a lot.
70
+ * Made the extension compile under Ruby 1.9.
71
+
72
+ ## 2006-06-25 v0.2.3
73
+
74
+ * Fixed agrep.rb to use the new API.
75
+
76
+ ## 2005-10-11 v0.2.2
77
+ * Fixed a typo in extconf.rb that prohibitted compiling on
78
+ non-gcc compilers.
79
+
80
+ ## 2005-09-12 v0.2.1
81
+
82
+ * Bugfix: Wrong type for pattern length corrected. Thanks to David
83
+ Heinemeier Hansson for reporting it.
84
+
85
+ ## 2005-06-01 v0.2.0
86
+
87
+ * Major changes in API and implementation:
88
+ Now the Levenshtein edit distance, Sellers edit distance, the Hamming
89
+ distance, the longest common subsequence length, the longest common
90
+ substring length, and the pair distance metric can be computed.
91
+
92
+ ## 2005-01-20 v0.1.4
93
+
94
+ * Better argument handling in initialization method
95
+ * Minor changes in Rakefile and README.en
96
+
97
+ ## 2004-09-27 v0.1.3
98
+
99
+ * Rakefile and gem support added.
100
+
101
+ ## 2004-09-24 v0.1.2
102
+
103
+ * Uses Test::Unit for regression tests now.
104
+
105
+ ## 2002-04-21 v0.1.1
106
+
107
+ * Minor changes: documentation, more test cases and exceptions.
108
+
109
+ ## 2009-08-26 v0.1.0
110
+
111
+ * Initial Version
data/Rakefile CHANGED
@@ -16,7 +16,8 @@ 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'
20
21
  package_ignore '.all_images.yml', '.gitignore', 'VERSION'
21
22
  title "#{name.camelize} - Approximate Matching"
22
23
  readme 'README.md'
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.4.2'
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:
data/tests/test_jaro.rb CHANGED
@@ -11,6 +11,7 @@ class TestJaro < Test::Unit::TestCase
11
11
  @dwayne = Jaro.new('dwayne')
12
12
  @dixon = Jaro.new('DIXON')
13
13
  @one = Jaro.new('one')
14
+ @single = Jaro.new('a')
14
15
  end
15
16
 
16
17
  def test_case
@@ -25,5 +26,6 @@ class TestJaro < Test::Unit::TestCase
25
26
  assert_in_delta 0.822, @dwayne.match('DUANE'), D
26
27
  assert_in_delta 0.767, @dixon.match('DICKSONX'), D
27
28
  assert_in_delta 0.667, @one.match('orange'), D
29
+ assert_in_delta 1.0, @single.match('a')
28
30
  end
29
31
  end
@@ -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
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.4.2
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: '1.20'
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: '1.20'
27
26
  - !ruby/object:Gem::Dependency
28
27
  name: test-unit
29
28
  requirement: !ruby/object:Gem::Requirement
@@ -92,14 +91,14 @@ extensions:
92
91
  - ext/extconf.rb
93
92
  extra_rdoc_files:
94
93
  - README.md
94
+ - ext/amatch_ext.c
95
+ - ext/pair.c
95
96
  - lib/amatch.rb
96
97
  - lib/amatch/polite.rb
97
98
  - lib/amatch/rude.rb
98
99
  - lib/amatch/version.rb
99
- - ext/amatch_ext.c
100
- - ext/pair.c
101
100
  files:
102
- - CHANGES
101
+ - CHANGES.md
103
102
  - COPYING
104
103
  - Gemfile
105
104
  - README.md
@@ -132,7 +131,6 @@ homepage: http://github.com/flori/amatch
132
131
  licenses:
133
132
  - Apache-2.0
134
133
  metadata: {}
135
- post_install_message:
136
134
  rdoc_options:
137
135
  - "--title"
138
136
  - Amatch - Approximate Matching
@@ -152,8 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
152
150
  - !ruby/object:Gem::Version
153
151
  version: '0'
154
152
  requirements: []
155
- rubygems_version: 3.3.13
156
- signing_key:
153
+ rubygems_version: 3.6.9
157
154
  specification_version: 4
158
155
  summary: Approximate String Matching library
159
156
  test_files:
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