taxamatch_rb 0.7.4 → 0.7.5
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.
- data/Gemfile +20 -0
- data/Makefile +157 -0
- data/Rakefile +52 -0
- data/VERSION +1 -0
- data/ext/damerau_levenshtein/damerau_levenshtein.c +112 -0
- data/lib/taxamatch_rb/damerau_levenshtein_mod.rb +1 -1
- data/taxamatch_rb.gemspec +96 -0
- metadata +11 -34
- data/lib/taxamatch_rb/damerau_levenshtein.bundle +0 -0
    
        data/Gemfile
    ADDED
    
    | @@ -0,0 +1,20 @@ | |
| 1 | 
            +
            source "http://rubygems.org"
         | 
| 2 | 
            +
            require 'yaml'
         | 
| 3 | 
            +
            YAML::ENGINE.yamler= 'syck'
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            gem "biodiversity","~> 0.5.13"
         | 
| 6 | 
            +
            gem "biodiversity19","~> 0.5.13"
         | 
| 7 | 
            +
             | 
| 8 | 
            +
             | 
| 9 | 
            +
            group :development do
         | 
| 10 | 
            +
              gem "rake-compiler"
         | 
| 11 | 
            +
              gem "rspec", "~> 2.3.0"
         | 
| 12 | 
            +
              gem "cucumber", ">= 0"
         | 
| 13 | 
            +
              gem "bundler", "~> 1.0.0"
         | 
| 14 | 
            +
              gem "jeweler", "~> 1.6.0"
         | 
| 15 | 
            +
              gem "rcov", ">= 0"
         | 
| 16 | 
            +
              gem "ruby-debug19"
         | 
| 17 | 
            +
              gem "ruby-prof"
         | 
| 18 | 
            +
              gem "shoulda"
         | 
| 19 | 
            +
              gem "mocha"
         | 
| 20 | 
            +
            end
         | 
    
        data/Makefile
    ADDED
    
    | @@ -0,0 +1,157 @@ | |
| 1 | 
            +
             | 
| 2 | 
            +
            SHELL = /bin/sh
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            #### Start of system configuration section. ####
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            srcdir = /Users/dimus/.rvm/gems/ruby-1.9.2-p0/bin
         | 
| 7 | 
            +
            topdir = /Users/dimus/.rvm/rubies/ruby-1.9.2-p0/include/ruby-1.9.1
         | 
| 8 | 
            +
            hdrdir = /Users/dimus/.rvm/rubies/ruby-1.9.2-p0/include/ruby-1.9.1
         | 
| 9 | 
            +
            arch_hdrdir = /Users/dimus/.rvm/rubies/ruby-1.9.2-p0/include/ruby-1.9.1/$(arch)
         | 
| 10 | 
            +
            VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby
         | 
| 11 | 
            +
            prefix = $(DESTDIR)/Users/dimus/.rvm/rubies/ruby-1.9.2-p0
         | 
| 12 | 
            +
            rubylibprefix = $(libdir)/$(RUBY_BASE_NAME)
         | 
| 13 | 
            +
            exec_prefix = $(prefix)
         | 
| 14 | 
            +
            vendorhdrdir = $(rubyhdrdir)/vendor_ruby
         | 
| 15 | 
            +
            sitehdrdir = $(rubyhdrdir)/site_ruby
         | 
| 16 | 
            +
            rubyhdrdir = $(includedir)/$(RUBY_BASE_NAME)-$(ruby_version)
         | 
| 17 | 
            +
            vendordir = $(rubylibprefix)/vendor_ruby
         | 
| 18 | 
            +
            sitedir = $(rubylibprefix)/site_ruby
         | 
| 19 | 
            +
            ridir = $(datarootdir)/$(RI_BASE_NAME)
         | 
| 20 | 
            +
            mandir = $(datarootdir)/man
         | 
| 21 | 
            +
            localedir = $(datarootdir)/locale
         | 
| 22 | 
            +
            libdir = $(exec_prefix)/lib
         | 
| 23 | 
            +
            psdir = $(docdir)
         | 
| 24 | 
            +
            pdfdir = $(docdir)
         | 
| 25 | 
            +
            dvidir = $(docdir)
         | 
| 26 | 
            +
            htmldir = $(docdir)
         | 
| 27 | 
            +
            infodir = $(datarootdir)/info
         | 
| 28 | 
            +
            docdir = $(datarootdir)/doc/$(PACKAGE)
         | 
| 29 | 
            +
            oldincludedir = $(DESTDIR)/usr/include
         | 
| 30 | 
            +
            includedir = $(prefix)/include
         | 
| 31 | 
            +
            localstatedir = $(prefix)/var
         | 
| 32 | 
            +
            sharedstatedir = $(prefix)/com
         | 
| 33 | 
            +
            sysconfdir = $(prefix)/etc
         | 
| 34 | 
            +
            datadir = $(datarootdir)
         | 
