rtesseract 1.2.3 → 1.2.4

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
  SHA1:
3
- metadata.gz: 289089ba85c97772c7a7ce7c37cc57d543403ccf
4
- data.tar.gz: d7c5a0630399a4a29299e68f3063554925129a23
3
+ metadata.gz: 3c0de1bfd6a7cf6da12f9fb4d47b9c63378189e7
4
+ data.tar.gz: fcc17c72d0e226b0792d2e70fe00e9a3bf86b0a4
5
5
  SHA512:
6
- metadata.gz: 8e6aa15578ac98e45469f423dbfd8568b99716519274094f7a582c92deac6c2b60627034a9ad05a5f1ddad34979fcc59b189d2a68d8a18cdf95fc66fc11c6c81
7
- data.tar.gz: d34561a264b2725d192fbafe41856cf107c41df810238ad0b460526da3b14b0f517ccd120d650cb602f426f7886c17d2e59e7463f14d398d5644ac9f36131e97
6
+ metadata.gz: 1143b77a120a3e678383949a85679b8017541da10f48d77beb2581fc090233eb97d49081633f218bb2b04b81b86804e1b00283a75031bcd34f4b2d754ef4c02c
7
+ data.tar.gz: 8c1b65786aec42df66bf904abc5e5d3721ab15637178fcba93686bb8f0ff7bd134457e4aa0981842ba90be7480b43aaa4e5e3264b9b158628cfd287dd61c318c
data/README.rdoc CHANGED
@@ -11,7 +11,7 @@ Ruby library for working with the Tesseract OCR.
11
11
 
12
12
  To work properly rtesseract are needed:
13
13
  * Tesseract - Program
14
- * ImageMagic - Program
14
+ * ImageMagick - Program
15
15
  * RMagick or mini_magick or quick_magick - Gem
16
16
 
17
17
  Atention: Version 1.0.0 works fine with Ruby 2.0 and tesseract 3.0 and lower versions of rtesseract works fine with Ruby 1.8 and tesseract 2.0.4.
@@ -78,6 +78,15 @@ Language Options
78
78
  * spa - Spanish
79
79
  * vie - Vietnamese
80
80
  Note: Make sure you have installed the language to tesseract
81
+
82
+ Other Options
83
+
84
+ RTesseract.new("test.jpg", options: :digits) # Only digit recognition
85
+
86
+ OR
87
+
88
+ RTesseract.new("test.jpg", options: [:digits, :quiet])
89
+
81
90
 
82
91
  == Contributing to rtesseract
83
92
 
@@ -98,4 +107,4 @@ Language Options
98
107
  == Copyright
99
108
 
100
109
  Copyright (c) 2014 Danilo Jeremias da Silva. See LICENSE.txt for
101
- further details.
110
+ further details.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.3
1
+ 1.2.4
data/lib/rtesseract.rb CHANGED
@@ -16,8 +16,9 @@ class RTesseract
16
16
  attr_writer :lang
17
17
  attr_writer :psm
18
18
  attr_reader :processor
19
+ attr_accessor :options_cmd
19
20
 
20
- OPTIONS = %w(command lang psm processor debug clear_console_output)
21
+ OPTIONS = %w(command lang psm processor debug clear_console_output options)
21
22
  # Aliases to languages names
22
23
  LANGUAGES = {
23
24
  'eng' => %w(en en-us english),
@@ -38,11 +39,13 @@ class RTesseract
38
39
  end
39
40
 
40
41
  def command_line_options(options)
41
- @command = fetch_option(options, :command, default_command)
42
- @lang = fetch_option(options, :lang, '')
43
- @psm = fetch_option(options, :psm, nil)
44
- @processor = fetch_option(options, :processor, 'rmagick')
45
- @debug = fetch_option(options, :debug, false)
42
+ @command = fetch_option(options, :command, default_command)
43
+ @lang = fetch_option(options, :lang, '')
44
+ @psm = fetch_option(options, :psm, nil)
45
+ @processor = fetch_option(options, :processor, 'rmagick')
46
+ @debug = fetch_option(options, :debug, false)
47
+ @options_cmd = fetch_option(options, :options, [])
48
+ @options_cmd = [@options_cmd] unless @options_cmd.kind_of?(Array)
46
49
 
47
50
  # Disable clear console if debug mode
48
51
  @clear_console_output = @debug ? false : fetch_option(options, :clear_console_output, true)
@@ -154,7 +157,7 @@ class RTesseract
154
157
 
155
158
  # Convert image to string
156
159
  def convert
157
- `#{@command} "#{image}" "#{text_file.gsub('.txt', '')}" #{lang} #{psm} #{config_file} #{clear_console_output}`
160
+ `#{@command} "#{image}" "#{text_file.gsub('.txt', '')}" #{lang} #{psm} #{config_file} #{clear_console_output} #{@options_cmd.join(' ')}`
158
161
  @value = File.read(@text_file).to_s
159
162
  remove_file([@image, @text_file])
160
163
  rescue => error
data/rtesseract.gemspec CHANGED
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: rtesseract 1.2.3 ruby lib
5
+ # stub: rtesseract 1.2.4 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "rtesseract"
9
- s.version = "1.2.3"
9
+ s.version = "1.2.4"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Danilo Jeremias da Silva"]
14
- s.date = "2014-08-18"
14
+ s.date = "2014-09-05"
15
15
  s.description = "Ruby library for working with the Tesseract OCR."
16
16
  s.email = "dannnylo@gmail.com"
17
17
  s.extra_rdoc_files = [
@@ -74,6 +74,13 @@ describe "Rtesseract" do
74
74
  RTesseract.new(@image_tiff,{:lang=>MakeStringError.new}).lang.should eql("")
75
75
  end
76
76
 
77
+ it " select options" do
78
+ expect(RTesseract.new(@image_tiff).options_cmd).to eql([])
79
+ expect(RTesseract.new(@image_tiff, options: 'digits').options_cmd).to eql(['digits'])
80
+ expect(RTesseract.new(@image_tiff, options: :digits).options_cmd).to eql([:digits])
81
+ expect(RTesseract.new(@image_tiff, options: [:digits, :quiet]).options_cmd).to eql([:digits, :quiet])
82
+ end
83
+
77
84
  it " be configurable" do
78
85
  RTesseract.new(@image_tiff,{:chop_enable=>0,:enable_assoc=>0,:display_text=>0}).config.should eql("chop_enable 0\nenable_assoc 0\ndisplay_text 0")
79
86
  RTesseract.new(@image_tiff,{:chop_enable=>0}).config.should eql("chop_enable 0")
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: 1.2.3
4
+ version: 1.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danilo Jeremias da Silva
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-18 00:00:00.000000000 Z
11
+ date: 2014-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec