amatch 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,3 @@
1
+ pkg
2
+ Gemfile.lock
3
+ .*.sw[pon]
data/CHANGES CHANGED
@@ -1,3 +1,6 @@
1
+ 2011-07-16 (0.2.6)
2
+ * Applied patch by Kevin J. Lynagh <kevin@keminglabs.com> fixing memory
3
+ leak in Jaro match.
1
4
  2009-09-23 (0.2.5)
2
5
  * Added lib to gem's require_paths.
3
6
  * Using rake-compiler now.
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ # vim: set filetype=ruby et sw=2 ts=2:
2
+
3
+ source :rubygems
4
+
5
+ gemspec
@@ -1,6 +1,6 @@
1
- == amatch - Approximate Matching Extension for Ruby
1
+ = amatch - Approximate Matching Extension for Ruby
2
2
 
3
- === Description
3
+ == Description
4
4
 
5
5
  This is a collection of classes that can be used for Approximate
6
6
  matching, searching, and comparing of Strings. They implement algorithms
@@ -8,7 +8,7 @@ that compute the Levenshtein edit distance, Sellers edit distance, the
8
8
  Hamming distance, the longest common subsequence length, the longest common
9
9
  substring length, the pair distance metric, the Jaro-Winkler metric.
10
10
 
11
- === Download
11
+ == Download
12
12
 
13
13
  The latest version of <b>amatch</b> can be found at
14
14
 
@@ -18,7 +18,7 @@ Online Documentation should be located at
18
18
 
19
19
  * http://amatch.rubyforge.org
20
20
 
21
- === Installation
21
+ == Installation
22
22
 
23
23
  Just type into the command line as root:
24
24
 
@@ -32,7 +32,7 @@ To install this extension as a gem type
32
32
 
33
33
  # gem install amatch
34
34
 
35
- === Examples
35
+ == Examples
36
36
  require 'amatch'
37
37
  # => true
38
38
  include Amatch
@@ -117,14 +117,12 @@ To install this extension as a gem type
117
117
  "pattern language".jarowinkler_similar("language of patterns")
118
118
  # => 0.672222222222222
119
119
 
120
- === Author
120
+ == Author
121
121
 
122
122
  Florian Frank mailto:flori@ping.de
123
123
 
124
- === License
124
+ == License
125
125
 
126
126
  This is free software; you can redistribute it and/or modify it under
127
127
  the terms of the GNU General Public License Version 2 as published by
128
128
  the Free Software Foundation: http://www.gnu.org/copyleft/gpl.html
129
-
130
-
data/Rakefile CHANGED
@@ -1,141 +1,33 @@
1
1
  # vim: set filetype=ruby et sw=2 ts=2:
2
2
 
3
- begin
4
- require 'rake/gempackagetask'
5
- require 'rake/extensiontask'
6
- rescue LoadError
7
- end
8
-
9
- require 'rbconfig'
10
- include Config
11
-
12
- require 'rake/clean'
13
- CLEAN.include 'coverage', 'doc'
14
- require 'rake/testtask'
15
-
16
- MAKE = ENV['MAKE'] || %w[gmake make].find { |c| system(c, '-v') }
17
- PKG_NAME = 'amatch'
18
- PKG_VERSION = File.read('VERSION').chomp
19
- PKG_FILES = FileList["**/*"].exclude(/^(pkg|coverage|doc|tmp)/)
20
- PKG_DOC_FILES = [ "ext/amatch.c" ].concat(Dir['lib/**/*.rb']) << 'README'
21
-
22
- desc "Run unit tests"
23
- task :test => :compile_ext do
24
- sh %{testrb -Iext:lib tests/test_*.rb}
25
- end
26
-
27
- desc "Compiling library"
28
- task :compile_ext do
29
- cd 'ext' do
30
- ruby %{extconf.rb}
31
- sh MAKE
32
- end
33
- end
34
-
35
- desc "Installing library"
36
- task :install => :test do
37
- src, = Dir['ext/amatch.*'].reject { |x| /\.[co]$/.match x }
38
- filename = File.basename(src)
39
- dst = File.join(CONFIG["sitelibdir"], filename)
40
- install(src, dst, :verbose => true)
41
- end
42
-
43
- desc "Removing generated files"
44
- task :clean do
45
- cd 'ext' do
46
- ruby 'extconf.rb'
47
- sh "#{MAKE} distclean" if File.exist?('Makefile')
48
- end
49
- end
50
-
51
- desc "Build the documentation"
52
- task :doc do
53
- sh "rdoc -m README -t '#{PKG_NAME} - Approximate Matching' #{PKG_DOC_FILES * ' '}"
54
- end
55
-
56
- if defined?(Gem) and defined?(Rake::GemPackageTask) and
57
- defined?(Rake::ExtensionTask)
58
- then
59
- spec_src = <<-GEM
60
- Gem::Specification.new do |s|
61
- s.name = '#{PKG_NAME}'
62
- s.version = '#{PKG_VERSION}'
63
- s.summary = "Approximate String Matching library"
64
- s.description = <<EOF
3
+ require 'gem_hadar'
4
+
5
+ GemHadar do
6
+ name 'amatch'
7
+ author 'Florian Frank'
8
+ email 'flori@ping.de'
9
+ homepage "http://github.com/flori/#{name}"
10
+ summary 'Approximate String Matching library'
11
+ description <<EOT
65
12
  Amatch is a library for approximate string matching and searching in strings.