| 35 | 
            +
            datarootdir = $(prefix)/share
         | 
| 36 | 
            +
            libexecdir = $(exec_prefix)/libexec
         | 
| 37 | 
            +
            sbindir = $(exec_prefix)/sbin
         | 
| 38 | 
            +
            bindir = $(exec_prefix)/bin
         | 
| 39 | 
            +
            rubylibdir = $(rubylibprefix)/$(ruby_version)
         | 
| 40 | 
            +
            archdir = $(rubylibdir)/$(arch)
         | 
| 41 | 
            +
            sitelibdir = $(sitedir)/$(ruby_version)
         | 
| 42 | 
            +
            sitearchdir = $(sitelibdir)/$(sitearch)
         | 
| 43 | 
            +
            vendorlibdir = $(vendordir)/$(ruby_version)
         | 
| 44 | 
            +
            vendorarchdir = $(vendorlibdir)/$(sitearch)
         | 
| 45 | 
            +
             | 
| 46 | 
            +
            CC = gcc
         | 
| 47 | 
            +
            CXX = g++
         | 
| 48 | 
            +
            LIBRUBY = $(LIBRUBY_SO)
         | 
| 49 | 
            +
            LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
         | 
| 50 | 
            +
            LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
         | 
| 51 | 
            +
            LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static
         | 
| 52 | 
            +
            OUTFLAG = -o 
         | 
| 53 | 
            +
            COUTFLAG = -o 
         | 
| 54 | 
            +
             | 
| 55 | 
            +
            RUBY_EXTCONF_H = 
         | 
| 56 | 
            +
            cflags   =  $(optflags) $(debugflags) $(warnflags)
         | 
| 57 | 
            +
            optflags = -O3
         | 
| 58 | 
            +
            debugflags = -ggdb
         | 
| 59 | 
            +
            warnflags = -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long
         | 
| 60 | 
            +
            CFLAGS   = -fno-common $(cflags)  -fno-common -pipe 
         | 
| 61 | 
            +
            INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir)
         | 
| 62 | 
            +
            DEFS     = 
         | 
| 63 | 
            +
            CPPFLAGS =  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE $(DEFS) $(cppflags)
         | 
| 64 | 
            +
            CXXFLAGS = $(CFLAGS) $(cxxflags)
         | 
| 65 | 
            +
            ldflags  = -L. 
         | 
| 66 | 
            +
            dldflags = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -Wl,-flat_namespace
         | 
| 67 | 
            +
            ARCH_FLAG = 
         | 
| 68 | 
            +
            DLDFLAGS = $(ldflags) $(dldflags)
         | 
| 69 | 
            +
            LDSHARED = $(CC) -dynamic -bundle
         | 
| 70 | 
            +
            LDSHAREDXX = $(CXX) -dynamic -bundle
         | 
| 71 | 
            +
            AR = ar
         | 
| 72 | 
            +
            EXEEXT = 
         | 
| 73 | 
            +
             | 
| 74 | 
            +
            RUBY_BASE_NAME = ruby
         | 
| 75 | 
            +
            RUBY_INSTALL_NAME = ruby
         | 
| 76 | 
            +
            RUBY_SO_NAME = ruby.1.9.1
         | 
| 77 | 
            +
            arch = x86_64-darwin10.3.1
         | 
| 78 | 
            +
            sitearch = $(arch)
         | 
| 79 | 
            +
            ruby_version = 1.9.1
         | 
| 80 | 
            +
            ruby = /Users/dimus/.rvm/rubies/ruby-1.9.2-p0/bin/ruby
         | 
| 81 | 
            +
            RUBY = $(ruby)
         | 
| 82 | 
            +
            RM = rm -f
         | 
| 83 | 
            +
            RM_RF = $(RUBY) -run -e rm -- -rf
         | 
| 84 | 
            +
            RMDIRS = $(RUBY) -run -e rmdir -- -p
         | 
| 85 | 
            +
            MAKEDIRS = mkdir -p
         | 
| 86 | 
            +
            INSTALL = /usr/bin/install -c
         | 
| 87 | 
            +
            INSTALL_PROG = $(INSTALL) -m 0755
         | 
| 88 | 
            +
            INSTALL_DATA = $(INSTALL) -m 644
         | 
| 89 | 
            +
            COPY = cp
         | 
| 90 | 
            +
             | 
| 91 | 
            +
            #### End of system configuration section. ####
         | 
| 92 | 
            +
             | 
| 93 | 
            +
            preload = 
         | 
| 94 | 
            +
             | 
| 95 | 
            +
            libpath = . $(libdir)
         | 
| 96 | 
            +
            LIBPATH =  -L. -L$(libdir)
         | 
| 97 | 
            +
            DEFFILE = 
         | 
| 98 | 
            +
             | 
| 99 | 
            +
            CLEANFILES = mkmf.log
         | 
