rtesseract 3.1.1 → 3.1.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 +4 -4
 - data/CHANGELOG.md +36 -0
 - data/Gemfile.lock +1 -1
 - data/README.md +14 -14
 - data/lib/rtesseract/box.rb +7 -2
 - data/lib/rtesseract/version.rb +1 -1
 - metadata +3 -3
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 87f85a70ab24a03a719e7726d95debeb469d822c447acc39a8adc1579c43e6d1
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: a18cd83cd4632ed5adc096f9384659f0e47a4ba33e2f8a76e804cf8140e8798b
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 4f6b37e1645d5f82c759e5feea081cfcf5384e2ad91423d2d04030a89ef007eb9469ecf398ba4cd2364bf2baeea4bad885866c4c41b19fa4da2c078b79cef4a6
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: bea642e1d7d2576dbdaeeb68ff730627104894d914a405a4ec2a37b8c65755f2f9c33a5091e16eaced51162725b6ea62f647b764ec838eefe3bfe4f58f461986
         
     | 
    
        data/CHANGELOG.md
    CHANGED
    
    | 
         @@ -1,3 +1,39 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ## v3.1.2
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            #### Added
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            * Added confidence for each word in box mode
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            ## v3.1.1
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            #### Changed
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            * Changed RTesseract::Command to receive a block when success run
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            ## v3.1.0
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            #### Changed
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            * Removed nokogi dependency.
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
            ## v3.0.4
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            #### Changed
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
            * Updated dependencies by security alerts.
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
            ## v3.0.5
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
            #### Changed
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
            * Updated dependencies by security alerts.
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
            ## v3.0.4
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
            #### Changed
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
            * Updated dependencies by security alerts.
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
       1 
37 
     | 
    
         
             
            ## v3.0.3
         
     | 
| 
       2 
38 
     | 
    
         | 
| 
       3 
39 
     | 
    
         
             
            #### Changed
         
     | 
    
        data/Gemfile.lock
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | 
         @@ -100,20 +100,20 @@ This will preserve the image colors, pictures and structure in the generated pdf 
     | 
|
| 
       100 
100 
     | 
    
         
             
              ```ruby
         
     | 
| 
       101 
101 
     | 
    
         
             
                RTesseract.new('test_words.png').to_box
         
     | 
| 
       102 
102 
     | 
    
         
             
                => [
         
     | 
| 
       103 
     | 
    
         
            -
                  {:word => 'If', 
     | 
| 
       104 
     | 
    
         
            -
                  {:word => 'you', :x_start=>69, :y_start=>17, :x_end=>100, :y_end=>31},
         
     | 
| 
       105 
     | 
    
         
            -
                  {:word => 'are', :x_start=>108, :y_start=>17, :x_end=>136, :y_end=>27},
         
     | 
| 
       106 
     | 
    
         
            -
                  {:word => 'a', :x_start=> 
     | 
| 
       107 
     | 
    
         
            -
                  {:word => 'friend,', :x_start=>158, :y_start=>13, :x_end=>214, :y_end=>29},
         
     | 
| 
       108 
     | 
    
         
            -
                  {:word => 'you', :x_start=>51, :y_start=>39, :x_end=>82, :y_end=>53},
         
     | 
| 
       109 
     | 
    
         
            -
                  {:word => 'speak', :x_start=>90, :y_start=>35, :x_end=>140, :y_end=>53},
         
     | 
| 
       110 
     | 
    
         
            -
                  {:word => 'the', :x_start=>146, :y_start=>35, :x_end=>174, :y_end=>49},
         
     | 
| 
       111 
     | 
    
         
            -
                  {:word => 'password,', :x_start=>182, :y_start=>35, :x_end=>267, :y_end=>53},
         
     | 
| 
       112 
     | 
    
         
            -
                  {:word => 'and', :x_start=>51, :y_start=>57, :x_end=>81, :y_end=>71},
         
     | 
| 
       113 
     | 
    
         
            -
                  {:word => 'the', :x_start=>89, :y_start=>57, :x_end=>117, :y_end=>71},
         
     | 
| 
       114 
     | 
    
         
            -
                  {:word => 'doors', :x_start=>124, :y_start=>57, :x_end=>172, :y_end=>71},
         
     | 
| 
       115 
     | 
    
         
            -
                  {:word => 'will', :x_start=>180, :y_start=>57, :x_end=>208, :y_end=>71},
         
     | 
| 
       116 
     | 
    
         
            -
                  {:word => 'open.', :x_start=>216, :y_start=>61, :x_end=>263, :y_end=>75}
         
     | 
| 
      
 103 
     | 
    
         
            +
                  { :word => 'If', :confidence=>89, :x_start=>52, :y_start=>13, :x_end=>63, :y_end=>27},
         
     | 
| 
      
 104 
     | 
    
         
            +
                  { :word => 'you', :confidence=>96, :x_start=>69, :y_start=>17, :x_end=>100, :y_end=>31},
         
     | 
| 
      
 105 
     | 
    
         
            +
                  { :word => 'are', :confidence=>92, :x_start=>108, :y_start=>17, :x_end=>136, :y_end=>27},
         
     | 
| 
      
 106 
     | 
    
         
            +
                  { :word => 'a', :confidence=>92, :x_start=>133, :y_start=>8, :x_end=>147, :y_end=>35},
         
     | 
| 
      
 107 
     | 
    
         
            +
                  { :word => 'friend,', :confidence=>95, :x_start=>158, :y_start=>13, :x_end=>214, :y_end=>29},
         
     | 
| 
      
 108 
     | 
    
         
            +
                  { :word => 'you', :confidence=>96, :x_start=>51, :y_start=>39, :x_end=>82, :y_end=>53},
         
     | 
| 
      
 109 
     | 
    
         
            +
                  { :word => 'speak', :confidence=>96, :x_start=>90, :y_start=>35, :x_end=>140, :y_end=>53},
         
     | 
| 
      
 110 
     | 
    
         
            +
                  { :word => 'the', :confidence=>96, :x_start=>146, :y_start=>35, :x_end=>174, :y_end=>49},
         
     | 
| 
      
 111 
     | 
    
         
            +
                  { :word => 'password,', :confidence=>96, :x_start=>182, :y_start=>35, :x_end=>267, :y_end=>53},
         
     | 
| 
      
 112 
     | 
    
         
            +
                  { :word => 'and', :confidence=>96, :x_start=>51, :y_start=>57, :x_end=>81, :y_end=>71},
         
     | 
| 
      
 113 
     | 
    
         
            +
                  { :word => 'the', :confidence=>96, :x_start=>89, :y_start=>57, :x_end=>117, :y_end=>71},
         
     | 
| 
      
 114 
     | 
    
         
            +
                  { :word => 'doors', :confidence=>96, :x_start=>124, :y_start=>57, :x_end=>172, :y_end=>71},
         
     | 
| 
      
 115 
     | 
    
         
            +
                  { :word => 'will', :confidence=>96, :x_start=>180, :y_start=>57, :x_end=>208, :y_end=>71},
         
     | 
| 
      
 116 
     | 
    
         
            +
                  { :word => 'open.', :confidence=>96, :x_start=>216, :y_start=>61, :x_end=>263, :y_end=>75}
         
     | 
| 
       117 
117 
     | 
    
         
             
                ]
         
     | 
| 
       118 
118 
     | 
    
         
             
              ```
         
     | 