66
13
  Several algorithms can be used to do this, and it's also possible to compute a
67
14
  similarity metric number between 0.0 and 1.0 for two given strings.
68
- EOF
69
-
70
- s.files = #{PKG_FILES.sort.inspect}
71
-
72
- s.extensions << "ext/extconf.rb"
73
-
74
- s.require_paths << 'ext' << 'lib'
75
-
76
- s.bindir = "bin"
77
- s.executables = ["agrep.rb"]
78
- s.default_executable = "agrep.rb"
79
-
80
- s.has_rdoc = true
81
- s.extra_rdoc_files.concat #{PKG_DOC_FILES.sort.inspect}
82
- s.rdoc_options << '--main' << 'README' <<
83
- '--title' << "#{PKG_NAME} - Approximate Matching"
84
- s.test_files.concat Dir['tests/test_*.rb']
85
-
86
- s.author = "Florian Frank"
87
- s.email = "flori@ping.de"
88
- s.homepage = "http://amatch.rubyforge.org"
89
- s.rubyforge_project = '#{PKG_NAME}'
90
- end
91
- GEM
92
-
93
- desc 'Create a gemspec file'
94
- task :gemspec do
95
- File.open("#{PKG_NAME}.gemspec", 'w') do |f|
96
- f.puts spec_src
97
- end
98
- end
99
-
100
- spec = eval(spec_src)
101
- Rake::GemPackageTask.new(spec) do |pkg|
102
- pkg.need_tar = true
103
- pkg.package_files = PKG_FILES
104
- end
105
-
106
- Rake::ExtensionTask.new do |ext|
107
- ext.name = PKG_NAME
108
- ext.gem_spec = spec
109
- ext.cross_compile = true
110
- ext.cross_platform = 'i386-mswin32'
111
- ext.ext_dir = 'ext'
112
- ext.lib_dir = 'lib'
113
- end
114
- end
115
-
116
- desc m = "Writing version information for #{PKG_VERSION}"
117
- task :version do
118
- puts m
119
- File.open(File.join('lib', 'amatch', 'version.rb'), 'w') do |v|
120
- v.puts <<EOT
121
- module Amatch
122
- # Amatch version
123
- VERSION = '#{PKG_VERSION}'
124
- VERSION_ARRAY = VERSION.split(/\\./).map { |x| x.to_i } # :nodoc:
125
- VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
126
- VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
127
- VERSION_BUILD = VERSION_ARRAY[2] # :nodoc:
128
- end
129
15
  EOT
16
+ description 'Library to tail files in Ruby'
17
+ executables << 'agrep.rb'
18
+ bindir 'bin'
19
+ test_dir 'tests'
20
+ ignore '.*.sw[pon]', 'pkg', 'Gemfile.lock'
21
+ title "#{name.camelize} - Approximate Matching"
22
+ readme 'README.rdoc'
23
+ require_paths %w[lib ext]
24
+ dependency 'spruz', '~>0.2'
25
+
26
+ install_library do
27
+ libdir = CONFIG["sitelibdir"]
28
+ src, = Dir['ext/amatch.*'].reject { |x| x =~ /\.[co]$/ }
29
+ install(src, File.join(libdir, File.basename(src)), :verbose => true)
30
+ mkdir_p dst = File.join(libdir, 'amatch')
31
+ install('lib/amatch/version.rb', File.join(dst, 'version.rb'), :verbose => true)
130
32
  end
131
33
  end
132
-
133
-
134
- desc "Default task"
135
- task :default => [ :version, :gemspec, :test ]
136
-
137
- desc "Build all gems and archives for a new release."
138
- task :release => [ :clean, :version, :gemspec, :cross, :native, :gem ] do
139
- system "#$0 clean native gem"
140
- system "#$0 clean package"
141
- end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.5
1
+ 0.2.6
@@ -1,31 +1,38 @@
1
- Gem::Specification.new do |s|
2
- s.name = 'amatch'
3
- s.version = '0.2.5'
4
- s.summary = "Approximate String Matching library"
5
- s.description = <<EOF
6
- Amatch is a library for approximate string matching and searching in strings.
7
- Several algorithms can be used to do this, and it's also possible to compute a
8
- similarity metric number between 0.0 and 1.0 for two given strings.
9
- EOF
1
+ # -*- encoding: utf-8 -*-
10
2
 