| 100 | 
            +
            DISTCLEANFILES = 
         | 
| 101 | 
            +
            DISTCLEANDIRS = 
         | 
| 102 | 
            +
             | 
| 103 | 
            +
            extout = 
         | 
| 104 | 
            +
            extout_prefix = 
         | 
| 105 | 
            +
            target_prefix = 
         | 
| 106 | 
            +
            LOCAL_LIBS = 
         | 
| 107 | 
            +
            LIBS = $(LIBRUBYARG_SHARED)  -lpthread -ldl -lobjc 
         | 
| 108 | 
            +
            SRCS = 
         | 
| 109 | 
            +
            OBJS = 
         | 
| 110 | 
            +
            TARGET = 
         | 
| 111 | 
            +
            DLLIB = 
         | 
| 112 | 
            +
            EXTSTATIC = 
         | 
| 113 | 
            +
            STATIC_LIB = 
         | 
| 114 | 
            +
             | 
| 115 | 
            +
            BINDIR        = $(bindir)
         | 
| 116 | 
            +
            RUBYCOMMONDIR = $(sitedir)$(target_prefix)
         | 
| 117 | 
            +
            RUBYLIBDIR    = $(sitelibdir)$(target_prefix)
         | 
| 118 | 
            +
            RUBYARCHDIR   = $(sitearchdir)$(target_prefix)
         | 
| 119 | 
            +
            HDRDIR        = $(rubyhdrdir)/ruby$(target_prefix)
         | 
| 120 | 
            +
            ARCHHDRDIR    = $(rubyhdrdir)/$(arch)/ruby$(target_prefix)
         | 
| 121 | 
            +
             | 
| 122 | 
            +
            TARGET_SO     = $(DLLIB)
         | 
| 123 | 
            +
            CLEANLIBS     = $(TARGET).bundle 
         | 
| 124 | 
            +
            CLEANOBJS     = *.o  *.bak
         | 
| 125 | 
            +
             | 
| 126 | 
            +
            all:    Makefile
         | 
| 127 | 
            +
            static: $(STATIC_LIB)
         | 
| 128 | 
            +
            .PHONY: all install static install-so install-rb
         | 
| 129 | 
            +
            .PHONY: clean clean-so clean-rb
         | 
| 130 | 
            +
             | 
| 131 | 
            +
            clean-rb-default::
         | 
| 132 | 
            +
            clean-rb::
         | 
| 133 | 
            +
            clean-so::
         | 
| 134 | 
            +
            clean: clean-so clean-rb-default clean-rb
         | 
| 135 | 
            +
            		@-$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES)
         | 
| 136 | 
            +
             | 
| 137 | 
            +
            distclean-rb-default::
         | 
| 138 | 
            +
            distclean-rb::
         | 
| 139 | 
            +
            distclean-so::
         | 
| 140 | 
            +
            distclean: clean distclean-so distclean-rb-default distclean-rb
         | 
| 141 | 
            +
            		@-$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
         | 
| 142 | 
            +
            		@-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
         | 
| 143 | 
            +
            		@-$(RMDIRS) $(DISTCLEANDIRS)
         | 
| 144 | 
            +
             | 
| 145 | 
            +
            realclean: distclean
         | 
| 146 | 
            +
            install: install-so install-rb
         | 
| 147 | 
            +
             | 
| 148 | 
            +
            install-so: Makefile
         | 
| 149 | 
            +
            install-rb: pre-install-rb install-rb-default
         | 
| 150 | 
            +
            install-rb-default: pre-install-rb-default
         | 
| 151 | 
            +
            pre-install-rb: Makefile
         | 
| 152 | 
            +
            pre-install-rb-default: Makefile
         | 
| 153 | 
            +
             | 
| 154 | 
            +
            site-install: site-install-so site-install-rb
         | 
| 155 | 
            +
            site-install-so: install-so
         | 
| 156 | 
            +
            site-install-rb: install-rb
         | 
| 157 | 
            +
             | 
    
        data/Rakefile
    ADDED
    
    | @@ -0,0 +1,52 @@ | |
| 1 | 
            +
            require 'rubygems'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            require 'bundler'
         | 
| 4 | 
            +
            begin
         | 
| 5 | 
            +
              Bundler.setup(:default, :development)
         | 
| 6 | 
            +
            rescue Bundler::BundlerError => e
         | 
| 7 | 
            +
              $stderr.puts e.message
         | 
| 8 | 
            +
              $stderr.puts "Run `bundle install` to install missing gems"
         | 
| 9 | 
            +
              exit e.status_code
         | 
| 10 | 
            +
            end
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            require 'rake'
         | 
| 13 | 
            +
            require 'rake/extensiontask'
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            begin
         | 
| 16 | 
            +
              require 'jeweler'
         | 
| 17 | 
            +
              Jeweler::Tasks.new do |gem|
         | 
| 18 | 
            +
                gem.name = "taxamatch_rb"
         | 
