cassiopee 0.1.10 → 0.1.11
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/Changelog +1 -0
 - data/lib/cassiopee.rb +10 -10
 - metadata +6 -8
 
    
        data/Changelog
    CHANGED
    
    
    
        data/lib/cassiopee.rb
    CHANGED
    
    | 
         @@ -78,23 +78,23 @@ module Cassiopee 
     | 
|
| 
       78 
78 
     | 
    
         | 
| 
       79 
79 
     | 
    
         
             
                end
         
     | 
| 
       80 
80 
     | 
    
         | 
| 
       81 
     | 
    
         
            -
            	private
         
     | 
| 
       82 
81 
     | 
    
         | 
| 
       83 
82 
     | 
    
         
             
            	# Compute Levenshtein distance but using a mapping matrix of alphabet ambiguity
         
     | 
| 
       84 
83 
     | 
    
         
             
            	# Code comes from Text gem, Text::Levenshtein.distance, adapted for ambiguity comparison
         
     | 
| 
       85 
84 
     | 
    
         | 
| 
       86 
85 
     | 
    
         
             
                def computeLevenshteinAmbiguous(pattern, edit, ambiguous)
         
     | 
| 
       87 
     | 
    
         
            -
            	
         
     | 
| 
       88 
     | 
    
         
            -
            		encoding = defined?(Encoding) ? self.encoding.to_s : $KCODE
         
     | 
| 
       89 
86 
     | 
    
         | 
| 
       90 
     | 
    
         
            -
             
     | 
| 
       91 
     | 
    
         
            -
             
     | 
| 
       92 
     | 
    
         
            -
             
     | 
| 
       93 
     | 
    
         
            -
             
     | 
| 
       94 
     | 
    
         
            -
             
     | 
| 
      
 87 
     | 
    
         
            +
                    prepare =
         
     | 
| 
      
 88 
     | 
    
         
            +
                      if "ruby".respond_to?(:encoding)
         
     | 
| 
      
 89 
     | 
    
         
            +
                        lambda { |str| str.encode(Encoding::UTF_8).unpack("U*") }
         
     | 
| 
      
 90 
     | 
    
         
            +
                      else
         
     | 
| 
      
 91 
     | 
    
         
            +
                        rule = $KCODE.match(/^U/i) ? "U*" : "C*"
         
     | 
| 
      
 92 
     | 
    
         
            +
                        lambda { |str| str.unpack(rule) }
         
     | 
| 
      
 93 
     | 
    
         
            +
                      end
         
     | 
| 
       95 
94 
     | 
    
         | 
| 
       96 
     | 
    
         
            -
             
     | 
| 
       97 
     | 
    
         
            -
             
     | 
| 
      
 95 
     | 
    
         
            +
                    s, t = [self, pattern].map(&prepare)
         
     | 
| 
      
 96 
     | 
    
         
            +
             
     | 
| 
      
 97 
     | 
    
         
            +
            	
         
     | 
| 
       98 
98 
     | 
    
         
             
            		n = s.length
         
     | 
| 
       99 
99 
     | 
    
         
             
            		m = t.length
         
     | 
| 
       100 
100 
     | 
    
         
             
            		return m if (0 == n)
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,13 +1,13 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification 
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: cassiopee
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version 
         
     | 
| 
       4 
     | 
    
         
            -
              hash:  
     | 
| 
       5 
     | 
    
         
            -
              prerelease:  
     | 
| 
      
 4 
     | 
    
         
            +
              hash: 13
         
     | 
| 
      
 5 
     | 
    
         
            +
              prerelease: 
         
     | 
| 
       6 
6 
     | 
    
         
             
              segments: 
         
     | 
| 
       7 
7 
     | 
    
         
             
              - 0
         
     | 
| 
       8 
8 
     | 
    
         
             
              - 1
         
     | 
| 
       9 
     | 
    
         
            -
              -  
     | 
| 
       10 
     | 
    
         
            -
              version: 0.1. 
     | 
| 
      
 9 
     | 
    
         
            +
              - 11
         
     | 
| 
      
 10 
     | 
    
         
            +
              version: 0.1.11
         
     | 
| 
       11 
11 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       12 
12 
     | 
    
         
             
            authors: 
         
     | 
| 
       13 
13 
     | 
    
         
             
            - Olivier Sallou
         
     | 
| 
         @@ -15,8 +15,7 @@ autorequire: 
     | 
|
| 
       15 
15 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       16 
16 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
            date:  
     | 
| 
       19 
     | 
    
         
            -
            default_executable: 
         
     | 
| 
      
 18 
     | 
    
         
            +
            date: 2013-10-04 00:00:00 Z
         
     | 
| 
       20 
19 
     | 
    
         
             
            dependencies: 
         
     | 
| 
       21 
20 
     | 
    
         
             
            - !ruby/object:Gem::Dependency 
         
     | 
| 
       22 
21 
     | 
    
         
             
              name: text
         
     | 
| 
         @@ -53,7 +52,6 @@ files: 
     | 
|
| 
       53 
52 
     | 
    
         
             
            - bin/cassie.rb
         
     | 
| 
       54 
53 
     | 
    
         
             
            - tests/test-suite.rb
         
     | 
| 
       55 
54 
     | 
    
         
             
            - tests/amb.map
         
     | 
| 
       56 
     | 
    
         
            -
            has_rdoc: true
         
     | 
| 
       57 
55 
     | 
    
         
             
            homepage: https://github.com/osallou/cassiopee
         
     | 
| 
       58 
56 
     | 
    
         
             
            licenses: 
         
     | 
| 
       59 
57 
     | 
    
         
             
            - LGPL-3
         
     | 
| 
         @@ -83,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       83 
81 
     | 
    
         
             
            requirements: []
         
     | 
| 
       84 
82 
     | 
    
         | 
| 
       85 
83 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       86 
     | 
    
         
            -
            rubygems_version: 1. 
     | 
| 
      
 84 
     | 
    
         
            +
            rubygems_version: 1.8.15
         
     | 
| 
       87 
85 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       88 
86 
     | 
    
         
             
            specification_version: 3
         
     | 
| 
       89 
87 
     | 
    
         
             
            summary: Cassiopee index strings and provide exact or approximate search.
         
     |