11
- s.files = ["CHANGES", "COPYING", "README", "Rakefile", "VERSION", "amatch.gemspec", "bin", "bin/agrep.rb", "ext", "ext/amatch.c", "ext/common.h", "ext/extconf.rb", "ext/pair.c", "ext/pair.h", "install.rb", "lib", "lib/amatch", "lib/amatch/version.rb", "tests", "tests/test_hamming.rb", "tests/test_jaro.rb", "tests/test_jaro_winkler.rb", "tests/test_levenshtein.rb", "tests/test_longest_subsequence.rb", "tests/test_longest_substring.rb", "tests/test_pair_distance.rb", "tests/test_sellers.rb"]
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{amatch}
5
+ s.version = "0.2.6"
12
6
 
13
- s.extensions << "ext/extconf.rb"
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Florian Frank"]
9
+ s.date = %q{2011-07-16}
10
+ s.default_executable = %q{agrep.rb}
11
+ s.description = %q{Library to tail files in Ruby}
12
+ s.email = %q{flori@ping.de}
13
+ s.executables = ["agrep.rb"]
14
+ s.extensions = ["ext/extconf.rb"]
15
+ s.extra_rdoc_files = ["README.rdoc", "lib/amatch/version.rb", "ext/amatch.c", "ext/pair.c"]
16
+ s.files = [".gitignore", "CHANGES", "COPYING", "Gemfile", "README.rdoc", "Rakefile", "VERSION", "amatch.gemspec", "bin/agrep.rb", "ext/amatch.c", "ext/common.h", "ext/extconf.rb", "ext/pair.c", "ext/pair.h", "install.rb", "lib/amatch/.keep", "lib/amatch/version.rb", "tests/test_hamming.rb", "tests/test_jaro.rb", "tests/test_jaro_winkler.rb", "tests/test_levenshtein.rb", "tests/test_longest_subsequence.rb", "tests/test_longest_substring.rb", "tests/test_pair_distance.rb", "tests/test_sellers.rb"]
17
+ s.homepage = %q{http://github.com/flori/amatch}
18
+ s.rdoc_options = ["--title", "Amatch - Approximate Matching", "--main", "README.rdoc"]
19
+ s.require_paths = ["lib", "ext"]
20
+ s.rubygems_version = %q{1.6.2}
21
+ s.summary = %q{Approximate String Matching library}
22
+ s.test_files = ["tests/test_sellers.rb", "tests/test_jaro.rb", "tests/test_longest_subsequence.rb", "tests/test_longest_substring.rb", "tests/test_hamming.rb", "tests/test_pair_distance.rb", "tests/test_levenshtein.rb", "tests/test_jaro_winkler.rb"]
14
23
 
15
- s.require_paths << 'ext' << 'lib'
24
+ if s.respond_to? :specification_version then
25
+ s.specification_version = 3
16
26
 
17
- s.bindir = "bin"
18
- s.executables = ["agrep.rb"]
19
- s.default_executable = "agrep.rb"
20
-
21
- s.has_rdoc = true
22
- s.extra_rdoc_files.concat ["README", "ext/amatch.c", "lib/amatch/version.rb"]
23
- s.rdoc_options << '--main' << 'README' <<
24
- '--title' << "amatch - Approximate Matching"
25
- s.test_files.concat Dir['tests/test_*.rb']
26
-
27
- s.author = "Florian Frank"
28
- s.email = "flori@ping.de"
29
- s.homepage = "http://amatch.rubyforge.org"
30
- s.rubyforge_project = 'amatch'
27
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
28
+ s.add_development_dependency(%q<gem_hadar>, ["~> 0.0.3"])
29
+ s.add_runtime_dependency(%q<spruz>, ["~> 0.2"])
30
+ else
31
+ s.add_dependency(%q<gem_hadar>, ["~> 0.0.3"])
32
+ s.add_dependency(%q<spruz>, ["~> 0.2"])
31
33
  end
34
+ else
35
+ s.add_dependency(%q<gem_hadar>, ["~> 0.0.3"])
36
+ s.add_dependency(%q<spruz>, ["~> 0.2"])
37
+ end
38
+ end
@@ -690,7 +690,10 @@ static VALUE LongestSubstring_similar(General *amatch, VALUE string)
690
690
  } \
691
691
  t = t / 2; \
692
692
  result = (((double)m)/a_len + ((double)m)/b_len + ((double)(m-t))/m)/3.0; \
693
- }
693
+ } \
694
+ free(l[0]); \
695
+ free(l[1]);
696
+
694
697
 