| 19 | 
            +
                gem.summary = 'Implementation of Tony Rees Taxamatch algorithms'
         | 
| 20 | 
            +
                gem.description = 'This gem implements algorithm for fuzzy matching scientific names developed by Tony Rees'
         | 
| 21 | 
            +
                gem.email = "dmozzherin@eol.org"
         | 
| 22 | 
            +
                gem.homepage = "http://github.com/GlobalNamesArchitecture/taxamatch_rb"
         | 
| 23 | 
            +
                gem.authors = ["Dmitry Mozzherin"]
         | 
| 24 | 
            +
                gem.files = FileList["[A-Z]*", "*.gemspec", "{bin,generators,lib,spec}/**/*"]
         | 
| 25 | 
            +
                gem.files -= FileList['lib/**/*.bundle', 'lib/**/*.dll', 'lib/**/*.so']
         | 
| 26 | 
            +
                gem.files += FileList['ext/**/*.c']
         | 
| 27 | 
            +
                gem.extensions = FileList['ext/**/extconf.rb']
         | 
| 28 | 
            +
                # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
         | 
| 29 | 
            +
              end
         | 
| 30 | 
            +
             | 
| 31 | 
            +
            rescue LoadError
         | 
| 32 | 
            +
              puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
         | 
| 33 | 
            +
            end
         | 
| 34 | 
            +
             | 
| 35 | 
            +
            require 'rspec/core'
         | 
| 36 | 
            +
            require 'rspec/core/rake_task'
         | 
| 37 | 
            +
            RSpec::Core::RakeTask.new(:spec) do |spec|
         | 
| 38 | 
            +
              spec.pattern = FileList['spec/**/*_spec.rb']
         | 
| 39 | 
            +
            end
         | 
| 40 | 
            +
             | 
| 41 | 
            +
            RSpec::Core::RakeTask.new(:rcov) do |spec|
         | 
| 42 | 
            +
              spec.pattern = 'spec/**/*_spec.rb'
         | 
| 43 | 
            +
              spec.rcov = true
         | 
| 44 | 
            +
            end
         | 
| 45 | 
            +
             | 
| 46 | 
            +
            Rake::ExtensionTask.new("damerau_levenshtein") do |extension|
         | 
| 47 | 
            +
                extension.lib_dir = "lib"
         | 
| 48 | 
            +
            end
         | 
| 49 | 
            +
             | 
| 50 | 
            +
            Rake::Task[:spec].prerequisites << :compile
         | 
| 51 | 
            +
             | 
| 52 | 
            +
            task :default => :spec
         | 
    
        data/VERSION
    ADDED
    
    | @@ -0,0 +1 @@ | |
| 1 | 
            +
            0.7.5
         | 
| @@ -0,0 +1,112 @@ | |
| 1 | 
            +
            #include "ruby.h"
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            VALUE DamerauLevenshtein = Qnil;
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            void Init_damerau_levenshtein();
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            VALUE method_distance_utf(VALUE self, VALUE _s, VALUE _t, VALUE _block_size, VALUE _max_distance);
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            void Init_damerau_levenshtein() {
         | 
| 10 | 
            +
            	DamerauLevenshtein = rb_define_module("DamerauLevenshtein");
         | 
| 11 | 
            +
            	rb_define_method(DamerauLevenshtein, "distance_utf", method_distance_utf, 4);
         | 
| 12 | 
            +
            }
         | 
| 13 | 
            +
             | 