| 
       119 
119 
     | 
    
         | 
    
        data/lib/rtesseract/box.rb
    CHANGED
    
    | 
         @@ -24,12 +24,13 @@ class RTesseract 
     | 
|
| 
       24 
24 
     | 
    
         | 
| 
       25 
25 
     | 
    
         
             
                    return if word.strip == ''
         
     | 
| 
       26 
26 
     | 
    
         | 
| 
       27 
     | 
    
         
            -
                    word_info(word, parse_position(line))
         
     | 
| 
      
 27 
     | 
    
         
            +
                    word_info(word, parse_position(line), parse_confidence(line))
         
     | 
| 
       28 
28 
     | 
    
         
             
                  end
         
     | 
| 
       29 
29 
     | 
    
         | 
| 
       30 
     | 
    
         
            -
                  def word_info(word, positions)
         
     | 
| 
      
 30 
     | 
    
         
            +
                  def word_info(word, positions, confidence)
         
     | 
| 
       31 
31 
     | 
    
         
             
                    {
         
     | 
| 
       32 
32 
     | 
    
         
             
                      word: word,
         
     | 
| 
      
 33 
     | 
    
         
            +
                      confidence: confidence[-1].to_i,
         
     | 
| 
       33 
34 
     | 
    
         
             
                      x_start: positions[1].to_i,
         
     | 
| 
       34 
35 
     | 
    
         
             
                      y_start: positions[2].to_i,
         
     | 
| 
       35 
36 
     | 
    
         
             
                      x_end: positions[3].to_i,
         
     | 
| 
         @@ -40,6 +41,10 @@ class RTesseract 
     | 
|
| 
       40 
41 
     | 
    
         
             
                  def parse_position(line)
         
     | 
| 
       41 
42 
     | 
    
         
             
                    line.match(/(?<=title)(.*?)(?=;)/).to_s.split(' ')
         
     | 
| 
       42 
43 
     | 
    
         
             
                  end
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
                  def parse_confidence(line)
         
     | 
| 
      
 46 
     | 
    
         
            +
                    line.match(/(?<=;)(.*?)(?=')/).to_s.split(' ')
         
     | 
| 
      
 47 
     | 
    
         
            +
                  end
         
     | 
| 
       43 
48 
     | 
    
         
             
                end
         
     | 
| 
       44 
49 
     | 
    
         
             
              end
         
     | 
| 
       45 
50 
     | 
    
         
             
            end
         
     | 
    
        data/lib/rtesseract/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: rtesseract
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 3.1. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 3.1.2
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Danilo Jeremias da Silva
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2020- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2020-08-23 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: bundler
         
     | 
| 
         @@ -118,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       118 
118 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       119 
119 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       120 
120 
     | 
    
         
             
            requirements: []
         
     | 
| 
       121 
     | 
    
         
            -
            rubygems_version: 3. 
     | 
| 
      
 121 
     | 
    
         
            +
            rubygems_version: 3.1.2
         
     | 
| 
       122 
122 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       123 
123 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       124 
124 
     | 
    
         
             
            summary: Ruby library for working with the Tesseract OCR.
         
     |