695
698
  #define LOWERCASE_STRINGS \
696
699
  char *ying = ALLOC_N(char, a_len); \
File without changes
@@ -1,6 +1,6 @@
1
1
  module Amatch
2
2
  # Amatch version
3
- VERSION = '0.2.5'
3
+ VERSION = '0.2.6'
4
4
  VERSION_ARRAY = VERSION.split(/\./).map { |x| x.to_i } # :nodoc:
5
5
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
6
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
metadata CHANGED
@@ -1,7 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: amatch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ hash: 27
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 2
9
+ - 6
10
+ version: 0.2.6
5
11
  platform: ruby
6
12
  authors:
7
13
  - Florian Frank
@@ -9,28 +15,57 @@ autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
17
 
12
- date: 2009-09-25 00:00:00 +02:00
13
- default_executable: agrep.rb
14
- dependencies: []
15
-
16
- description: |
17
- Amatch is a library for approximate string matching and searching in strings.
18
- Several algorithms can be used to do this, and it's also possible to compute a
19
- similarity metric number between 0.0 and 1.0 for two given strings.
20
-
18
+ date: 2011-07-16 00:00:00 +02:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: gem_hadar
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ hash: 25
30
+ segments:
31
+ - 0
32
+ - 0
33
+ - 3
34
+ version: 0.0.3
35
+ type: :development
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: spruz
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ hash: 15
46
+ segments:
47
+ - 0
48
+ - 2
49
+ version: "0.2"
50
+ type: :runtime
51
+ version_requirements: *id002
52
+ description: Library to tail files in Ruby
21
53
  email: flori@ping.de
22
54
  executables:
23
55
  - agrep.rb
24
56
  extensions:
25
57
  - ext/extconf.rb
26
58
  extra_rdoc_files:
27
- - README
28
- - ext/amatch.c
59
+ - README.rdoc
29
60
  - lib/amatch/version.rb
61
+ - ext/amatch.c
62
+ - ext/pair.c
30
63
  files:
64
+ - .gitignore
31
65
  - CHANGES
32
66
  - COPYING
33
- - README
67
+ - Gemfile
68
+ - README.rdoc
34
69
  - Rakefile
35
70
  - VERSION
36
71
  - amatch.gemspec
@@ -41,7 +76,7 @@ files:
41
76
  - ext/pair.c
42
77
  - ext/pair.h
43
78
  - install.rb
44
- - lib/amatch.so
79
+ - lib/amatch/.keep
45
80
  - lib/amatch/version.rb
46
81
  - tests/test_hamming.rb
47
82
  - tests/test_jaro.rb
@@ -52,44 +87,49 @@ files:
52
87
  - tests/test_pair_distance.rb
53
88
  - tests/test_sellers.rb
54
89
  has_rdoc: true
55
- homepage: http://amatch.rubyforge.org
90
+ homepage: http://github.com/flori/amatch
56
91
  licenses: []
57
92
 
58
93
  post_install_message:
59
94
  rdoc_options:
60
- - --main
61
- - README
62
95
  - --title
63
- - amatch - Approximate Matching
96
+ - Amatch - Approximate Matching
97
+ - --main
98
+ - README.rdoc
64
99
  require_paths:
65
100
  - lib
66
101
  - ext
67
- - lib
68
102
  required_ruby_version: !ruby/object:Gem::Requirement
103
+ none: false
69
104
  requirements:
70
105
  - - ">="
71
106
  - !ruby/object:Gem::Version
107
+ hash: 3
108
+ segments:
109
+ - 0
72
110
  version: "0"
73
- version:
74
111
  required_rubygems_version: !ruby/object:Gem::Requirement
112
+ none: false
75
113
  requirements:
76
114
  - - ">="
77
115
  - !ruby/object:Gem::Version
116
+ hash: 3
117
+ segments:
118
+ - 0
78
119
  version: "0"
79
- version:
80
120
  requirements: []
81
121
 
82
- rubyforge_project: amatch
83
- rubygems_version: 1.3.4
122
+ rubyforge_project:
123
+ rubygems_version: 1.6.2
84
124
  signing_key:
85
125
  specification_version: 3
86
126
  summary: Approximate String Matching library
87
127
  test_files:
128
+ - tests/test_sellers.rb
129
+ - tests/test_jaro.rb
130
+ - tests/test_longest_subsequence.rb
88
131
  - tests/test_longest_substring.rb
89
132
  - tests/test_hamming.rb
90
- - tests/test_longest_subsequence.rb
91
133
  - tests/test_pair_distance.rb
92
134
  - tests/test_levenshtein.rb
93
- - tests/test_jaro.rb
94
- - tests/test_sellers.rb
95
135
  - tests/test_jaro_winkler.rb
Binary file