| 14 | 
            +
            VALUE method_distance_utf(VALUE self, VALUE _s, VALUE _t, VALUE _block_size, VALUE _max_distance){
         | 
| 15 | 
            +
              int i, i1, j, j1, k, half_tl, cost, *d, distance, del, ins, subs, transp, block;
         | 
| 16 | 
            +
              int sl, tl, half_sl;
         | 
| 17 | 
            +
              int stop_execution = 0;
         | 
| 18 | 
            +
              int min = 0;
         | 
| 19 | 
            +
              int current_distance = 0;
         | 
| 20 | 
            +
             | 
| 21 | 
            +
              int block_size = NUM2INT(_block_size);
         | 
| 22 | 
            +
              int max_distance = NUM2INT(_max_distance);
         | 
| 23 | 
            +
             | 
| 24 | 
            +
              VALUE *sv = RARRAY_PTR(_s);
         | 
| 25 | 
            +
              VALUE *tv = RARRAY_PTR(_t);
         | 
| 26 | 
            +
             | 
| 27 | 
            +
              sl = (int) RARRAY_LEN(_s);
         | 
| 28 | 
            +
              tl = (int) RARRAY_LEN(_t);
         | 
| 29 | 
            +
             | 
| 30 | 
            +
              if (sl == 0) return INT2NUM(tl);
         | 
| 31 | 
            +
              if (tl == 0) return INT2NUM(sl);
         | 
| 32 | 
            +
              //case of lengths 1 must present or it will break further in the code
         | 
| 33 | 
            +
              if (sl == 1 && tl == 1 && sv[0] != tv[0]) return INT2NUM(1);
         | 
| 34 | 
            +
             | 
| 35 | 
            +
              int s[sl];
         | 
| 36 | 
            +
              int t[tl];
         | 
| 37 | 
            +
             | 
| 38 | 
            +
              for (i=0; i < sl; i++) s[i] = NUM2INT(sv[i]);
         | 
| 39 | 
            +
              for (i=0; i < tl; i++) t[i] = NUM2INT(tv[i]);
         | 
| 40 | 
            +
             | 
| 41 | 
            +
              sl++;
         | 
| 42 | 
            +
              tl++;
         | 
| 43 | 
            +
             | 
| 44 | 
            +
              //one-dimentional representation of 2 dimentional array len(s)+1 * len(t)+1
         | 
| 45 | 
            +
              d = malloc((sizeof(int))*(sl)*(tl));
         | 
| 46 | 
            +
              //populate 'vertical' row starting from the 2nd position (first one is filled already)
         | 
| 47 | 
            +
              for(i = 0; i < tl; i++){
         | 
| 48 | 
            +
                d[i*sl] = i;
         | 
| 49 | 
            +
              }
         | 
| 50 | 
            +
             | 
| 51 | 
            +
              //fill up array with scores
         | 
| 52 | 
            +
              for(i = 1; i<sl; i++){
         | 
| 53 | 
            +
                d[i] = i;
         | 
| 54 | 
            +
                if (stop_execution == 1) break;
         | 
| 55 | 
            +
                current_distance = 10000;
         | 
| 56 | 
            +
                for(j = 1; j<tl; j++){
         | 
| 57 | 
            +
             | 
| 58 | 
            +
                  cost = 1;
         | 
| 59 | 
            +
                  if(s[i-1] == t[j-1]) cost = 0;
         | 
| 60 | 
            +
             | 
| 61 | 
            +
                  half_sl = (sl - 1)/2;
         | 
| 62 | 
            +
                  half_tl = (tl - 1)/2;
         | 
| 63 | 
            +
             | 
| 64 | 
            +
                  block = block_size < half_sl ? block_size : half_sl;
         | 
| 65 | 
            +
                  block = block < half_tl ? block : half_tl;
         | 
| 66 | 
            +
             | 
| 67 | 
            +
                  while (block >= 1){
         | 
| 68 | 
            +
                    int swap1 = 1;
         | 
| 69 | 
            +
                    int swap2 = 1;
         | 
| 70 | 
            +
                    i1 = i - (block * 2);
         | 
| 71 | 
            +
                    j1 = j - (block * 2);
         | 
| 72 | 
            +
                    for (k = i1; k < i1 + block; k++) {
         | 
| 73 | 
            +
                      if (s[k] != t[k + block]){
         | 
| 74 | 
            +
                        swap1 = 0;
         | 
| 75 | 
            +
                        break;
         | 
| 76 | 
            +
                      }
         | 
| 77 | 
            +
                    }
         | 
| 78 | 
            +
                    for (k = j1; k < j1 + block; k++) {
         | 
| 79 | 
            +
                      if (t[k] != s[k + block]){
         | 
| 80 | 
            +
                        swap2 = 0;
         | 
| 81 | 
            +
                        break;
         | 
| 82 | 
            +
                      }
         | 
| 83 | 
            +
                    }
         | 
| 84 | 
            +
             | 
| 85 | 
            +
                    del = d[j*sl + i - 1] + 1;
         | 
| 86 | 
            +
                    ins = d[(j-1)*sl + i] + 1;
         | 
| 87 | 
            +
                    min = del;
         | 
| 88 | 
            +
                    if (ins < min) min = ins;
         | 
| 89 | 
            +
                    //if (i == 2 && j==2) return INT2NUM(swap2+5);
         | 
| 90 | 
            +
                    if (i >= block && j >= block && swap1 == 1 && swap2 == 1){
         | 
| 91 | 
            +
                      transp = d[(j - block * 2) * sl + i - block * 2] + cost + block -1;
         | 
| 92 | 
            +
                      if (transp < min) min = transp;
         | 
| 93 | 
            +
                      block = 0;
         | 
| 94 | 
            +
                    } else if (block == 1) {
         | 
| 95 | 
            +
                      subs = d[(j-1)*sl + i - 1] + cost;
         | 
| 96 | 
            +
                      if (subs < min) min = subs;
         | 
| 97 | 
            +
                    }
         | 
| 98 | 
            +
                    block--;
         | 
| 99 | 
            +
                  }
         | 
| 100 | 
            +
                  d[j*sl+i]=min;
         | 
| 101 | 
            +
                  if (current_distance > d[j*sl+i]) current_distance = d[j*sl+i];
         | 
| 102 | 
            +
                }
         | 
| 103 | 
            +
                if (current_distance > max_distance) {
         | 
| 104 | 
            +
                  stop_execution = 1;
         | 
| 105 | 
            +
                }
         | 
| 106 | 
            +
              }
         | 
| 107 | 
            +
              distance=d[sl * tl - 1];
         | 
| 108 | 
            +
              if (stop_execution == 1) distance = current_distance;
         | 
| 109 | 
            +
             | 
| 110 | 
            +
              free(d);
         | 
| 111 | 
            +
              return INT2NUM(distance);
         | 
| 112 | 
            +
            }
         | 
