sqed 0.5.5 → 0.5.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sqed/parser/ocr_parser.rb +8 -7
- data/lib/sqed/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 859284ee0315947b5b5abbdc81936cc190c40f451c5277a554d3639d81e59802
|
4
|
+
data.tar.gz: aa489d6ac24b4f85ad7e7775b41dbf2a668aea41b4e9c57508ae38dc82b2a88e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4eead853f655ca15dab7e5dab13e73607642b61b28dfc4d416157eb4a66db3f13e7968c73a8ec48bd69b924f6fdb9b9c42a6a12b977aaebe1915d0694f9d11a
|
7
|
+
data.tar.gz: b6b6c70dc8025b2d3907c34e56e278f81c6b021fd3aff8e00fb18d3a75bac17c678f2148531a3de47d22abd259bcc7895e6a1df51be3fac262da986a7be1c69a
|
@@ -110,7 +110,7 @@ class Sqed::Parser::OcrParser < Sqed::Parser
|
|
110
110
|
# the ocr text
|
111
111
|
# TODO: very kludge
|
112
112
|
def get_text(section_type: :default)
|
113
|
-
img = image
|
113
|
+
img = image
|
114
114
|
|
115
115
|
# resample if an image 4"x4" is less than 300dpi
|
116
116
|
if img.columns * img.rows < 144000
|
@@ -121,9 +121,9 @@ class Sqed::Parser::OcrParser < Sqed::Parser
|
|
121
121
|
params.merge!(SECTION_PARAMS[section_type])
|
122
122
|
|
123
123
|
# May be able to overcome this hacky kludge messe with providing `processor:` to new
|
124
|
-
file = Tempfile.new('foo1', encoding: '
|
124
|
+
file = Tempfile.new('foo1', encoding: 'utf-8')
|
125
125
|
begin
|
126
|
-
file.write(image.to_blob)
|
126
|
+
file.write(image.to_blob.force_encoding('utf-8'))
|
127
127
|
file.rewind
|
128
128
|
@extracted_text = RTesseract.new(file.path, params).to_s&.strip
|
129
129
|
file.close
|
@@ -133,9 +133,9 @@ class Sqed::Parser::OcrParser < Sqed::Parser
|
|
133
133
|
end
|
134
134
|
|
135
135
|
if @extracted_text == ''
|
136
|
-
file = Tempfile.new('foo2')
|
136
|
+
file = Tempfile.new('foo2', encoding: 'utf-8')
|
137
137
|
begin
|
138
|
-
file.write(img.dup.white_threshold(245).to_blob)
|
138
|
+
file.write(img.dup.white_threshold(245).to_blob.force_encoding('utf-8'))
|
139
139
|
file.rewind
|
140
140
|
@extracted_text = RTesseract.new(file.path, params).to_s&.strip
|
141
141
|
file.close
|
@@ -146,9 +146,9 @@ class Sqed::Parser::OcrParser < Sqed::Parser
|
|
146
146
|
end
|
147
147
|
|
148
148
|
if @extracted_text == ''
|
149
|
-
file = Tempfile.new('foo3')
|
149
|
+
file = Tempfile.new('foo3', encoding: 'utf-8')
|
150
150
|
begin
|
151
|
-
file.write(img.dup.quantize(256, Magick::GRAYColorspace).to_blob)
|
151
|
+
file.write(img.dup.quantize(256, Magick::GRAYColorspace).to_blob.force_encoding('utf-8'))
|
152
152
|
file.rewind
|
153
153
|
@extracted_text = RTesseract.new(file.path, params).to_s&.strip
|
154
154
|
file.close
|
@@ -162,3 +162,4 @@ class Sqed::Parser::OcrParser < Sqed::Parser
|
|
162
162
|
end
|
163
163
|
|
164
164
|
end
|
165
|
+
|
data/lib/sqed/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sqed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Yoder
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-04-
|
12
|
+
date: 2019-04-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|