| @@ -0,0 +1,96 @@ | |
| 1 | 
            +
            # Generated by jeweler
         | 
| 2 | 
            +
            # DO NOT EDIT THIS FILE DIRECTLY
         | 
| 3 | 
            +
            # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
         | 
| 4 | 
            +
            # -*- encoding: utf-8 -*-
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            Gem::Specification.new do |s|
         | 
| 7 | 
            +
              s.name = %q{taxamatch_rb}
         | 
| 8 | 
            +
              s.version = "0.7.5"
         | 
| 9 | 
            +
             | 
| 10 | 
            +
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         | 
| 11 | 
            +
              s.authors = ["Dmitry Mozzherin"]
         | 
| 12 | 
            +
              s.date = %q{2011-06-23}
         | 
| 13 | 
            +
              s.description = %q{This gem implements algorithm for fuzzy matching scientific names developed by Tony Rees}
         | 
| 14 | 
            +
              s.email = %q{dmozzherin@eol.org}
         | 
| 15 | 
            +
              s.extensions = ["ext/damerau_levenshtein/extconf.rb"]
         | 
| 16 | 
            +
              s.extra_rdoc_files = [
         | 
| 17 | 
            +
                "LICENSE",
         | 
| 18 | 
            +
                "README.rdoc"
         | 
| 19 | 
            +
              ]
         | 
| 20 | 
            +
              s.files = [
         | 
| 21 | 
            +
                "Gemfile",
         | 
| 22 | 
            +
                "Gemfile.lock",
         | 
| 23 | 
            +
                "LICENSE",
         | 
| 24 | 
            +
                "Makefile",
         | 
| 25 | 
            +
                "README.rdoc",
         | 
| 26 | 
            +
                "Rakefile",
         | 
| 27 | 
            +
                "VERSION",
         | 
| 28 | 
            +
                "ext/damerau_levenshtein/damerau_levenshtein.c",
         | 
| 29 | 
            +
                "lib/taxamatch_rb.rb",
         | 
| 30 | 
            +
                "lib/taxamatch_rb/atomizer.rb",
         | 
| 31 | 
            +
                "lib/taxamatch_rb/authmatch.rb",
         | 
| 32 | 
            +
                "lib/taxamatch_rb/damerau_levenshtein_mod.rb",
         | 
| 33 | 
            +
                "lib/taxamatch_rb/normalizer.rb",
         | 
| 34 | 
            +
                "lib/taxamatch_rb/phonetizer.rb",
         | 
| 35 | 
            +
                "spec/damerau_levenshtein_mod_test.txt",
         | 
| 36 | 
            +
                "spec/spec.opts",
         | 
| 37 | 
            +
                "spec/spec_helper.rb",
         | 
| 38 | 
            +
                "spec/taxamatch_rb_spec.rb",
         | 
| 39 | 
            +
                "spec/taxamatch_test.txt",
         | 
| 40 | 
            +
                "taxamatch_rb.gemspec"
         | 
| 41 | 
            +
              ]
         | 
| 42 | 
            +
              s.homepage = %q{http://github.com/GlobalNamesArchitecture/taxamatch_rb}
         | 
| 43 | 
            +
              s.require_paths = ["lib"]
         | 
| 44 | 
            +
              s.rubygems_version = %q{1.3.7}
         | 
| 45 | 
            +
              s.summary = %q{Implementation of Tony Rees Taxamatch algorithms}
         | 
| 46 | 
            +
             | 
| 47 | 
            +
              if s.respond_to? :specification_version then
         | 
| 48 | 
            +
                current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
         | 
| 49 | 
            +
                s.specification_version = 3
         | 
| 50 | 
            +
             | 
| 51 | 
            +
                if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
         | 
| 52 | 
            +
                  s.add_runtime_dependency(%q<biodiversity>, ["~> 0.5.13"])
         | 
| 53 | 
            +
                  s.add_runtime_dependency(%q<biodiversity19>, ["~> 0.5.13"])
         | 
| 54 | 
            +
                  s.add_runtime_dependency(%q<rake-compiler>, [">= 0"])
         | 
| 55 | 
            +
                  s.add_development_dependency(%q<rspec>, ["~> 2.3.0"])
         | 
| 56 | 
            +
                  s.add_development_dependency(%q<cucumber>, [">= 0"])
         | 
| 57 | 
            +
                  s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
         | 
| 58 | 
            +
                  s.add_development_dependency(%q<jeweler>, ["~> 1.6.0"])
         | 
| 59 | 
            +
                  s.add_development_dependency(%q<rcov>, [">= 0"])
         | 
| 60 | 
            +
                  s.add_development_dependency(%q<ruby-debug19>, [">= 0"])
         | 
| 61 | 
            +
                  s.add_development_dependency(%q<ruby-prof>, [">= 0"])
         | 
| 62 | 
            +
                  s.add_development_dependency(%q<shoulda>, [">= 0"])
         | 
| 63 | 
            +
                  s.add_development_dependency(%q<mocha>, [">= 0"])
         | 
| 64 | 
            +
                  s.add_runtime_dependency(%q<biodiversity>, [">= 0.5.13"])
         | 
| 65 | 
            +
                else
         | 
| 66 | 
            +
                  s.add_dependency(%q<biodiversity>, ["~> 0.5.13"])
         | 
| 67 | 
            +
                  s.add_dependency(%q<biodiversity19>, ["~> 0.5.13"])
         | 
| 68 | 
            +
                  s.add_dependency(%q<rake-compiler>, [">= 0"])
         | 
| 69 | 
            +
                  s.add_dependency(%q<rspec>, ["~> 2.3.0"])
         | 
| 70 | 
            +
                  s.add_dependency(%q<cucumber>, [">= 0"])
         | 
| 71 | 
            +
                  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
         | 
| 72 | 
            +
                  s.add_dependency(%q<jeweler>, ["~> 1.6.0"])
         | 
| 73 | 
            +
                  s.add_dependency(%q<rcov>, [">= 0"])
         | 
| 74 | 
            +
                  s.add_dependency(%q<ruby-debug19>, [">= 0"])
         | 
| 75 | 
            +
                  s.add_dependency(%q<ruby-prof>, [">= 0"])
         | 
| 76 | 
            +
                  s.add_dependency(%q<shoulda>, [">= 0"])
         | 
| 77 | 
            +
                  s.add_dependency(%q<mocha>, [">= 0"])
         | 
| 78 | 
            +
                  s.add_dependency(%q<biodiversity>, [">= 0.5.13"])
         | 
| 79 | 
            +
                end
         | 
| 80 | 
            +
              else
         | 
| 81 | 
            +
                s.add_dependency(%q<biodiversity>, ["~> 0.5.13"])
         | 
| 82 | 
            +
                s.add_dependency(%q<biodiversity19>, ["~> 0.5.13"])
         | 
| 83 | 
            +
                s.add_dependency(%q<rake-compiler>, [">= 0"])
         | 
| 84 | 
            +
                s.add_dependency(%q<rspec>, ["~> 2.3.0"])
         | 
| 85 | 
            +
                s.add_dependency(%q<cucumber>, [">= 0"])
         | 
| 86 | 
            +
                s.add_dependency(%q<bundler>, ["~> 1.0.0"])
         | 
| 87 | 
            +
                s.add_dependency(%q<jeweler>, ["~> 1.6.0"])
         | 
| 88 | 
            +
                s.add_dependency(%q<rcov>, [">= 0"])
         | 
| 89 | 
            +
                s.add_dependency(%q<ruby-debug19>, [">= 0"])
         | 
| 90 | 
            +
                s.add_dependency(%q<ruby-prof>, [">= 0"])
         | 
| 91 | 
            +
                s.add_dependency(%q<shoulda>, [">= 0"])
         | 
| 92 | 
            +
                s.add_dependency(%q<mocha>, [">= 0"])
         | 
| 93 | 
            +
                s.add_dependency(%q<biodiversity>, [">= 0.5.13"])
         | 
| 94 | 
            +
              end
         | 
| 95 | 
            +
            end
         | 
| 96 | 
            +
             | 
    
        metadata
    CHANGED
    
    | @@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version | |
| 5 5 | 
             
              segments: 
         | 
| 6 6 | 
             
              - 0
         | 
| 7 7 | 
             
              - 7
         | 
| 8 | 
            -
              -  | 
| 9 | 
            -
              version: 0.7. | 
| 8 | 
            +
              - 5
         | 
| 9 | 
            +
              version: 0.7.5
         | 
| 10 10 | 
             
            platform: ruby
         | 
| 11 11 | 
             
            authors: 
         | 
| 12 12 | 
             
            - Dmitry Mozzherin
         | 
| @@ -57,7 +57,7 @@ dependencies: | |
| 57 57 | 
             
                    segments: 
         | 
| 58 58 | 
             
                    - 0
         | 
| 59 59 | 
             
                    version: "0"
         | 
| 60 | 
            -
              type: : | 
| 60 | 
            +
              type: :development
         | 
| 61 61 | 
             
              prerelease: false
         | 
| 62 62 | 
             
              version_requirements: *id003
         | 
| 63 63 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| @@ -183,34 +183,6 @@ dependencies: | |
| 183 183 | 
             
              type: :development
         | 
| 184 184 | 
             
              prerelease: false
         | 
| 185 185 | 
             
              version_requirements: *id012
         | 
| 186 | 
            -
            - !ruby/object:Gem::Dependency 
         | 
| 187 | 
            -
              name: biodiversity
         | 
| 188 | 
            -
              requirement: &id013 !ruby/object:Gem::Requirement 
         | 
| 189 | 
            -
                none: false
         | 
| 190 | 
            -
                requirements: 
         | 
| 191 | 
            -
                - - ">="
         | 
| 192 | 
            -
                  - !ruby/object:Gem::Version 
         | 
| 193 | 
            -
                    segments: 
         | 
| 194 | 
            -
                    - 0
         | 
| 195 | 
            -
                    - 5
         | 
| 196 | 
            -
                    - 13
         | 
| 197 | 
            -
                    version: 0.5.13
         | 
| 198 | 
            -
              type: :runtime
         | 
| 199 | 
            -
              prerelease: false
         | 
| 200 | 
            -
              version_requirements: *id013
         | 
| 201 | 
            -
            - !ruby/object:Gem::Dependency 
         | 
| 202 | 
            -
              name: rake-compiler
         | 
| 203 | 
            -
              requirement: &id014 !ruby/object:Gem::Requirement 
         | 
| 204 | 
            -
                none: false
         | 
| 205 | 
            -
                requirements: 
         | 
| 206 | 
            -
                - - ">="
         | 
| 207 | 
            -
                  - !ruby/object:Gem::Version 
         | 
| 208 | 
            -
                    segments: 
         | 
| 209 | 
            -
                    - 0
         | 
| 210 | 
            -
                    version: "0"
         | 
| 211 | 
            -
              type: :runtime
         | 
| 212 | 
            -
              prerelease: false
         | 
| 213 | 
            -
              version_requirements: *id014
         | 
| 214 186 | 
             
            description: This gem implements algorithm for fuzzy matching scientific names developed by Tony Rees
         | 
| 215 187 | 
             
            email: dmozzherin@eol.org
         | 
| 216 188 | 
             
            executables: []
         | 
| @@ -221,12 +193,17 @@ extra_rdoc_files: | |
| 221 193 | 
             
            - LICENSE
         | 
| 222 194 | 
             
            - README.rdoc
         | 
| 223 195 | 
             
            files: 
         | 
| 196 | 
            +
            - Gemfile
         | 
| 224 197 | 
             
            - Gemfile.lock
         | 
| 198 | 
            +
            - LICENSE
         | 
| 199 | 
            +
            - Makefile
         | 
| 225 200 | 
             
            - README.rdoc
         | 
| 201 | 
            +
            - Rakefile
         | 
| 202 | 
            +
            - VERSION
         | 
| 203 | 
            +
            - ext/damerau_levenshtein/damerau_levenshtein.c
         | 
| 226 204 | 
             
            - lib/taxamatch_rb.rb
         | 
| 227 205 | 
             
            - lib/taxamatch_rb/atomizer.rb
         | 
| 228 206 | 
             
            - lib/taxamatch_rb/authmatch.rb
         | 
| 229 | 
            -
            - lib/taxamatch_rb/damerau_levenshtein.bundle
         | 
| 230 207 | 
             
            - lib/taxamatch_rb/damerau_levenshtein_mod.rb
         | 
| 231 208 | 
             
            - lib/taxamatch_rb/normalizer.rb
         | 
| 232 209 | 
             
            - lib/taxamatch_rb/phonetizer.rb
         | 
| @@ -235,7 +212,7 @@ files: | |
| 235 212 | 
             
            - spec/spec_helper.rb
         | 
| 236 213 | 
             
            - spec/taxamatch_rb_spec.rb
         | 
| 237 214 | 
             
            - spec/taxamatch_test.txt
         | 
| 238 | 
            -
            -  | 
| 215 | 
            +
            - taxamatch_rb.gemspec
         | 
| 239 216 | 
             
            - ext/damerau_levenshtein/extconf.rb
         | 
| 240 217 | 
             
            has_rdoc: true
         | 
| 241 218 | 
             
            homepage: http://github.com/GlobalNamesArchitecture/taxamatch_rb
         | 
| @@ -251,7 +228,7 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 251 228 | 
             
              requirements: 
         | 
| 252 229 | 
             
              - - ">="
         | 
| 253 230 | 
             
                - !ruby/object:Gem::Version 
         | 
| 254 | 
            -
                  hash: - | 
| 231 | 
            +
                  hash: -571731221339913870
         | 
| 255 232 | 
             
                  segments: 
         | 
| 256 233 | 
             
                  - 0
         | 
| 257 234 | 
             
                  version: "0"
         | 
| Binary file |